diff --git a/dashboard/src/remotion/compositions/HookOverlay.tsx b/dashboard/src/remotion/compositions/HookOverlay.tsx index cd2f3ff..3a0c2b2 100644 --- a/dashboard/src/remotion/compositions/HookOverlay.tsx +++ b/dashboard/src/remotion/compositions/HookOverlay.tsx @@ -26,6 +26,23 @@ const POSITION_STYLE: Record = { bottom: { top: "68%", bottom: "auto" }, }; +// Must mirror hooks.py HOOK_STYLES (the server-side FFmpeg fallback). +interface HookLook { + box: string | null; + text: string; + outlinePx: number; + shadow: boolean; +} + +const HOOK_LOOKS: Record = { + classic: { box: "rgba(255, 255, 255, 0.94)", text: "#000000", outlinePx: 0, shadow: true }, + dark: { box: "rgba(18, 18, 20, 0.92)", text: "#FFFFFF", outlinePx: 0, shadow: true }, + yellow: { box: "rgba(255, 214, 0, 0.96)", text: "#000000", outlinePx: 0, shadow: true }, + red: { box: "rgba(220, 38, 38, 0.96)", text: "#FFFFFF", outlinePx: 0, shadow: true }, + outline: { box: null, text: "#FFFFFF", outlinePx: 8, shadow: false }, + outline_yellow: { box: null, text: "#FFD600", outlinePx: 8, shadow: false }, +}; + export const HookOverlay: React.FC = ({ config }) => { const { fps } = useVideoConfig(); const displayFrames = Math.round(config.displayDurationSec * fps); @@ -98,10 +115,12 @@ const HookBox: React.FC = ({ config, displayFrames }) => { } const positionStyle = POSITION_STYLE[config.position] ?? POSITION_STYLE.top; + const look = HOOK_LOOKS[config.style ?? "classic"] ?? HOOK_LOOKS.classic; // Base font size: 5% of 1080 width (matches hooks.py logic) const baseFontSize = 1080 * 0.05; const fontSize = Math.round(baseFontSize * scale); + const outlinePx = Math.round(look.outlinePx * scale); return (
= ({ config, displayFrames }) => { opacity: animOpacity, transform: `scale(${animScale}) translateY(${animTranslateY}px)`, maxWidth: "90%", - backgroundColor: "rgba(255, 255, 255, 0.94)", + backgroundColor: look.box ?? "transparent", borderRadius: 20, - padding: `${25 * scale}px ${30 * scale}px`, - boxShadow: "5px 5px 15px rgba(0, 0, 0, 0.25)", + padding: look.box ? `${25 * scale}px ${30 * scale}px` : 0, + boxShadow: look.shadow ? "5px 5px 15px rgba(0, 0, 0, 0.25)" : "none", textAlign: "center", }} > @@ -131,9 +150,15 @@ const HookBox: React.FC = ({ config, displayFrames }) => { fontFamily: `'${NOTO_SERIF_FONT_FAMILY}', 'Noto Serif', Georgia, serif`, fontSize, fontWeight: 700, - color: "#000000", + color: look.text, lineHeight: 1.4, wordBreak: "break-word", + ...(outlinePx > 0 + ? { + WebkitTextStroke: `${outlinePx}px #000000`, + paintOrder: "stroke fill", + } + : {}), }} > {config.text} diff --git a/dashboard/src/remotion/lib/types.ts b/dashboard/src/remotion/lib/types.ts index ce1a24d..2ab376f 100644 --- a/dashboard/src/remotion/lib/types.ts +++ b/dashboard/src/remotion/lib/types.ts @@ -36,11 +36,19 @@ export interface SubtitleConfig { export type HookPosition = "top" | "center" | "bottom"; export type HookSize = "S" | "M" | "L"; export type HookEntrance = "spring" | "fade" | "slide-up" | "none"; +export type HookStyle = + | "classic" + | "dark" + | "yellow" + | "red" + | "outline" + | "outline_yellow"; export interface HookConfig { text: string; position: HookPosition; size: HookSize; + style?: HookStyle; entranceAnimation: HookEntrance; displayDurationSec: number; } @@ -102,6 +110,9 @@ export const hookConfigSchema = z.object({ text: z.string(), position: z.enum(["top", "center", "bottom"]), size: z.enum(["S", "M", "L"]), + style: z + .enum(["classic", "dark", "yellow", "red", "outline", "outline_yellow"]) + .default("classic"), entranceAnimation: z.enum(["spring", "fade", "slide-up", "none"]), displayDurationSec: z.number().positive(), });