diff --git a/src/widgets/media-requests/MediaRequestStatsTile.tsx b/src/widgets/media-requests/MediaRequestStatsTile.tsx index 12e64c1d1..256d66978 100644 --- a/src/widgets/media-requests/MediaRequestStatsTile.tsx +++ b/src/widgets/media-requests/MediaRequestStatsTile.tsx @@ -7,6 +7,7 @@ import { WidgetLoading } from '../loading'; import { IWidget } from '../widgets'; import { useMediaRequestQuery } from './media-request-query'; import { MediaRequestStatus } from './media-request-types'; +import { string } from 'zod'; const definition = defineWidget({ id: 'media-requests-stats', @@ -14,10 +15,10 @@ const definition = defineWidget({ options: { direction: { type: 'select', - defaultValue: 'horizontal', + defaultValue: 'row' as 'row' | 'column', data: [ - { label: 'Horizontal', value: 'horizontal' }, - { label: 'Vertical', value: 'vertical' }, + { label: 'Horizontal', value: 'row' }, + { label: 'Vertical', value: 'column' }, ], }, }, @@ -49,40 +50,42 @@ function MediaRequestStatsTile({ widget }: MediaRequestStatsWidgetProps) { w="100%" h="100%" gap="md" - direction={ widget.properties.direction != 'vertical' ? 'row' : 'column' } + direction={ widget.properties.direction?? 'row' } > - - - - {data.filter((x) => x.status === MediaRequestStatus.PendingApproval).length} - - - {t('stats.pending')} - - - - - - - {data.filter((x) => x.type === 'tv').length} - - - {t('stats.tvRequests')} - - - - - - - {data.filter((x) => x.type === 'movie').length} - - - {t('stats.movieRequests')} - - - + x.status === MediaRequestStatus.PendingApproval).length} + label={t('stats.pending')} + /> + x.type === 'tv').length} + label={t('stats.tvRequests')} + /> + x.type === 'movie').length} + label={t('stats.movieRequests')} + /> ); } +interface StatCardProps { + number: number; + label: string; +} + +const StatCard = ({ number, label }: StatCardProps) => { + return ( + + + + {number} + + + {label} + + + + ); +}; + export default definition; \ No newline at end of file