From 016267f204110199842a04657437c19af5225578 Mon Sep 17 00:00:00 2001 From: "victormanuel.caverogracia" <> Date: Tue, 1 Sep 2026 13:55:37 +0200 Subject: [PATCH] feat(dashboard): first-login Clip Generator tutorial MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New accounts land on Clip Generator with other tools locked. A modal walks paste → generate → clips and celebrates the first successful job. --- dashboard/src/App.jsx | 132 +++++++++++++++++----- dashboard/src/components/ClipTutorial.jsx | 106 +++++++++++++++++ dashboard/src/contexts/AuthContext.jsx | 9 +- dashboard/src/lib/analytics.js | 3 + dashboard/src/main.jsx | 2 +- 5 files changed, 221 insertions(+), 31 deletions(-) create mode 100644 dashboard/src/components/ClipTutorial.jsx diff --git a/dashboard/src/App.jsx b/dashboard/src/App.jsx index 92888fa..1c255f4 100644 --- a/dashboard/src/App.jsx +++ b/dashboard/src/App.jsx @@ -1,5 +1,5 @@ import React, { useState, useEffect, useRef, useMemo } from 'react'; -import { Upload, Sparkles, Youtube, Instagram, Share2, ChevronDown, Check, Activity, LayoutDashboard, Settings, Plus, History, X, Terminal, Shield, LayoutGrid, Image, Globe, RotateCcw, Calendar, AlertTriangle, KeyRound, Bot, Users, Smartphone, ExternalLink, Copy, CheckCircle2, Mail, Loader2, Download, Menu } from 'lucide-react'; +import { Upload, Sparkles, Youtube, Instagram, Share2, ChevronDown, Check, Activity, LayoutDashboard, Settings, Plus, History, X, Terminal, Shield, LayoutGrid, Image, Globe, RotateCcw, Calendar, AlertTriangle, KeyRound, Bot, Users, Smartphone, ExternalLink, Copy, CheckCircle2, Mail, Loader2, Download, Menu, Lock } from 'lucide-react'; import KeyInput from './components/KeyInput'; import MediaInput from './components/MediaInput'; import McpConnectCard from './components/McpConnectCard'; @@ -16,6 +16,7 @@ import UsageMeter from './components/UsageMeter'; import TopUpModal from './components/TopUpModal'; import StarBanner from './components/StarBanner'; import PlanChoiceModal from './components/PlanChoiceModal'; +import ClipTutorial from './components/ClipTutorial'; import TrialUpgradeModal from './components/TrialUpgradeModal'; import LoginModal from './components/LoginModal'; import TrialGate from './components/TrialGate'; @@ -202,6 +203,7 @@ function App() { const [showLogin, setShowLogin] = useState(false); const [showTopUp, setShowTopUp] = useState(false); const [showPlanChoice, setShowPlanChoice] = useState(false); + const [tutorialPhase, setTutorialPhase] = useState(null); // null | intro | coach | celebrate const [showTrialUpgrade, setShowTrialUpgrade] = useState(false); const [topUpInfo, setTopUpInfo] = useState({}); // Durable R2 URLs (per clip index) for the current job — used as a fallback when @@ -711,19 +713,72 @@ function App() { const keysMissing = !billingEnabled && (!geminiOk || !uploadPostKey); const needsPlan = billingEnabled && !isManaged; // hosted, signed-out or no active plan/trial - // Fresh sign-up: show the welcome plan-choice popup once (AuthContext set the - // flag after the auth redirect). Fires for free users too, so it's gated on - // being signed in rather than on entitlement. + // Fresh sign-up: Clip Generator tutorial (AuthContext set os_show_clip_tutorial + // after the auth redirect). QA: #app?tutorial=1. Resume coach if they refreshed + // mid-job. Runs once on mount so a later isSignedIn flip cannot reset intro→coach. useEffect(() => { - if (billingEnabled && isSignedIn) { - let flagged = false; - try { flagged = localStorage.getItem('os_show_plan_choice') === '1'; } catch (_) { /* ignore */ } - if (flagged) { - setShowPlanChoice(true); - try { localStorage.removeItem('os_show_plan_choice'); } catch (_) { /* ignore */ } - } + let showTutorial = false; + let resumeCoach = false; + try { + const q = new URLSearchParams((window.location.hash.split('?')[1] || '')); + const qa = q.get('tutorial'); + if (qa === '1') showTutorial = true; + if (qa === 'coach') resumeCoach = true; + if (qa === 'celebrate') { setTutorialPhase('celebrate'); return; } + if (localStorage.getItem('os_show_clip_tutorial') === '1') showTutorial = true; + if (localStorage.getItem('os_clip_tutorial') === 'coach') resumeCoach = true; + } catch (_) { /* ignore */ } + if (showTutorial) { + setTutorialPhase('intro'); + setActiveTab('dashboard'); + } else if (resumeCoach) { + setTutorialPhase('coach'); + setActiveTab('dashboard'); } - }, [billingEnabled, isSignedIn]); + }, []); + + // Legacy: an older build may still have set os_show_plan_choice. Don't open it + // on top of the tutorial. + useEffect(() => { + if (tutorialPhase) return; + if (!(billingEnabled && isSignedIn)) return; + let showPlans = false; + try { showPlans = localStorage.getItem('os_show_plan_choice') === '1'; } catch (_) { /* ignore */ } + if (showPlans) { + setShowPlanChoice(true); + try { localStorage.removeItem('os_show_plan_choice'); } catch (_) { /* ignore */ } + } + }, [billingEnabled, isSignedIn, tutorialPhase]); + + const tutorialLock = tutorialPhase === 'intro' || tutorialPhase === 'coach' || tutorialPhase === 'celebrate'; + + useEffect(() => { + if (tutorialLock && activeTab !== 'dashboard') setActiveTab('dashboard'); + }, [tutorialLock, activeTab]); + + useEffect(() => { + if (tutorialPhase === 'coach' && status === 'complete' && (results?.clips?.length > 0)) { + setTutorialPhase('celebrate'); + track('ClipTutorialCompleted', { props: { clips: results.clips.length } }); + } + }, [tutorialPhase, status, results]); + + const finishTutorial = () => { + try { localStorage.setItem('os_clip_tutorial', 'done'); } catch (_) { /* ignore */ } + try { localStorage.removeItem('os_show_clip_tutorial'); } catch (_) { /* ignore */ } + setTutorialPhase(null); + }; + const startTutorial = () => { + try { localStorage.setItem('os_clip_tutorial', 'coach'); } catch (_) { /* ignore */ } + try { localStorage.removeItem('os_show_clip_tutorial'); } catch (_) { /* ignore */ } + track('ClipTutorialStarted'); + setTutorialPhase('coach'); + setActiveTab('dashboard'); + }; + const skipTutorial = () => { + track('ClipTutorialSkipped', { props: { phase: tutorialPhase } }); + finishTutorial(); + }; // Included in the plan (fully managed, no keys): Clip Generator + YouTube Studio. // Advanced (bring your own fal.ai + ElevenLabs keys): AI Shorts + AI Agent. const INCLUDED_TOOL_TABS = ['dashboard', 'thumbnails']; @@ -736,7 +791,7 @@ function App() { // connected yet. userProfiles being empty (not yet fetched / none created) // also counts as "not connected" — that is the 97% case. const connectedSocials = ((userProfiles.find((p) => p.username === uploadUserId) || userProfiles[0])?.connected) || []; - const showSocialNudge = isManaged && !socialNudgeDismissed && connectedSocials.length === 0; + const showSocialNudge = isManaged && !socialNudgeDismissed && connectedSocials.length === 0 && !tutorialLock; // One Seen event per job, only when the banner actually rendered. const socialNudgeSeenRef = useRef(null); @@ -913,7 +968,12 @@ function App() { return () => document.removeEventListener('keydown', onKey); }, [navOpen]); - const goToTab = (id) => { setActiveTab(id); setNavOpen(false); }; + const goToTab = (id) => { + if (tutorialLock && id !== 'dashboard') return; + setActiveTab(id); + setNavOpen(false); + }; + const tabLocked = (id) => tutorialLock && id !== 'dashboard'; // Shared footer links (landing, repo, pricing, contact) — same list in the // desktop rail and the mobile drawer, so they can never drift apart. @@ -972,16 +1032,19 @@ function App() { return ( setActiveTab(item.id)} - title={item.label} - className={`relative w-full flex items-center gap-3 px-3 py-2.5 rounded-input transition-colors ${isActive ? 'bg-paper3 text-ink' : 'text-muted hover:text-ink2 hover:bg-paper3/50'}`} + onClick={() => goToTab(item.id)} + title={tabLocked(item.id) ? 'Finish your first clips to unlock' : item.label} + disabled={tabLocked(item.id)} + className={`relative w-full flex items-center gap-3 px-3 py-2.5 rounded-input transition-colors ${isActive ? 'bg-paper3 text-ink' : 'text-muted hover:text-ink2 hover:bg-paper3/50'} ${tabLocked(item.id) ? 'opacity-40 cursor-not-allowed hover:bg-transparent hover:text-muted' : ''}`} > {isActive && ( )} {item.label} - {item.byok && BYOK} + {tabLocked(item.id) + ? + : item.byok ? BYOK : null} {item.ord} ); @@ -1032,15 +1095,19 @@ function App() { goToTab(item.id)} + disabled={tabLocked(item.id)} aria-current={isActive ? 'page' : undefined} - className={`relative w-full flex items-center gap-3 px-3 py-3 rounded-input transition-colors ${isActive ? 'bg-paper3 text-ink' : 'text-muted active:bg-paper3/60'}`} + title={tabLocked(item.id) ? 'Finish your first clips to unlock' : undefined} + className={`relative w-full flex items-center gap-3 px-3 py-3 rounded-input transition-colors ${isActive ? 'bg-paper3 text-ink' : 'text-muted active:bg-paper3/60'} ${tabLocked(item.id) ? 'opacity-40 cursor-not-allowed' : ''}`} > {isActive && ( )} {item.label} - {item.byok && BYOK} + {tabLocked(item.id) + ? + : item.byok ? BYOK : null} ); })} @@ -1069,8 +1136,10 @@ function App() { goToTab(item.id)} + disabled={tabLocked(item.id)} aria-current={isActive ? 'page' : undefined} - className={`flex-1 min-w-0 flex flex-col items-center justify-center gap-1 py-2 min-h-[56px] transition-colors ${isActive ? 'text-ink' : 'text-muted active:text-ink2'}`} + title={tabLocked(item.id) ? 'Finish your first clips to unlock' : undefined} + className={`flex-1 min-w-0 flex flex-col items-center justify-center gap-1 py-2 min-h-[56px] transition-colors ${isActive ? 'text-ink' : 'text-muted active:text-ink2'} ${tabLocked(item.id) ? 'opacity-40 cursor-not-allowed' : ''}`} > {item.short} @@ -1164,7 +1233,7 @@ function App() { same thing, and two warnings in a 360px header is just noise. */} {keysMissing && ( (billingEnabled && !isSignedIn ? setShowLogin(true) : setActiveTab('settings'))} + onClick={() => (billingEnabled && !isSignedIn ? setShowLogin(true) : goToTab('settings'))} className="badge-warn hover:brightness-125 transition-all hidden sm:inline-flex" title="Configure API keys or choose a plan" > @@ -1199,7 +1268,7 @@ function App() { setActiveTab('settings')} + onClick={() => goToTab('settings')} className="btn-quiet px-3 py-1.5 text-xs shrink-0 w-full sm:w-auto" > Go to Settings @@ -1229,7 +1298,7 @@ function App() { {gateThisTab && } {/* Advanced tools (AI Shorts, AI Agent): BYOK fal.ai + ElevenLabs notice. */} - {advancedThisTab && setActiveTab('settings')} />} + {advancedThisTab && goToTab('settings')} />} {/* Main Workspace */} @@ -1645,16 +1714,18 @@ function App() { {/* The same pipeline is an MCP server: point people at the one place that explains how to drive it from an agent. */} + {!tutorialLock && ( Or let an agent do it:{' '} { if (!billingEnabled) { e.preventDefault(); setActiveTab('settings'); } }} + onClick={(e) => { if (!billingEnabled) { e.preventDefault(); goToTab('settings'); } }} className="text-ink2 underline underline-offset-2 hover:text-brass transition-colors" > connect Claude, ChatGPT or n8n → + )} @@ -1943,7 +2014,7 @@ function App() { Cancel { setShowKeyModal(false); setActiveTab('settings'); }} + onClick={() => { setShowKeyModal(false); goToTab('settings'); }} className="btn-primary flex-1 px-4 py-2 text-sm" > Go to Settings @@ -2073,6 +2144,15 @@ function App() { /> )} {showLogin && setShowLogin(false)} />} + {tutorialPhase && ( + + )} {showPlanChoice && setShowPlanChoice(false)} />} {showTopUp && ( + + + + + + People come here for Clip Generator: a long video in, + vertical shorts out. That is the only tool unlocked on this first run. + + + + Paste a YouTube link or upload a file + Generate + Watch the clips + + + Start with Clip Generator + + + I'll explore later + + + ); + } + + if (phase === 'coach') { + const current = stepIndex(jobStatus); + return ( + + First clips + + + {stepCopy(jobStatus)} + + + skip — unlock the rest + + + ); + } + + if (phase === 'celebrate') { + return ( + + + + + + + That is the whole product, on one video. + + + The other tools are unlocked. Come back to Clip Generator whenever you have another long video. + + + See my clips + + + + ); + } + + return null; +} diff --git a/dashboard/src/contexts/AuthContext.jsx b/dashboard/src/contexts/AuthContext.jsx index 70ec3cd..2a67a22 100644 --- a/dashboard/src/contexts/AuthContext.jsx +++ b/dashboard/src/contexts/AuthContext.jsx @@ -76,15 +76,16 @@ export function AuthProvider({ children }) { // channel produced an account. Awaited but never allowed to throw. await reportAttribution(apiJson); } - // Everyone lands in the app. Show the welcome plan-choice popup once per - // browser (on the first auth) for anyone not already on a paid plan — - // free is the default, paid is one click away. Never a pricing-page dump. + // Everyone lands in the app. First-time (unpaid) sign-in gets the Clip + // Generator tutorial, not a pricing dump — they need one successful job + // before the rest of the tools unlock. os_welcomed keeps this once-only + // even if they skip the tutorial. const paid = ['starter', 'creator', 'pro'].includes(signedInMe?.plan); let welcomed = false; try { welcomed = localStorage.getItem('os_welcomed') === '1'; } catch (_) { /* ignore */ } if (signedInMe?.user && !paid && !welcomed) { try { - localStorage.setItem('os_show_plan_choice', '1'); + localStorage.setItem('os_show_clip_tutorial', '1'); localStorage.setItem('os_welcomed', '1'); } catch (_) { /* ignore */ } } diff --git a/dashboard/src/lib/analytics.js b/dashboard/src/lib/analytics.js index 1f5fac6..155d4ff 100644 --- a/dashboard/src/lib/analytics.js +++ b/dashboard/src/lib/analytics.js @@ -19,6 +19,9 @@ // - SocialNudgeSeen — post-generation "connect socials" banner rendered // - SocialNudgeConnect — its connect button clicked (opens hosted connect page) // - SocialNudgeDismissed — its X clicked (persisted, never shown again) +// - ClipTutorialStarted — first-login tutorial: user hit Start +// - ClipTutorialSkipped — first-login tutorial dismissed (intro or coach) +// - ClipTutorialCompleted— first Clip Generator job finished with clips // The Started → Redirected → Subscribed chain is what separates "never reached // Stripe" from "reached Stripe and abandoned"; before 2-ago-2026 the modals // emitted only their own *Checkout event and the difference was invisible. diff --git a/dashboard/src/main.jsx b/dashboard/src/main.jsx index ffcb3b9..0dbf4cb 100644 --- a/dashboard/src/main.jsx +++ b/dashboard/src/main.jsx @@ -78,7 +78,7 @@ function Root() { if (hash === '#legal') return 'legal'; // #landing = explicit landing view (app logo); section anchors keep the landing mounted if (['#landing', '#features', '#how-it-works', '#pricing', '#comparison', '#faq'].includes(hash)) return 'landing'; - if (hash === '#app' || localStorage.getItem('openshorts_skip_landing') === '1') return 'app'; + if (hash === '#app' || hash.startsWith('#app?') || localStorage.getItem('openshorts_skip_landing') === '1') return 'app'; return 'landing'; };
Or let an agent do it:{' '} { if (!billingEnabled) { e.preventDefault(); setActiveTab('settings'); } }} + onClick={(e) => { if (!billingEnabled) { e.preventDefault(); goToTab('settings'); } }} className="text-ink2 underline underline-offset-2 hover:text-brass transition-colors" > connect Claude, ChatGPT or n8n →
+ People come here for Clip Generator: a long video in, + vertical shorts out. That is the only tool unlocked on this first run. +
First clips
+ {stepCopy(jobStatus)} +
+ That is the whole product, on one video. +
+ The other tools are unlocked. Come back to Clip Generator whenever you have another long video. +