# All files / src/components/admin/systemConfiguration ContentDisplayCard.tsx

0% Statements 0/5
0% Branches 0/2
0% Functions 0/1
0% Lines 0/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50

     'use client';

    import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
    import { Label } from '@/components/ui/label';
    import { Switch } from '@/components/ui/switch';
    import { Settings } from 'lucide-react';

    export type ContentDisplayCardProps = {
      t: (key: string, options?: Record<string, any>) => string;
      config: any;
      parseBoolConfig: (val: unknown) => boolean;
      isUpdating: boolean;
      onToggleHideEmpty: () => void;
    };

    export default function ContentDisplayCard({
      t,
      config,
      parseBoolConfig,
      isUpdating,
      onToggleHideEmpty}: ContentDisplayCardProps) {
      return (
        <Card>
          <CardHeader>
            <CardTitle className="flex items-center gap-2">
              <Settings className="h-5 w-5" />
              {t('systemConfiguration.contentDisplayTitle', {})}
            </CardTitle>
            <CardDescription>
              {t('systemConfiguration.contentDisplayDescription', {})}
            </CardDescription>
          </CardHeader>
          <CardContent>
            <div className="flex items-center justify-between gap-4 py-2">
              <div>
                <Label className="text-sm font-medium">{t('systemConfiguration.hideEmptyEpisodesLabel', {})}</Label>
                <p className="text-xs text-muted-foreground">{t('systemConfiguration.hideEmptyEpisodesDescription', {})}</p>
              </div>
              <Switch
                checked={parseBoolConfig((config as any).hide_empty_episodes) === false ? false : (config as any).hide_empty_episodes === 'true'}
                onCheckedChange={onToggleHideEmpty}
                aria-label={t('systemConfiguration.hideEmptyEpisodesLabel')}
                disabled={isUpdating}
              />
            </div>
          </CardContent>
        </Card>
      );
    }