MCPcopy Create free account
hub / github.com/0010aor/FlashNotes / StatsSummaryGrid

Function StatsSummaryGrid

frontend/src/components/stats/StatsSummaryGrid.tsx:43–88  ·  view source on GitHub ↗
({ collectionInfo, recentSessions }: StatsSummaryGridProps)

Source from the content-addressed store, hash-verified

41}
42
43const StatsSummaryGrid = ({ collectionInfo, recentSessions }: StatsSummaryGridProps) => {
44 const { t } = useTranslation()
45
46 const averageAccuracy = calculateAverageAccuracy(recentSessions)
47 const learningTrend = calculateLearningTrend(recentSessions)
48
49 const formattedTrend =
50 learningTrend !== null ? `${learningTrend > 0 ? '+' : ''}${learningTrend}%` : '-'
51
52 return (
53 <SimpleGrid columns={{ base: 1, md: 2, lg: 4 }} gap={4}>
54 <StatCard label={t('general.words.totalCards')} value={collectionInfo.total_cards} />
55 <StatCard
56 label={t('components.stats.practiceSessions')}
57 value={collectionInfo.total_practice_sessions}
58 />
59 <StatCard
60 label={t('components.stats.averageAccuracy')}
61 value={averageAccuracy !== null ? `${averageAccuracy}%` : '-'}
62 helpText={
63 averageAccuracy !== null
64 ? t('components.stats.allSessions')
65 : t('components.stats.noRecentSessions')
66 }
67 />
68 <StatCard
69 label={t('components.stats.learningTrend')}
70 value={formattedTrend}
71 helpText={
72 learningTrend !== null
73 ? t('components.stats.comparedToPrevious')
74 : t('components.stats.notEnoughData')
75 }
76 valueColor={
77 learningTrend !== null
78 ? learningTrend > 0
79 ? 'green.500'
80 : learningTrend < 0
81 ? 'red.500'
82 : undefined
83 : undefined
84 }
85 />
86 </SimpleGrid>
87 )
88}
89
90export default StatsSummaryGrid

Callers

nothing calls this directly

Calls 3

calculateAverageAccuracyFunction · 0.90
calculateLearningTrendFunction · 0.90
tFunction · 0.85

Tested by

no test coverage detected