'use client'; import { ChevronLeft, ChevronRight } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'; import { useI18n } from '@/lib/hooks/use-i18n'; import { cn } from '@/lib/utils/cn'; export interface CanvasPagerProps { readonly index: number; readonly count: number; readonly canPrev: boolean; readonly canNext: boolean; readonly onPrev: () => void; readonly onNext: () => void; } /** * Where the pager is mounted. * * `dock` is the normal form: paging is a global control of the whole deck, so it * lives in the edit dock's global edit bar alongside the other course-level * entries rather than floating over the page it is about to leave. * * `floating` is the fallback for scene types that get no dock at all (no * narration timeline ⇒ no bench to hang tools off — see * `components/edit/scene-timeline.ts`). Without it those scenes would lose * paging entirely. */ export type CanvasPagerVariant = 'dock' | 'floating'; /** Scene navigation — in the dock's global edit bar, or floating when there is no dock. */ export function CanvasPager({ index, count, canPrev, canNext, onPrev, onNext, variant = 'floating', }: CanvasPagerProps & { readonly variant?: CanvasPagerVariant }) { const { t } = useI18n(); if (count <= 0) return null; const controls = ( <> {index + 1} / {count} ); // In the dock the strip supplies the surface (border, blur, height), so the // pager is flat controls — a second pill inside the bench would read as a // floating thing that happens to be parked there. if (variant === 'dock') { return (
{controls}
); } return (
{controls}
); } function PagerButton({ label, children, tone, ...props }: React.ComponentProps & { readonly label: string; /** Named `tone` rather than `variant` so it cannot collide with Button's own. */ readonly tone: CanvasPagerVariant; }) { return ( {label} ); }