MCPcopy Create free account
hub / github.com/claude-code-best/claude-code / generateFunFactoid

Function generateFunFactoid

src/components/Stats.tsx:521–552  ·  view source on GitHub ↗
(stats: ClaudeCodeStats, totalTokens: number)

Source from the content-addressed store, hash-verified

519];
520
521function 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
554function ModelsTab({
555 stats,

Callers 2

OverviewTabFunction · 0.85
renderOverviewToAnsiFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected