Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

Shots board: effect chips on each card and an Effects count card (#11603)

[._.]/341a7cf3eeea
diff --git a/client/src/components/musicVideo/ShotEffectsCard.jsx b/client/src/components/musicVideo/ShotEffectsCard.jsx
new file mode 100644
index 0000000000..649ccc18bc
--- /dev/null
+++ b/client/src/components/musicVideo/ShotEffectsCard.jsx
@@ -0,0 +1,78 @@
+import { Zap } from 'lucide-react';
+import { SHOT_EFFECT_SLOTS, SHOT_EFFECT_SLOT_LABELS, shotEffectLabel } from '../../lib/musicVideoShotEffects.js';
+import { formatCount } from '../../utils/formatters.js';
+
+const POSITIONS = { start: 'left-1', mid: 'left-1/2 -translate-x-1/2', end: 'right-1' };
+
+/**
+ * Bottom chips on a Board thumbnail: the shot's start effect at the left, its
+ * mid-shot effects in the center and its end effect at the right. A slot with
+ * more than one shows the first and how many more.
+ */
+export function SceneEffectBadges({ sceneId, effects }) {
+ const filled = SHOT_EFFECT_SLOTS.filter((slot) => effects[slot].length);
+ if (!filled.length) return null;
+ return (
+ <span id={`scene-effects-${sceneId}`}>
+ {filled.map((slot) => {
+ const [first, ...rest] = effects[slot];
+ const names = effects[slot].map(shotEffectLabel).join(', ');
+ return (
+ <span key={slot} title={`${SHOT_EFFECT_SLOT_LABELS[slot]}: ${names}`}
+ className={`port-media-overlay-strong absolute bottom-1 ${POSITIONS[slot]} inline-flex max-w-[32%] items-center gap-0.5 rounded px-1 py-0.5 text-[10px] font-medium leading-none`}>
+ <Zap size={10} aria-hidden="true" className="shrink-0" />
+ <span className="truncate" aria-hidden="true">{shotEffectLabel(first)}</span>
+ {rest.length > 0 && <span className="shrink-0" aria-hidden="true">+{rest.length}</span>}
+ <span className="sr-only">{SHOT_EFFECT_SLOT_LABELS[slot]}: {names}.</span>
+ </span>
+ );
+ })}
+ </span>
+ );
+}
+
+/**
+ * The Shots page's effect totals: every effect option with how often the
+ * video plays it at a shot's start, mid-shot and end, unused ones included,
+ * most used first. Tapping an option shows only the shots that play it
+ * (`onSelect(id)`, again to clear).
+ */
+export default function ShotEffectsCard({ counts, selected = null, onSelect }) {
+ const rows = [...counts].sort((a, b) => b.total - a.total);
+ const used = rows.filter((row) => row.total > 0);
+ const top = used.slice(0, 3).map((row) => `${row.label} ${formatCount(row.total)}`).join(' · ');
+ return (
+ <details className="rounded-lg border border-port-border bg-port-card" open={!!selected || undefined}>
+ <summary className="flex min-h-[44px] cursor-pointer flex-wrap items-center gap-x-2 px-3 py-2 text-sm sm:min-h-0">
+ <span className="font-medium">Effects</span>
+ <span className="min-w-0 truncate text-xs text-port-text-muted">{used.length ? top : 'None set yet'}</span>
+ </summary>
+ <table className="w-full table-fixed border-t border-port-border text-xs" aria-label="Effect counts">
+ <thead>
+ <tr className="text-port-text-muted">
+ <th scope="col" className="w-2/5 px-3 py-1 text-left font-normal">Effect</th>
+ {SHOT_EFFECT_SLOTS.map((slot) => <th key={slot} scope="col" className="px-1 py-1 text-right font-normal">{SHOT_EFFECT_SLOT_LABELS[slot]}</th>)}
+ <th scope="col" className="px-3 py-1 text-right font-normal">Shots</th>
+ </tr>
+ </thead>
+ <tbody>
+ {rows.map((row) => (
+ <tr key={row.id} className={`${row.id === selected ? 'bg-port-accent/10' : ''} ${row.total ? '' : 'text-port-text-muted'}`}>
+ <th scope="row" className="px-1 py-0 text-left font-normal">
+ <button type="button" onClick={() => onSelect?.(row.id === selected ? null : row.id)} disabled={!row.total}
+ aria-pressed={row.id === selected} aria-label={row.total ? `Show shots with ${row.label}` : `${row.label}: not used`}
+ className="min-h-[44px] w-full truncate rounded px-2 text-left hover:bg-port-border/40 disabled:hover:bg-transparent sm:min-h-[28px]">
+ {row.label}
+ </button>
+ </th>
+ {SHOT_EFFECT_SLOTS.map((slot) => (
+ <td key={slot} className="px-1 text-right tabular-nums">{row.slots.includes(slot) ? formatCount(row[slot], { fallback: '0' }) : '—'}</td>
+ ))}
+ <td className="px-3 text-right font-medium tabular-nums">{formatCount(row.shots, { fallback: '0' })}</td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ </details>
+ );
+}
diff --git a/client/src/components/musicVideo/stages/BoardStage.jsx b/client/src/components/musicVideo/stages/BoardStage.jsx
index dd80abcb12..61cd42aff8 100644
--- a/client/src/components/musicVideo/stages/BoardStage.jsx
+++ b/client/src/components/musicVideo/stages/BoardStage.jsx
@@ -1,15 +1,18 @@
import { useContext, useEffect, useLayoutEffect, useRef } from 'react';
import { useNavigate, useSearchParams } from 'react-router';
-import { Plus, Image as ImageIcon, Film, Code2, Type, FlagTriangleRight, Lock, LockOpen } from 'lucide-react';
+import { Plus, Image as ImageIcon, Film, Code2, Type, FlagTriangleRight, Lock, LockOpen, X } from 'lucide-react';
import ContactSheetButton from '../ContactSheetButton.jsx';
import SceneCard from '../SceneCard.jsx';
import EndingCard, { EndingThumbnail } from '../EndingCard.jsx';
import ScenePoster from '../ScenePoster.jsx';
+import ShotEffectsCard, { SceneEffectBadges } from '../ShotEffectsCard.jsx';
import { ShotLockContext, SHOT_LOCK_LABELS, overallShotLock } from '../ShotLock.jsx';
import { shotNumbers } from '../ShotStepper.jsx';
import { previousShot, shotHandoffSource } from '../../../../../server/lib/musicVideoHandoffFrame.js';
import { isLayeredComposition } from '../../../lib/musicVideoLayers.js';
import { musicVideoAspect } from '../../../lib/musicVideoAspect.js';
+import { plannedTransitions } from '../../../lib/musicVideoCutEffects.js';
+import { SHOT_EFFECT_OPTIONS, shotEffectCounts, shotEffectLabel, shotEffects, shotUsesEffect } from '../../../lib/musicVideoShotEffects.js';
import { FOOTAGE_OPTIONAL_MODES } from '../../../lib/musicVideoStages.js';
import { parseSceneFilter, sceneAttention, sceneMatchesFilter, sceneMediaKind, SCENE_ATTENTION_LABELS, SCENE_MEDIA_LABELS } from '../../../lib/musicVideoSceneAttention.js';
import { formatTimecode } from '../../../utils/formatters.js';
@@ -99,8 +102,18 @@ export default function BoardStage({ board }) {
if (sceneMatchesFilter(codes, 'attention')) counts.attention += 1;
if (sceneMatchesFilter(codes, 'missing')) counts.missing += 1;
}
+ // Each shot's start, mid-shot and end effects, and the option the board is narrowed to (`?effect=`).
+ const planned = plannedTransitions(project.productionReview?.draft?.storyboard);
+ const effectsById = new Map(scenes.map((scene) => [scene.sceneId, shotEffects(scene, { layered, planned })]));
+ const effectFilter = SHOT_EFFECT_OPTIONS.some((option) => option.id === searchParams.get('effect')) ? searchParams.get('effect') : null;
+ const setEffectFilter = (next) => setSearchParams((prev) => {
+ const params = new URLSearchParams(prev);
+ if (next) params.set('effect', next); else params.delete('effect');
+ return params;
+ }, { replace: true });
// The open scene stays listed while it is edited, even once fixing it drops it from the filter.
- const visible = scenes.filter((scene) => scene.sceneId === activeSceneId || sceneMatchesFilter(codesById.get(scene.sceneId), filter));
+ const visible = scenes.filter((scene) => scene.sceneId === activeSceneId || (sceneMatchesFilter(codesById.get(scene.sceneId), filter)
+ && (!effectFilter || shotUsesEffect(effectsById.get(scene.sceneId), effectFilter))));
const visibleIds = visible.map((scene) => scene.sceneId).join('\n');
const thumbnailsRef = useRef(new Map());
const inspectorRef = useRef(null);
@@ -175,9 +188,18 @@ export default function BoardStage({ board }) {
{label} ({counts[id]})
</button>
))}
+ {effectFilter && (
+ <button type="button" onClick={() => setEffectFilter(null)} aria-label={`Stop showing only shots with ${shotEffectLabel(effectFilter)}`}
+ className="flex min-h-[44px] items-center gap-1 rounded border border-port-accent bg-port-accent/10 px-2 py-1 text-port-accent sm:min-h-0">
+ {shotEffectLabel(effectFilter)} <X size={12} aria-hidden="true" />
+ </button>
+ )}
<span className="hidden text-port-text-muted sm:inline">j / k to move between scenes</span>
</div>
)}
+ {scenes.length > 0 && (
+ <ShotEffectsCard counts={shotEffectCounts([...effectsById.values()])} selected={effectFilter} onSelect={setEffectFilter} />
+ )}
{scenes.length > 0 && visible.length === 0 && (
<p className="text-sm text-port-text-muted">No scenes match this filter.</p>
)}
@@ -188,12 +210,14 @@ export default function BoardStage({ board }) {
onClick={() => { board.seekToScene?.(scene); onToggleSceneExpand?.(scene.sceneId, true); }}
aria-label={`Open ${shotName(scene)}`}
aria-describedby={[LOCK_BADGED.includes(shotLocks[scene.sceneId]) && `scene-lock-${scene.sceneId}`,
- (sceneMediaKind(scene, { layered }) || scene.endImageId) && `scene-media-${scene.sceneId}`].filter(Boolean).join(' ') || undefined}
+ (sceneMediaKind(scene, { layered }) || scene.endImageId) && `scene-media-${scene.sceneId}`,
+ Object.values(effectsById.get(scene.sceneId)).some((list) => list.length) && `scene-effects-${scene.sceneId}`].filter(Boolean).join(' ') || undefined}
className={`min-w-0 rounded border p-2 text-left ${activeSceneId === scene.sceneId ? 'border-port-accent bg-port-accent/10' : 'border-port-border bg-port-card'}`}>
<span className="relative block">
<ScenePoster scene={scene} className="aspect-video w-full rounded" />
<SceneLockBadge sceneId={scene.sceneId} state={shotLocks[scene.sceneId]} />
<SceneMediaBadges scene={scene} layered={layered} />
+ <SceneEffectBadges sceneId={scene.sceneId} effects={effectsById.get(scene.sceneId)} />
</span>
<span className="mt-1 block truncate text-sm">{shotName(scene)}</span>
{/* Run time first, then where it sits in the song. */}
diff --git a/client/src/components/musicVideo/stages/BoardStage.test.jsx b/client/src/components/musicVideo/stages/BoardStage.test.jsx
index 45a9b792fe..eee0c0a083 100644
--- a/client/src/components/musicVideo/stages/BoardStage.test.jsx
+++ b/client/src/components/musicVideo/stages/BoardStage.test.jsx
@@ -84,6 +84,30 @@ describe('BoardStage thumbnail media badges', () => {
});
});
+describe('BoardStage effects', () => {
+ // Uniquely catches a badge in the wrong slot, a count that misses a slot, or the effect filter not narrowing the board.
+ it('badges each shot\'s start, mid-shot and end effects, counts every option, and shows only the shots using one', () => {
+ const scenes = [
+ scene(1, { transitionIn: 'vhs-glitch', glitches: [{ atSec: 1, style: 'film-burn' }, { atSec: 2, style: 'vhs-glitch' }], cutEffect: { style: 'dissolve' } }),
+ scene(2, { transitionOut: 'vhs-glitch' }),
+ scene(3),
+ ];
+ renderBoard(board(scenes));
+ expect(screen.getByRole('button', { name: 'Open Shot 1 · Part 1' }).getAttribute('aria-describedby')).toContain('scene-effects-s1');
+ expect(document.getElementById('scene-effects-s1').textContent).toBe('VHS glitchStart: VHS glitch.Film burn+1Mid-shot: Film burn, VHS glitch.DissolveEnd: Dissolve.');
+ expect(document.getElementById('scene-effects-s3')).toBeNull();
+ const row = (name) => [...screen.getByRole('button', { name }).closest('tr').querySelectorAll('td')].map((td) => td.textContent);
+ expect(row('Show shots with VHS glitch')).toEqual(['1', '1', '1', '2']);
+ expect(row('Show shots with Dissolve')).toEqual(['—', '—', '1', '1']);
+ expect(screen.getByRole('button', { name: 'Shutter: not used' }).disabled).toBe(true);
+ fireEvent.click(screen.getByRole('button', { name: 'Show shots with Film burn' }));
+ expect(screen.getByTestId('search').textContent).toBe('?effect=film-burn');
+ expect(screen.queryByText('Shot 2 · Part 2')).toBeNull();
+ fireEvent.click(screen.getByRole('button', { name: 'Stop showing only shots with Film burn' }));
+ expect(screen.getByText('Shot 2 · Part 2')).toBeTruthy();
+ });
+});
+
describe('BoardStage thumbnail lock marks', () => {
it('marks locked, still-only and changed shots, and leaves open ones bare', () => {
const scenes = [scene(1), scene(2), scene(3), scene(4)];
diff --git a/client/src/lib/README.md b/client/src/lib/README.md
index ebd4462767..591ac15a74 100644
--- a/client/src/lib/README.md
+++ b/client/src/lib/README.md
@@ -320,3 +320,4 @@ grep -i "what you want to do" client/src/lib/README.md
| `musicVideoImageEffects.js` | Music-video image effects (a camera flash that develops over a still shot), re-exported from `server/lib/musicVideoImageEffects.js`: the effects, labels and develop lengths, `sceneImageEffect`, `imageEffectState`. Used by `components/musicVideo/SceneImageEffect.jsx` and the storyboard animatic. |
| `musicVideoCutEffects.js` | Music-video cut effects (beat toggle, dissolve, fade through black across a cut), re-exported from `server/lib/musicVideoCutEffects.js`: settings, labels, `sceneCutEffect`, `sceneCutEffects`, `plannedTransitions`. Used by `components/musicVideo/SceneCutEffect.jsx` and the storyboard animatic. |
| `musicVideoTransitions.js` | Music-video cut transitions (VHS glitches over a cut), re-exported from `server/lib/musicVideoTransitions.js`: the styles and labels, `sceneTransitionSections`, `transitionGlitchFrames`, `transitionFrameAt`, in-shot glitches (`sceneShotGlitchFrames`), `blockBox` and `edgeGlows` for painting. Used by `components/musicVideo/SceneTransitions.jsx`, `SceneGlitches.jsx` and the storyboard animatic. |
+| `musicVideoShotEffects.js` | Music-video shot effects at a glance: `shotEffects` (a shot's start / mid-shot / end effects, read through the render's own transition, image-effect and cut-effect helpers) and `shotEffectCounts` (every effect option's use per slot, zeros included). Used by the Shots board's card badges and its Effects card. |
diff --git a/client/src/lib/index.js b/client/src/lib/index.js
index 813e32cb08..0751a06db0 100644
--- a/client/src/lib/index.js
+++ b/client/src/lib/index.js
@@ -279,4 +279,5 @@ export * from './filmLook.js';
export * from './musicVideoNarrativeEvents.js';
export * from './musicVideoCutEffects.js';
export * from './musicVideoTransitions.js';
+export * from './musicVideoShotEffects.js';
export * from './musicVideoImageEffects.js';
diff --git a/client/src/lib/musicVideoShotEffects.js b/client/src/lib/musicVideoShotEffects.js
new file mode 100644
index 0000000000..e2b4b61dda
--- /dev/null
+++ b/client/src/lib/musicVideoShotEffects.js
@@ -0,0 +1,66 @@
+/**
+ * Music Video shot effects at a glance: what each shot plays at its start, in
+ * its middle and at its end, and how often the video uses each effect, so the
+ * Shots board can badge every card and count every option.
+ *
+ * Read through the same helpers the render uses: a shot's cut transitions and
+ * in-shot glitches (musicVideoTransitions.js), a still's image effect
+ * (musicVideoImageEffects.js) and its switched-on cut effect, or the one its
+ * storyboard row plans (musicVideoCutEffects.js).
+ */
+import { MUSIC_VIDEO_CUT_EFFECTS, MUSIC_VIDEO_CUT_EFFECT_LABELS, sceneCutEffect } from './musicVideoCutEffects.js';
+import { MUSIC_VIDEO_IMAGE_EFFECTS, MUSIC_VIDEO_IMAGE_EFFECT_LABELS, sceneImageEffect } from './musicVideoImageEffects.js';
+import { MUSIC_VIDEO_TRANSITIONS, MUSIC_VIDEO_TRANSITION_LABELS, sceneTransitions } from './musicVideoTransitions.js';
+
+/** Where an effect plays in its shot. */
+export const SHOT_EFFECT_SLOTS = Object.freeze(['start', 'mid', 'end']);
+export const SHOT_EFFECT_SLOT_LABELS = Object.freeze({ start: 'Start', mid: 'Mid-shot', end: 'End' });
+
+/**
+ * Every effect option, `{ id, label, slots }`: the glitch styles play at any
+ * slot, a cut effect only at a shot's end, an image effect only inside a still.
+ */
+export const SHOT_EFFECT_OPTIONS = Object.freeze([
+ ...MUSIC_VIDEO_TRANSITIONS.map((id) => ({ id, label: MUSIC_VIDEO_TRANSITION_LABELS[id], slots: SHOT_EFFECT_SLOTS })),
+ ...MUSIC_VIDEO_CUT_EFFECTS.map((id) => ({ id, label: MUSIC_VIDEO_CUT_EFFECT_LABELS[id], slots: ['end'] })),
+ ...MUSIC_VIDEO_IMAGE_EFFECTS.map((id) => ({ id, label: MUSIC_VIDEO_IMAGE_EFFECT_LABELS[id], slots: ['mid'] })),
+]);
+const LABELS = new Map(SHOT_EFFECT_OPTIONS.map((option) => [option.id, option.label]));
+export const shotEffectLabel = (id) => LABELS.get(id) || id;
+
+/**
+ * A shot's effects by slot, `{ start, mid, end }`, each a list of option ids
+ * (an in-shot glitch style once per glitch). `planned` is `plannedTransitions`
+ * of the storyboard rows, so a cut effect the row plans counts until the shot
+ * sets its own.
+ */
+export function shotEffects(scene, { layered = false, planned = null } = {}) {
+ const { transitionIn, transitionOut, shotGlitches = [] } = sceneTransitions(scene);
+ const image = sceneImageEffect(scene, { layered });
+ const cut = sceneCutEffect(scene, planned?.get(scene?.sceneId) ?? null);
+ return {
+ start: transitionIn ? [transitionIn] : [],
+ mid: [...(image ? [image.effect] : []), ...shotGlitches.map((glitch) => glitch.style)],
+ end: [...(transitionOut ? [transitionOut] : []), ...(cut?.enabled ? [cut.style] : [])],
+ };
+}
+
+/** Whether a shot plays an effect anywhere in it. */
+export const shotUsesEffect = (effects, id) => SHOT_EFFECT_SLOTS.some((slot) => effects[slot].includes(id));
+
+/**
+ * How often the video uses each effect option, from every shot's
+ * `shotEffects`: `[{ id, label, slots, start, mid, end, total, shots }]` in
+ * option order, unused options included with zeros. `shots` counts the shots
+ * that play it anywhere.
+ */
+export function shotEffectCounts(shotsEffects) {
+ return SHOT_EFFECT_OPTIONS.map((option) => {
+ const row = { ...option, start: 0, mid: 0, end: 0, shots: 0 };
+ for (const effects of shotsEffects) {
+ for (const slot of SHOT_EFFECT_SLOTS) row[slot] += effects[slot].filter((id) => id === option.id).length;
+ if (shotUsesEffect(effects, option.id)) row.shots += 1;
+ }
+ return { ...row, total: row.start + row.mid + row.end };
+ });
+}