|
| 1 | +/** |
| 2 | + * The page furniture around the Live Activity grid, in both of its modes. |
| 3 | + * |
| 4 | + * Normally that is a heading and the controls; in fullscreen it is a thin |
| 5 | + * translucent bar and nothing else, so a wall display shows tiles. Montage's |
| 6 | + * own fullscreen bar is not reused: it carries the kiosk lock and the tile |
| 7 | + * label toggle, and importing it would pull the kiosk store and the PIN pad |
| 8 | + * onto a page that offers neither. |
| 9 | + */ |
| 10 | + |
| 11 | +import { useTranslation } from 'react-i18next'; |
| 12 | +import { Maximize, Minimize, Settings } from 'lucide-react'; |
| 13 | +import { EventMontageGridControls } from '../events/EventMontageGridControls'; |
| 14 | +import { Button } from '../ui/button'; |
| 15 | + |
| 16 | +interface LiveActivityHeaderProps { |
| 17 | + gridCols: number; |
| 18 | + customCols: string; |
| 19 | + isCustomGridDialogOpen: boolean; |
| 20 | + onApplyGridLayout: (cols: number) => void; |
| 21 | + onCustomColsChange: (value: string) => void; |
| 22 | + onCustomGridDialogOpenChange: (open: boolean) => void; |
| 23 | + onCustomGridSubmit: () => void; |
| 24 | + onEnterFullscreen: () => void; |
| 25 | + onOpenSettings: () => void; |
| 26 | +} |
| 27 | + |
| 28 | +export function LiveActivityHeader({ |
| 29 | + gridCols, |
| 30 | + customCols, |
| 31 | + isCustomGridDialogOpen, |
| 32 | + onApplyGridLayout, |
| 33 | + onCustomColsChange, |
| 34 | + onCustomGridDialogOpenChange, |
| 35 | + onCustomGridSubmit, |
| 36 | + onEnterFullscreen, |
| 37 | + onOpenSettings, |
| 38 | +}: LiveActivityHeaderProps) { |
| 39 | + const { t } = useTranslation(); |
| 40 | + |
| 41 | + return ( |
| 42 | + <div className="flex items-center justify-between gap-2 mb-3"> |
| 43 | + <h1 className="text-lg font-semibold min-w-0 truncate" title={t('live_activity.title')}> |
| 44 | + {t('live_activity.title')} |
| 45 | + </h1> |
| 46 | + <div className="flex items-center gap-1"> |
| 47 | + <EventMontageGridControls |
| 48 | + gridCols={gridCols} |
| 49 | + customCols={customCols} |
| 50 | + isCustomGridDialogOpen={isCustomGridDialogOpen} |
| 51 | + onApplyGridLayout={onApplyGridLayout} |
| 52 | + onCustomColsChange={onCustomColsChange} |
| 53 | + onCustomGridDialogOpenChange={onCustomGridDialogOpenChange} |
| 54 | + onCustomGridSubmit={onCustomGridSubmit} |
| 55 | + /> |
| 56 | + <Button |
| 57 | + variant="ghost" |
| 58 | + size="icon" |
| 59 | + onClick={onEnterFullscreen} |
| 60 | + title={t('live_activity.fullscreen')} |
| 61 | + aria-label={t('live_activity.fullscreen')} |
| 62 | + data-testid="live-activity-fullscreen-btn" |
| 63 | + > |
| 64 | + <Maximize className="h-4 w-4" /> |
| 65 | + </Button> |
| 66 | + <Button |
| 67 | + variant="ghost" |
| 68 | + size="icon" |
| 69 | + onClick={onOpenSettings} |
| 70 | + title={t('live_activity.settings_title')} |
| 71 | + aria-label={t('live_activity.settings_title')} |
| 72 | + data-testid="live-activity-settings-btn" |
| 73 | + > |
| 74 | + <Settings className="h-4 w-4" /> |
| 75 | + </Button> |
| 76 | + </div> |
| 77 | + </div> |
| 78 | + ); |
| 79 | +} |
| 80 | + |
| 81 | +export function LiveActivityFullscreenBar({ onExit }: { onExit: () => void }) { |
| 82 | + const { t } = useTranslation(); |
| 83 | + |
| 84 | + return ( |
| 85 | + <div className="flex items-center justify-between gap-2 h-9 px-3 pt-[var(--sai-top,env(safe-area-inset-top))] bg-black/50 backdrop-blur-sm shrink-0"> |
| 86 | + <span className="text-white/70 font-medium text-xs min-w-0 truncate"> |
| 87 | + {t('live_activity.title')} |
| 88 | + </span> |
| 89 | + <Button |
| 90 | + onClick={onExit} |
| 91 | + variant="ghost" |
| 92 | + size="icon" |
| 93 | + className="text-white/70 hover:text-white hover:bg-white/10 h-7 w-7" |
| 94 | + title={t('live_activity.exit_fullscreen')} |
| 95 | + aria-label={t('live_activity.exit_fullscreen')} |
| 96 | + data-testid="live-activity-exit-fullscreen-btn" |
| 97 | + > |
| 98 | + <Minimize className="h-4 w-4" /> |
| 99 | + </Button> |
| 100 | + </div> |
| 101 | + ); |
| 102 | +} |
0 commit comments