diff --git a/apps/web/src/features/tracks/components/TrackStatsDisplay.stories.tsx b/apps/web/src/features/tracks/components/TrackStatsDisplay.stories.tsx index d8466bd6d..0e61b0ca1 100644 --- a/apps/web/src/features/tracks/components/TrackStatsDisplay.stories.tsx +++ b/apps/web/src/features/tracks/components/TrackStatsDisplay.stories.tsx @@ -4,7 +4,15 @@ import { TrackStatsDisplay } from './TrackStatsDisplay'; const meta = { title: 'Components/Features/Tracks/TrackStatsDisplay', component: TrackStatsDisplay, + parameters: { layout: 'centered' }, tags: ['autodocs'], + decorators: [ + (Story) => ( +
+ +
+ ), + ], } satisfies Meta; export default meta; @@ -17,9 +25,26 @@ export const Horizontal: Story = { }, }; +export const HorizontalWithLabels: Story = { + args: { + trackId: 1, + variant: 'horizontal', + showLabels: true, + }, +}; + export const Grid: Story = { args: { trackId: 1, variant: 'grid', }, }; + +/** Grid + labels to validate chart tokens and transitions. */ +export const VisualStressTest: Story = { + args: { + trackId: 1, + variant: 'grid', + showLabels: true, + }, +}; diff --git a/apps/web/src/features/tracks/components/TrackStatsDisplay.tsx b/apps/web/src/features/tracks/components/TrackStatsDisplay.tsx index b59a2a74c..6c939ccf0 100644 --- a/apps/web/src/features/tracks/components/TrackStatsDisplay.tsx +++ b/apps/web/src/features/tracks/components/TrackStatsDisplay.tsx @@ -53,27 +53,63 @@ export function TrackStatsDisplay({ return `${secs}s`; }; - if (loading) return
SCANNING...
; + if (loading) { + return ( +
+ + SCANNING... +
+ ); + } if (error || !stats) return null; const statsItems = [ - { icon: Eye, value: formatNumber(stats.views), label: 'Views', color: 'text-cyan-500', bg: 'bg-cyan-500/10' }, - { icon: Heart, value: formatNumber(stats.likes), label: 'Likes', color: 'text-magenta-500', bg: 'bg-magenta-500/10' }, - { icon: MessageCircle, value: formatNumber(stats.comments), label: 'Comms', color: 'text-lime-500', bg: 'bg-lime-500/10' }, - { icon: Download, value: formatNumber(stats.downloads), label: 'Data', color: 'text-gold-500', bg: 'bg-gold-500/10' }, + { icon: Eye, value: formatNumber(stats.views), label: 'Views', color: 'text-chart-1', bg: 'bg-chart-1/10' }, + { icon: Heart, value: formatNumber(stats.likes), label: 'Likes', color: 'text-chart-2', bg: 'bg-chart-2/10' }, + { icon: MessageCircle, value: formatNumber(stats.comments), label: 'Comms', color: 'text-chart-3', bg: 'bg-chart-3/10' }, + { icon: Download, value: formatNumber(stats.downloads), label: 'Data', color: 'text-chart-4', bg: 'bg-chart-4/10' }, { icon: Clock, value: formatDuration(stats.total_play_time), label: 'Pulse', color: 'text-primary', bg: 'bg-primary/10' }, ]; if (variant === 'grid') { return ( -
+
{statsItems.map((item, i) => { const Icon = item.icon; return ( - -
-
{item.value}
-
{item.label}
+ +
+ +
+
+ {item.value} +
+
+ {item.label} +
); })} @@ -82,15 +118,37 @@ export function TrackStatsDisplay({ } return ( -
+
{statsItems.map((item, i) => { const Icon = item.icon; return ( -
-
+
+
+ +
- {item.value} - {showLabels && {item.label}} + + {item.value} + + {showLabels && ( + + {item.label} + + )}
);