๐ฌ ็ซๅฎ็ญๅง - ๅบไบAI็ไธ็ซๅผ็ญๅง็ๆๅนณๅฐ ใไธๅฅ่ฏ็ๆๅฎๆด็ญๅง๏ผไปๅงๆฌๅฐๆ็ๅ จ่ชๅจๅใ Huobao Drama - An AI-Powered End-to-End Short Drama Generator "One Sentence to Complete Drama: Fully Automated from Script to Final Video"
TypeScript
docs: frontend overhaul design spec
Connor46e5b4d4c0db
diff --git a/docs/superpowers/specs/2026-03-25-frontend-overhaul-design.md b/docs/superpowers/specs/2026-03-25-frontend-overhaul-design.mdnew file mode 100644index 0000000..c2ac833--- /dev/null+++ b/docs/superpowers/specs/2026-03-25-frontend-overhaul-design.md@@ -0,0 +1,471 @@+# Frontend Overhaul Design++Date: 2026-03-25++## Overview++Comprehensive frontend restructuring of Huobao Drama covering three dimensions: UI/design system replacement, architecture reorganization, and feature redesign. The core change is replacing Element Plus with Shadcn Vue, restructuring routes and directories by domain, and replacing the linear 3-step EpisodeWorkflow + ProfessionalEditor with a unified progressive panel-based workbench.++## 1. UI System: Element Plus โ Shadcn Vue++### What Gets Removed++- `element-plus` package and all `el-*` components+- `@element-plus/icons-vue` โ replaced by `lucide-vue-next`+- `web/src/assets/styles/element/index.scss` (Element Plus overrides)+- All Element Plus CSS imports in `main.ts`++### What Gets Added++- `shadcn-vue` CLI-generated components in `web/src/components/ui/`+- `radix-vue` (Shadcn Vue's underlying headless library)+- `lucide-vue-next` for icons (tree-shakable)+- `class-variance-authority` + `clsx` + `tailwind-merge` (Shadcn Vue dependencies)++### Component Migration Map++| Element Plus | Shadcn Vue | Notes |+|---|---|---|+| el-button | Button | Glass variants via CVA |+| el-input | Input | |+| el-select | Select | Radix-based, fully accessible |+| el-dialog | Dialog | |+| el-drawer | Sheet | Used for Agent panel |+| el-tabs | Tabs | |+| el-form / el-form-item | Form (react-hook-form style) | With FormField, FormItem |+| el-table | Table | |+| el-tag | Badge | |+| el-alert | Alert | |+| el-empty | Custom EmptyState | Keep existing component |+| el-loading | Skeleton | |+| el-image | Native img + custom | |+| el-upload | Custom upload | |+| el-tooltip | Tooltip | |+| el-popover | Popover | |+| el-dropdown | DropdownMenu | |+| el-switch | Switch | |+| el-checkbox | Checkbox | |+| el-radio | RadioGroup | |+| el-progress | Progress | |+| el-icon | Lucide icons directly | `<Film />` instead of `<el-icon><Film /></el-icon>` |++### Theme Integration Strategy++Shadcn Vue uses CSS variables (`--primary`, `--secondary`, `--accent`, etc.) defined in `:root` and `.dark`. Map Glass Design System tokens to Shadcn variables:++```css+:root {+ --primary: var(--accent); /* Glass accent color */+ --primary-foreground: var(--glass-text-on-accent);+ --background: var(--bg-primary);+ --foreground: var(--text-primary);+ --card: var(--bg-card);+ --card-foreground: var(--text-primary);+ --border: var(--border-primary);+ --ring: var(--border-focus);+ --muted: var(--bg-secondary);+ --muted-foreground: var(--text-muted);+ /* ... remaining mappings */+}+```++Glass semantic classes (`.glass-surface`, `.glass-btn-*`, `.glass-list-row`, etc.) remain as project-specific composition utilities on top of Shadcn primitives. The Glass component files (`components/glass/`) are kept but refactored to use Shadcn primitives internally.++### Dark Mode++Continues using Tailwind `darkMode: 'class'` strategy. The amber warm-night theme (็ฅ็ๆๅค) is preserved through the existing `.dark` CSS variable overrides in `glass-tokens.css`. Shadcn Vue's dark mode maps to the same `.dark` class.++## 2. Route Architecture: Nested Routes++### Current State (14 flat routes)++All routes are top-level. Drama-related routes (7) and Episode-related routes (4) have no nesting. URL patterns are inconsistent (`/dramas/:id` vs `/episodes/:id`).++### New Route Structure++```+/ โ DramaList (home)+/library โ CharacterLibrary+/assets โ Assets+/settings โ AIConfig++/drama/new โ DramaCreate+/drama/:id โ DramaLayout (left sidebar nav)+ โ (index) โ Overview+ โ episodes โ EpisodeList+ โ characters โ Characters+ โ scenes โ Scenes+ โ props โ Props+ โ settings โ DramaSettings++/drama/:id/episode/:num/workbench โ EpisodeWorkbench (fullscreen)+/drama/:id/episode/:num/compose โ CompositionWorkbench (fullscreen)+```++### Key Changes++- Drama management uses nested child routes under `/drama/:id` with a shared `DramaLayout`+- `DramaLayout` provides left sidebar navigation + shared drama data loading+- Episode workbench replaces both `EpisodeWorkflow` and `ProfessionalEditor`+- Script editing is absorbed into the workbench (no separate `/episodes/:id/edit` route)+- Storyboard editing is absorbed into the workbench (no separate `/episodes/:id/storyboard` route)+- Image generation is absorbed into the workbench (no separate `/episodes/:id/generate` route)+- Timeline editor route removed (functionality in composition workbench)++### Routes Removed++- `/dramas/:id` โ replaced by `/drama/:id` (nested)+- `/dramas/:id/characters` โ absorbed into `/drama/:id/characters`+- `/dramas/:id/images/characters` โ absorbed into `/drama/:id/characters`+- `/dramas/:id/settings` โ absorbed into `/drama/:id/settings`+- `/dramas/:id/episode/:num` (old EpisodeWorkflow) โ replaced by `/drama/:id/episode/:num/workbench`+- `/dramas/:dramaId/episode/:num/professional` โ merged into workbench+- `/episodes/:id/edit` โ absorbed into workbench+- `/episodes/:id/storyboard` โ absorbed into workbench+- `/episodes/:id/generate` โ absorbed into workbench+- `/timeline/:id` โ absorbed into composition workbench++## 3. Directory Structure++### New Layout++```+web/src/+โโโ components/+โ โโโ ui/ โ Shadcn Vue components (CLI-generated)+โ โ โโโ button/+โ โ โโโ input/+โ โ โโโ dialog/+โ โ โโโ sheet/ โ Used for Agent drawer+โ โ โโโ tabs/+โ โ โโโ ...+โ โ โโโ index.ts+โ โโโ glass/ โ Kept, refactored to use Shadcn internals+โ โ โโโ GlassCard.vue+โ โ โโโ GlassButton.vue โ Wraps Shadcn Button with Glass variants+โ โ โโโ ...+โ โโโ common/ โ Shared business components+โ โ โโโ AppHeader.vue+โ โ โโโ ImageCropDialog.vue+โ โ โโโ EmptyState.vue+โ โ โโโ ErrorBoundary.vue+โ โ โโโ ...+โ โโโ layout/+โ โ โโโ AppLayout.vue+โ โ โโโ AppSidebar.vue+โ โ โโโ SidebarItem.vue+โ โโโ agent/ โ NEW: Agent interaction components+โ โ โโโ AgentDrawer.vue โ Sheet-based slide-out panel+โ โ โโโ AgentChat.vue โ SSE streaming chat UI+โ โ โโโ AgentTypeSwitcher.vue โ Agent type selector+โ โ โโโ AgentResultAction.vue โ "Apply" button for agent results+โ โโโ editor/+โ โโโ GridImageEditor.vue+โ โโโ VideoTimelineEditor.vue+โโโ views/+โ โโโ drama/+โ โ โโโ DramaList.vue+โ โ โโโ DramaCreate.vue+โ โ โโโ DramaLayout.vue โ NEW: left sidebar navigation layout+โ โ โโโ management/+โ โ โ โโโ OverviewTab.vue+โ โ โ โโโ EpisodesTab.vue+โ โ โ โโโ CharactersTab.vue+โ โ โ โโโ ScenesTab.vue+โ โ โ โโโ PropsTab.vue+โ โ โโโ episode/+โ โ โ โโโ EpisodeWorkbench.vue โ NEW: unified progressive workbench+โ โ โ โโโ workbench/+โ โ โ โโโ ResourcePanel.vue โ Left 20%: script + characters + scenes+โ โ โ โโโ ScriptBlock.vue โ Script section in resource panel+โ โ โ โโโ CharacterBlock.vue โ Character list in resource panel+โ โ โ โโโ SceneBlock.vue โ Scene list in resource panel+โ โ โ โโโ StoryboardGrid.vue โ Right 80%: grid mode+โ โ โ โโโ StoryboardCard.vue โ Individual storyboard card+โ โ โ โโโ StoryboardEditor.vue โ Right 80%: edit mode (strip + preview + properties)+โ โ โ โโโ StoryboardStrip.vue โ Vertical thumbnail strip in edit mode+โ โ โ โโโ PreviewPane.vue โ Image/video preview in edit mode+โ โ โ โโโ PropertiesPanel.vue โ Properties + generation actions in edit mode+โ โ โโโ composition/+โ โ โโโ CompositionWorkbench.vue+โ โโโ library/+โ โ โโโ CharacterLibrary.vue+โ โโโ assets/+โ โ โโโ Assets.vue+โ โโโ settings/+โ โโโ AIConfig.vue+โ โโโ components/+โ โโโ ProviderCard.vue+โโโ composables/+โ โโโ useEpisodeWorkbench.ts โ NEW: workbench state orchestration+โ โโโ useResourcePanel.ts โ NEW: resource panel (script + characters + scenes)+โ โโโ useStoryboardGrid.ts โ NEW: grid/edit mode switching+โ โโโ useProfessionalEditor.ts โ Kept, refactored for workbench+โ โโโ useFrameImageGeneration.ts โ Kept+โ โโโ useVideoGenerationPro.ts โ Kept+โ โโโ useAgentChat.ts โ NEW: SSE agent communication+โ โโโ usePolling.ts โ Kept+โ โโโ useBatchSelection.ts โ Kept+โ โโโ useFilteredList.ts โ Kept+โ โโโ useVideoMerge.ts โ Kept+โโโ stores/ โ Kept as-is+โโโ api/ โ Kept, add agent API+โ โโโ agent.ts โ NEW: agent SSE endpoints+โ โโโ ... (existing)+โโโ types/ โ Kept, add agent types+โ โโโ agent.ts โ NEW: agent types+โ โโโ ... (existing)+โโโ utils/ โ Kept+```++### Files Deleted++- `views/drama/EpisodeWorkflow.vue` (2499 lines) โ replaced by EpisodeWorkbench+- `views/drama/ProfessionalEditor.vue` โ merged into EpisodeWorkbench+- `views/drama/DramaManagement.vue` (1502 lines) โ replaced by DramaLayout + management/ children+- `views/drama/workflow/ScriptStep.vue` โ absorbed into workbench/ScriptBlock.vue+- `views/drama/workflow/ImageStep.vue` โ absorbed into workbench grid operations+- `views/drama/workflow/VideoStep.vue` โ absorbed into workbench grid operations+- `views/workflow/CharacterExtraction.vue` โ absorbed into workbench+- `views/workflow/CharacterImages.vue` โ absorbed into workbench+- `views/workflow/DramaSettings.vue` โ moved to management/+- `views/script/ScriptEdit.vue` โ absorbed into workbench+- `views/storyboard/StoryboardEdit.vue` โ absorbed into workbench+- `views/generation/ImageGeneration.vue` โ absorbed into workbench+- `views/generation/VideoGeneration.vue` โ absorbed into workbench+- `views/editor/TimelineEditor.vue` โ absorbed into composition+- `views/generation/components/` (4 dialog files) โ refactored into workbench+- `assets/styles/element/index.scss` โ removed with Element Plus++## 4. EpisodeWorkbench: Progressive Panel-Based Workbench++### Layout++```+โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ+โ TopBar: โ Back | Title | Progress | ๐ค Agent | ๅๆโโ+โโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค+โ Resource โ Storyboard Area (~80%) โ+โ Panel โ โ+โ (~20%) โ Grid Mode: 5-col card grid โ+โ โ Edit Mode: strip + preview + properties โ+โ โโโโโโโโโโ โ โ+โ โ Script โ โ โ+โ โ(small) โ โ โ+โ โโโโโโโโโโค โ โ+โ โ Chars โ โ โ+โ โ (list) โ โ โ+โ โโโโโโโโโโค โ โ+โ โ Scenes โ โ โ+โ โ (list) โ โ โ+โ โโโโโโโโโโ โ โ+โโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ+```++### Progressive Fill Stages++**Stage 1 โ Script Only (entry point)**+- Left: Script block expanded (editable textarea), characters and scenes are grayed-out placeholders+- Right: Empty state with guidance text+- Actions: Upload script, Agent rewrite, "Extract Characters & Scenes" button++**Stage 2 โ Characters & Scenes Extracted**+- Left: Script block collapses to summary. Character list and scene list appear with content+- Right: Empty state with "Agent Storyboard Breakdown" button+- Actions: Generate character images, generate scene images, batch operations++**Stage 3 โ Storyboards Created (full workbench)**+- Left: All three resource blocks populated and compact+- Right: Storyboard grid fills the area (5 columns)+- Each card shows: thumbnail/status, title, shot type, generation state+- Card border color indicates status: gray (text only), blue (generating), amber (has image), green (has image + video)+- Actions: Batch generate images, batch generate videos, add storyboard++**Stage 3b โ Single Storyboard Edit Mode**+- Triggered by clicking a storyboard card+- Right area switches from grid to: vertical thumbnail strip + center preview + right properties panel+- Properties panel: scene, characters, props, shot parameters, prompts, generate buttons+- "Back to grid" button to return to grid mode++### Resource Panel Blocks++Each block in the left resource panel has two states:+- **Collapsed**: Single line showing icon, name, count/status+- **Expanded**: Shows full content (script text, character list with avatars, scene list with thumbnails)++Clicking a block toggles between collapsed and expanded. When a block has no content yet, it appears grayed-out/disabled.++### Agent Drawer++- Triggered by "๐ค Agent" button in top bar+- Slides in from the right as a Shadcn Sheet (~400px wide)+- Overlays the storyboard area (does not push layout)+- Components:+ - **Top**: Agent type switcher (dropdown or segmented control)+ - **Middle**: SSE streaming chat messages+ - **Bottom**: Input field + send button+- Agent types: script_rewriter, style_analyzer, extractor, voice_assigner, storyboard_breaker, prompt_generator+- Context injection: automatically includes current storyboard, scene, characters in agent request+- Result actions: "Apply" button on agent responses maps results to workbench fields:+ - prompt_generator โ fills image_prompt / video_prompt fields+ - storyboard_breaker โ creates storyboard list+ - script_rewriter โ updates script content+ - style_analyzer โ fills style description+ - extractor โ populates characters and scenes++## 5. DramaLayout: Left Sidebar Navigation++### Layout++```+โโโโโโโโโโโโฌโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโ+โ App โ Drama โ โ+โ Sidebar โ Secondary โ Content Area โ+โ (global) โ Nav โ (router-view) โ+โ โ โ โ+โ Projects โ Overview โ โ+โ Library โ Episodes โ โ+โ Assets โ Characters โ โ+โ Settings โ Scenes โ โ+โ โ Props โ โ+โ โ Settings โ โ+โโโโโโโโโโโโดโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโ+```++### DramaLayout Component++- Wraps all `/drama/:id/*` child routes+- Loads drama data on mount, provides via `provide/inject` or Pinia store+- Left sidebar shows:+ - Drama title and genre+ - Navigation items with counts: Overview, Episodes (N), Characters (N), Scenes (N), Props (N), Settings+ - Active item highlighted+- Each nav item corresponds to a nested child route+- Content area renders `<router-view />`++### Data Sharing++DramaLayout loads the drama and its related data (characters, scenes, props, episodes) once. Child components access this data through the drama Pinia store, avoiding redundant API calls. This replaces the current pattern where DramaManagement loads everything and passes via props/events.++## 6. New Composables++### useEpisodeWorkbench++Orchestrates the entire workbench state:+- Current pipeline stage (script โ extracted โ storyboards)+- View mode (grid vs edit)+- Selected storyboard ID+- Delegates to sub-composables: useResourcePanel, useStoryboardGrid, useProfessionalEditor++### useResourcePanel++Manages the left resource panel:+- Script content and editing state+- Characters list with generation status+- Scenes list with generation status+- Block expand/collapse state+- Extract characters & scenes action (calls agent or direct API)++### useStoryboardGrid++Manages the right storyboard area:+- Grid/edit mode toggle+- Storyboard list with status computation+- Batch selection for bulk operations+- Batch generate images/videos actions+- Progress tracking (how many have images, how many have videos)++### useAgentChat++Manages Agent drawer communication:+- SSE connection to `/api/v1/agent/:type/chat`+- Message history per agent type+- Streaming state+- Context building (current storyboard, scene, characters)+- Result parsing and apply actions++## 7. New API Module++### api/agent.ts++```typescript+export const agentAPI = {+ // SSE streaming chat โ returns EventSource or fetch with ReadableStream+ streamChat(agentType: string, data: AgentChatRequest): EventSource++ // Agent config CRUD+ listConfigs(): Promise<AgentConfig[]>+ getConfig(id: number): Promise<AgentConfig>+ updateConfig(id: number, data: Partial<AgentConfig>): Promise<AgentConfig>+}+```++### types/agent.ts++```typescript+interface AgentChatRequest {+ message: string+ drama_id?: number+ episode_id?: number+ context?: Record<string, unknown>+}++interface AgentSSEEvent {+ type: 'tool_call' | 'tool_result' | 'content' | 'done' | 'error'+ data: string+ tool_name?: string+}++interface AgentConfig {+ id: number+ agent_type: string+ name: string+ description: string+ model: string+ temperature: number+ max_tokens: number+ max_iterations: number+ is_active: boolean+}+```++## 8. Migration Strategy++### Phase 1: Foundation+1. Initialize Shadcn Vue CLI, generate base components into `components/ui/`+2. Install `lucide-vue-next`+3. Map Glass tokens to Shadcn CSS variables+4. Create `components/agent/` shell components++### Phase 2: Route Restructuring+5. Create `DramaLayout.vue` with left sidebar navigation+6. Refactor routes to nested structure+7. Move management tab components under `views/drama/management/`+8. Remove `DramaManagement.vue`++### Phase 3: Workbench+9. Create `EpisodeWorkbench.vue` and workbench sub-components+10. Build ResourcePanel (ScriptBlock, CharacterBlock, SceneBlock)+11. Build StoryboardGrid and StoryboardCard+12. Build StoryboardEditor (edit mode: strip + preview + properties)+13. Create new composables (useEpisodeWorkbench, useResourcePanel, useStoryboardGrid)+14. Remove `EpisodeWorkflow.vue` and `ProfessionalEditor.vue`++### Phase 4: Agent Integration+15. Build AgentDrawer, AgentChat, AgentTypeSwitcher+16. Create useAgentChat composable+17. Create api/agent.ts and types/agent.ts+18. Wire agent results to workbench actions++### Phase 5: Component Migration+19. Migrate components from Element Plus to Shadcn Vue (view by view)+20. Replace `@element-plus/icons-vue` with Lucide icons+21. Remove Element Plus package and all imports+22. Remove `assets/styles/element/index.scss`++### Phase 6: Cleanup+23. Remove deleted view files and unused composables+24. Remove empty directories (views/workflow/, views/script/, views/storyboard/, views/generation/, views/editor/)+25. Update i18n keys for renamed/removed components+26. Run `pnpm build:check` to verify no TypeScript errors+27. Run `pnpm lint:fix` to clean up