# Video request: project picker, re-render control, composition preview panel Interaction spec for three additions to the existing on-demand video flow: a project picker in the request dialog, a re-render control with four visual states, and a composition preview panel (live iframe + captions side by side) in the approval screen. Written so a frontend developer can implement directly from this document without further design clarification. ## Scope and where this lives All three pieces extend one existing file: `panel/src/components/dashboard/video-post-queue.tsx`. | Piece | Existing component it extends | New sub-component to add | |---|---|---| | Project picker | `RequestVideoDialog` (the "Request a video" dialog) | none — reuses `ProjectSelector` | | Re-render control | `VideoPostRow` (one card in the approval queue) | `RerenderControl` | | Composition preview panel | `VideoPostRow` | `CompositionPreviewPanel` | None of this replaces the existing rendered-MP4 preview and caption textareas already in `VideoPostRow` (lines 145-258 of the current file) — the composition preview panel is a new block shown above them, giving the CEO a fast, pre-render look at the live composition before the MP4 cuts exist or while iterating. This spec does not cover the backend contract (`project_id` on `VideoRequestBody`, the re-render action route, or the composition-HTML proxy route) — those are backend/frontend implementation details tracked on the sibling code task. Every prop name below is written as the request shape the frontend needs; the implementer wires it to whatever route lands. **Design bar dial read:** this is dense product UI (an approval queue inside the existing panel chrome), not a landing surface — variance 2, motion 2, density 7, per the UX/UI cell's default for dashboard work. No new color, radius, or shadow tokens; every value below is a token or class already used in `video-post-queue.tsx` or `release-proposal-card.tsx`. --- ## 1. Project picker (`RequestVideoDialog`) ### Component Reuse `ProjectSelector` from `panel/src/components/projects/project-selector.tsx` as-is — it already renders a `Select` grouped by cell (Backend / Frontend / UX/UI / Other) with a `FolderGit2` icon and a cell `Badge`, matching this dialog's existing shadcn/ui primitives (`Select`, `Label`, `Input`, `Textarea`, `Checkbox` are already imported in this file). `ProjectSelector` today has no way to restrict the list to video-enabled projects. Add one optional prop rather than a new component: ```tsx interface ProjectSelectorProps { // ...existing props unchanged... videoEngineOnly?: boolean; // when true, filter `projects` to video_engine_enabled === true before grouping } ``` `video_engine_enabled` is already a field on `Project` (`panel/src/types/index.ts:1026`) but is **not** on `ProjectSummary` (the shape `useProjects()` / `GET /projects` returns today, `panel/src/types/index.ts:1081-1090`) — the backend task must add `video_engine_enabled: boolean` to `ProjectSummary` for this filter to work client-side. `RequestVideoDialog` passes `videoEngineOnly`. ### Placement Insert the picker as the **first** field inside `RequestVideoDialog`'s `
` reading "No projects have the video engine enabled — turn it on in a project's settings first." — same copy pattern as the existing "No projects exist yet" hint under the MegaTask checklist in `intake-form.tsx:176-180`. | | Populated, unselected | Projects loaded, none chosen | Trigger shows the `placeholder` text, muted-foreground color (shadcn default `SelectValue` behavior — no override needed). | | Selected | A project is chosen | Trigger shows `FolderGit2` icon + project name + cell `Badge`, exactly as `ProjectSelector` already renders it (`project-selector.tsx:98-108`). | ### Validation `canSubmit` (`video-post-queue.tsx:330-333`) gains `projectId !== null` as a fourth condition alongside occasion/brief/platforms — the picker is required, matching every other field in this dialog. --- ## 2. Re-render control (`VideoPostRow`) ### Component New `RerenderControl` sub-component, colocated in `video-post-queue.tsx` next to `VideoPostRow` (mirrors how `RequestVideoDialog` already sits next to `VideoPostQueue` in the same file): ```tsx type RerenderState = "idle" | "loading" | "stale" | "error"; function RerenderControl({ state, onRerender, }: { state: RerenderState; onRerender: () => void; }) { /* ... */ } ``` `state` is derived, not stored redundantly: `stale` when the draft's captions or occasion have been edited locally since the last successful render (compare against the same `edited*`/local-state pattern `VideoPostRow` already uses for captions, `video-post-queue.tsx:98-101`); `loading` while the re-render mutation is in flight; `error` when that mutation's last attempt failed; `idle` otherwise (freshly rendered, nothing pending, no error). ### Placement Directly above the cut-switcher buttons (`video-post-queue.tsx:160-184`), right-aligned, same row as the cut buttons on `sm:` and up: ``` ┌ VideoPostRow ─────────────────────────────────────────────┐ │ [Film] Video [occasion badge] │ │ Title │ │ Script excerpt… │ │ │ │ [9:16] [1:1] [Re-render ⟳ idle] ← │ │ ┌ Composition Preview Panel ───────────────────────────┐ │ │ │ iframe │ captions │ │ │ └────────────────────┴───────────────────────────────────┘ │ │ …existing edit-caption blocks, Reject / Approve… │ └────────────────────────────────────────────────────────────┘ ``` ### Visual spec per state Same `Button` primitive already imported in this file, `size="sm"`, plus `lucide-react` icons already available in the codebase (`RefreshCw`, `AlertTriangle`, `CheckCircle2` — the last two already imported elsewhere in this file). | State | Button `variant` | Icon | Label | Disabled | Extra | |---|---|---|---|---|---| | `idle` | `outline` | `RefreshCw` (static, no spin) | "Re-render" | No | none | | `loading` | `outline` | `RefreshCw` with `className="animate-spin"` (exact pattern used for the navbar refresh button, `header.tsx:111`) | "Re-rendering…" | Yes | `aria-live="polite"` wrapper so screen readers announce the state change | | `stale` | `default` (filled — draws the eye, matches how `bg-amber-500/10` gaps banner in `release-proposal-card.tsx:181` is used to flag "needs attention") with an added `text-amber-950 bg-amber-500 hover:bg-amber-500/90` override | `RefreshCw` | "Re-render (edited)" | No | A small `Badge variant="outline"` reading "stale" is not needed — the button label already carries the meaning; do not duplicate it in a second element | | `error` | `destructive` | `AlertTriangle` | "Retry re-render" | No | `title` attribute carries the last error message (mirrors the disabled-cut-button `title` pattern at `video-post-queue.tsx:166-169`); a one-line `
` under the button shows the same message so it is not tooltip-only | State transitions: `idle`/`stale`/`error` → click → `loading` → mutation resolves → `idle` (success) or `error` (failure). Editing a caption or the occasion while in `idle` → `stale`. There is no user action that transitions directly out of `loading` except the mutation settling — the button stays `disabled` for the whole request, preventing double-submission (same re-entrancy concern already handled via `submittingRef` in `spawn-agent-dialog.tsx:40`). --- ## 3. Composition preview panel (`VideoPostRow`) ### Component New `CompositionPreviewPanel` sub-component: ```tsx function CompositionPreviewPanel({ previewUrl, cut, captions, }: { previewUrl: string; // the composition-HTML proxy route response, scoped to `cut` cut: VideoCut; // reuse the existing "vertical" | "square" type captions: { x?: string | null; tiktok?: string | null }; }) { /* ... */ } ``` It renders inside `VideoPostRow`, between the cut-switcher/re-render row and the existing MP4 `