(stats: ClaudeCodeStats, totalTokens: number)
| 519 | ]; |
| 520 | |
| 521 | function generateFunFactoid(stats: ClaudeCodeStats, totalTokens: number): string { |
| 522 | const factoids: string[] = []; |
| 523 | |
| 524 | if (totalTokens > 0) { |
| 525 | const matchingBooks = BOOK_COMPARISONS.filter(book => totalTokens >= book.tokens); |
| 526 | |
| 527 | for (const book of matchingBooks) { |
| 528 | const times = totalTokens / book.tokens; |
| 529 | if (times >= 2) { |
| 530 | factoids.push(`You've used ~${Math.floor(times)}x more tokens than ${book.name}`); |
| 531 | } else { |
| 532 | factoids.push(`You've used the same number of tokens as ${book.name}`); |
| 533 | } |
| 534 | } |
| 535 | } |
| 536 | |
| 537 | if (stats.longestSession) { |
| 538 | const sessionMinutes = stats.longestSession.duration / (1000 * 60); |
| 539 | for (const comparison of TIME_COMPARISONS) { |
| 540 | const ratio = sessionMinutes / comparison.minutes; |
| 541 | if (ratio >= 2) { |
| 542 | factoids.push(`Your longest session is ~${Math.floor(ratio)}x longer than ${comparison.name}`); |
| 543 | } |
| 544 | } |
| 545 | } |
| 546 | |
| 547 | if (factoids.length === 0) { |
| 548 | return ''; |
| 549 | } |
| 550 | const randomIndex = Math.floor(Math.random() * factoids.length); |
| 551 | return factoids[randomIndex]!; |
| 552 | } |
| 553 | |
| 554 | function ModelsTab({ |
| 555 | stats, |
no test coverage detected