| 1 | import { Eye, LayoutGrid, Palette, Pencil, ScrollText, Sparkles, WandSparkles } from 'lucide-react' |
| 2 | import { cn } from '@renderer/lib/utils' |
| 3 | import { useT } from '@renderer/i18n' |
| 4 | import type { SessionWorkspaceTab } from '@renderer/store' |
| 5 | import { MasterWorkbenchPanel } from '../workbench' |
| 6 | |
| 7 | export function WorkspaceTabs({ |
| 8 | activeTab, |
| 9 | disabled, |
| 10 | onActivate |
| 11 | }: { |
| 12 | activeTab: SessionWorkspaceTab |
| 13 | disabled: boolean |
| 14 | onActivate: (tab: SessionWorkspaceTab) => void |
| 15 | }): React.JSX.Element { |
| 16 | const t = useT() |
| 17 | const tabs: Array<{ id: SessionWorkspaceTab; label: string; icon?: React.JSX.Element }> = [ |
| 18 | { id: 'preview', label: t('sessionDetail.previewMode'), icon: <Eye className="h-3 w-3" /> }, |
| 19 | { id: 'edit', label: t('sessionDetail.editMode'), icon: <Pencil className="h-3 w-3" /> }, |
| 20 | { id: 'browse', label: t('sessionDetail.browseMode'), icon: <LayoutGrid className="h-3 w-3" /> }, |
| 21 | { id: 'style', label: t('sessionDetail.styleMode'), icon: <Palette className="h-3 w-3" /> }, |
| 22 | { id: 'animation', label: t('sessionDetail.animationTab'), icon: <WandSparkles className="h-3 w-3" /> }, |
| 23 | { id: 'speech', label: t('sessionDetail.speechScript'), icon: <ScrollText className="h-3 w-3" /> }, |
| 24 | { id: 'ai', label: t('sessionDetail.aiMode'), icon: <Sparkles className="h-3 w-3" /> } |
| 25 | ] |
| 26 | |
| 27 | return ( |
| 28 | <div |
| 29 | className={cn( |
| 30 | 'flex min-w-0 flex-1 justify-center', |
| 31 | disabled && 'pointer-events-none grayscale opacity-45' |
| 32 | )} |
| 33 | aria-disabled={disabled || undefined} |
| 34 | > |
| 35 | <div className="flex max-w-full items-center gap-1 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"> |
| 36 | <div className="flex shrink-0 items-center gap-0.5 rounded-full bg-[#d4e4c1]/30 p-0.5 shadow-[inset_0_1px_4px_rgba(62,74,50,0.08)]"> |
| 37 | {tabs.map((tab) => ( |
| 38 | <button |
| 39 | key={tab.id} |
| 40 | type="button" |
| 41 | className={cn( |
| 42 | 'inline-flex h-6 min-w-[68px] shrink-0 items-center justify-center gap-1 rounded-full px-2 text-[10px] font-bold leading-none transition-all', |
| 43 | activeTab === tab.id |
| 44 | ? 'bg-[#5d6b4d] text-white shadow-[0_4px_10px_rgba(62,74,50,0.16)]' |
| 45 | : 'text-[#4f5f40] hover:bg-[#fffaf1]/54 hover:text-[#314028]' |
| 46 | )} |
| 47 | onClick={() => onActivate(tab.id)} |
| 48 | disabled={disabled} |
| 49 | > |
| 50 | {tab.icon} |
| 51 | {tab.label} |
| 52 | </button> |
| 53 | ))} |
| 54 | </div> |
| 55 | <MasterWorkbenchPanel /> |
| 56 | </div> |
| 57 | </div> |
| 58 | ) |
| 59 | } |
| 60 |