diff --git a/dashboard/src/App.jsx b/dashboard/src/App.jsx index 1c255f4..7bab2e7 100644 --- a/dashboard/src/App.jsx +++ b/dashboard/src/App.jsx @@ -1032,6 +1032,7 @@ function App() { return ( - + {activeNav?.label || 'openshorts'} {status !== 'idle' && ( diff --git a/dashboard/src/components/ClipTutorial.jsx b/dashboard/src/components/ClipTutorial.jsx index c032c82..dfd370b 100644 --- a/dashboard/src/components/ClipTutorial.jsx +++ b/dashboard/src/components/ClipTutorial.jsx @@ -1,31 +1,118 @@ -import { ArrowRight, CheckCircle2, LayoutDashboard, Sparkles } from 'lucide-react'; +import { useEffect, useLayoutEffect, useState } from 'react'; +import { ArrowLeft, ArrowRight, CheckCircle2, LayoutDashboard, Sparkles } from 'lucide-react'; import Modal from './ui/Modal'; -import StepIndicator from './ui/StepIndicator'; -const STEPS = ['Add a video', 'Generate', 'Your clips']; +const TOUR = [ + { + target: '[data-tutorial="nav-clips"]', + title: 'Clip Generator', + body: 'This is the tool people come for. A long video in, vertical shorts out. The other menu items stay locked until you finish one run.', + }, + { + target: '[data-tutorial="source-tabs"]', + title: 'Upload or paste a link', + body: 'Drop an MP4, or switch to Video URL and paste YouTube, TikTok, Instagram…', + }, + { + target: '[data-tutorial="drop-zone"]', + title: 'Your video', + body: 'Click the box or paste the link here. Keep files under 500MB.', + }, + { + target: '[data-tutorial="output-format"]', + title: 'Output format', + body: '9:16 is TikTok, Reels and Shorts. Leave it unless you need a square feed post or landscape.', + }, + { + target: '[data-tutorial="generate"]', + title: 'Generate', + body: 'Tick that you have the rights, then generate. That is the whole first run.', + }, +]; -function stepIndex(jobStatus) { - if (jobStatus === 'processing') return 1; - if (jobStatus === 'complete') return 2; - return 0; +function visibleTarget(selector) { + return [...document.querySelectorAll(selector)].find((el) => { + const r = el.getBoundingClientRect(); + return r.width > 2 && r.height > 2; + }) || null; } -function stepCopy(jobStatus) { - if (jobStatus === 'processing') return 'Hang on — Clip Generator is finding the moments and cutting vertical shorts.'; - if (jobStatus === 'error') return 'That run failed. Try another YouTube link or file. The other tools stay locked until one job finishes.'; - if (jobStatus === 'complete') return 'Clips are ready.'; - return 'Paste a YouTube link or drop a video below, tick the rights box, then generate.'; +function placeTip(rect, tipW, tipH, vw, vh) { + const m = 12; + const gap = 12; + const mobile = vw < 640; + if (mobile) { + return { + top: Math.max(m, vh - tipH - m - 8), + left: m, + width: vw - m * 2, + }; + } + let top = rect.bottom + gap; + if (top + tipH > vh - m) top = rect.top - gap - tipH; + if (top < m) top = m; + let left = rect.left + rect.width / 2 - tipW / 2; + left = Math.max(m, Math.min(left, vw - m - tipW)); + return { top, left, width: tipW }; } /** * First-login Clip Generator tutorial. - * - intro: blocking modal (Start / skip) - * - coach: non-blocking card that tracks idle → processing → complete + * - intro: blocking modal + * - coach: Next/Back spotlight on each Clip Generator control * - celebrate: modal after the first successful job * - * QA: open #app?tutorial=1 to force the intro without a fresh signup. + * QA: #app?tutorial=1 */ export default function ClipTutorial({ phase, jobStatus, onStart, onSkip, onDismissCelebrate }) { + const [step, setStep] = useState(0); + const [spot, setSpot] = useState(null); + + useEffect(() => { + if (phase === 'coach') setStep(0); + }, [phase]); + + useLayoutEffect(() => { + if (phase !== 'coach' || jobStatus === 'processing' || jobStatus === 'error') { + setSpot(null); + return; + } + const measure = () => { + const spec = TOUR[step]; + if (!spec) { setSpot(null); return; } + const el = visibleTarget(spec.target); + if (el) el.scrollIntoView({ block: 'nearest', inline: 'nearest' }); + const rect = el ? el.getBoundingClientRect() : null; + const vw = window.innerWidth; + const vh = window.innerHeight; + const r = (n) => Math.round(n); + const mobile = vw < 640; + const tipW = Math.min(360, vw - 24); + const tipH = 220; + const hole = rect + ? { top: r(rect.top - 6), left: r(rect.left - 6), width: r(rect.width + 12), height: r(rect.height + 12) } + : null; + const rawTip = hole + ? placeTip({ top: hole.top, bottom: hole.top + hole.height, left: hole.left, width: hole.width }, tipW, tipH, vw, vh) + : { top: mobile ? vh - 240 : vh / 2 - 80, left: 12, width: vw - 24 }; + const tip = { top: r(rawTip.top), left: r(rawTip.left), width: r(rawTip.width) }; + setSpot((prev) => { + const next = { hole, tip, mobile }; + try { + if (prev && JSON.stringify(prev) === JSON.stringify(next)) return prev; + } catch (_) { /* ignore */ } + return next; + }); + }; + measure(); + window.addEventListener('resize', measure); + window.addEventListener('scroll', measure, true); + return () => { + window.removeEventListener('resize', measure); + window.removeEventListener('scroll', measure, true); + }; + }, [phase, step, jobStatus]); + if (phase === 'intro') { return ( @@ -35,16 +122,11 @@ export default function ClipTutorial({ phase, jobStatus, onStart, onSkip, onDism

People come here for Clip Generator: a long video in, - vertical shorts out. That is the only tool unlocked on this first run. + vertical shorts out. We will walk the screen, then you run one video.

-
    -
  1. Paste a YouTube link or upload a file
  2. -
  3. Generate
  4. -
  5. Watch the clips
  6. -
+

+ Your turn — add a video and generate. +

+ + + ); + } + + const hole = spot?.hole; + const tip = spot?.tip; + + return ( +
+ {!hole &&
} + {hole && ( +
+ )} +
+

{String(step + 1).padStart(2, '0')} / {String(TOUR.length).padStart(2, '0')}

+

{spec.title}

+

{spec.body}

+
+ {step > 0 && ( + + )} + +
+ +
); } diff --git a/dashboard/src/components/MediaInput.jsx b/dashboard/src/components/MediaInput.jsx index a516bca..079e3d0 100644 --- a/dashboard/src/components/MediaInput.jsx +++ b/dashboard/src/components/MediaInput.jsx @@ -108,7 +108,7 @@ export default function MediaInput({ onProcess, isProcessing }) { return (
-
+