'use client'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { useI18n } from '@/lib/hooks/use-i18n'; import { ColorPicker } from './ColorPicker'; import { ImagePicker } from './ImagePicker'; import { updateSlideBackground, useResolvedSlideContent } from './use-slide-surface'; /** * Slide-background picker — solid color / image tabs. Slide-level, so it * dispatches `slide.update {background}` rather than an element op. Seeded from * the current background; defaults to the Solid tab (white) when none is set. */ export function BackgroundControl() { const { t } = useI18n(); const bg = useResolvedSlideContent().canvas.background; const color = bg?.type === 'solid' && bg.color ? bg.color : '#ffffff'; return ( {t('edit.background.solid')} {t('edit.background.image')} updateSlideBackground({ type: 'solid', color: c })} onCommit={(c) => updateSlideBackground({ type: 'solid', color: c })} /> updateSlideBackground({ type: 'image', image: { src, size: 'cover' } })} /> ); }