Skip to content

Create polished demo videos without editing skills. Mac/Windows/Linux

Add replayable onboarding and email magic-link sign-in

webadderall82bc79cfe496
diff --git a/electron/authCallback.ts b/electron/authCallback.ts
index 439aeb0e..cd4ef1cf 100644
--- a/electron/authCallback.ts
+++ b/electron/authCallback.ts
@@ -91,7 +91,7 @@ export function createAuthCallbackController({ isDev, focusApp }: AuthCallbackOp
dispatch(appUrl.href);
response.writeHead(200, callbackHeaders("text/html; charset=utf-8"));
response.end(
- '<!doctype html><meta charset="utf-8"><title>Signed into Recordly</title><style>body{margin:0;min-height:100vh;display:grid;place-items:center;background:#08090a;color:#ededef;font:16px "Helvetica Neue",Helvetica,Arial,sans-serif}.card{max-width:420px;padding:32px;text-align:center}h1{font-size:22px;font-weight:500}p{color:#8b8b8e;line-height:1.6}</style><main class="card"><h1>Signed into Recordly</h1><p>You can close this tab and return to the app.</p></main>',
+ '<!doctype html><meta charset="utf-8"><title>Return to Recordly</title><style>body{margin:0;min-height:100vh;display:grid;place-items:center;background:#08090a;color:#ededef;font:16px "Helvetica Neue",Helvetica,Arial,sans-serif}.card{max-width:420px;padding:32px;text-align:center}h1{font-size:22px;font-weight:500}p{color:#8b8b8e;line-height:1.6}</style><main class="card"><h1>Return to Recordly</h1><p>Your sign-in link has been received. Return to the app to finish signing in.</p></main>',
);
});
server.on("error", (error) => {
diff --git a/services/supabase/templates/confirm-sign-up.html b/services/supabase/templates/confirm-sign-up.html
new file mode 100644
index 00000000..105f16ed
--- /dev/null
+++ b/services/supabase/templates/confirm-sign-up.html
@@ -0,0 +1,14 @@
+<!doctype html>
+<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Verify your email</title></head>
+<body style="margin:0;padding:0;background:#f5f5f7;color:#18181b;font-family:Arial,Helvetica,sans-serif;">
+<div style="display:none;max-height:0;overflow:hidden;">Verify your email to get started with Recordly. Open it on the computer where you requested it.</div>
+<table role="presentation" width="100%" cellspacing="0" cellpadding="0" style="background:#f5f5f7;"><tr><td align="center" style="padding:48px 20px;">
+<table role="presentation" width="480" cellspacing="0" cellpadding="0" style="width:100%;max-width:480px;"><tr><td style="padding:0 0 24px;font-size:22px;font-weight:700;letter-spacing:-.7px;">Recordly<span style="color:#7759e8;">.</span></td></tr>
+<tr><td style="padding:36px 32px;background:#ffffff;border:1px solid #e7e7ec;border-radius:16px;">
+<p style="margin:0 0 16px;font-size:11px;line-height:16px;font-weight:700;letter-spacing:1.5px;color:#7759e8;">YOUR ACCOUNT</p>
+<h1 style="margin:0 0 16px;font-size:28px;line-height:34px;letter-spacing:-.8px;">Welcome to Recordly.</h1>
+<p style="margin:0 0 28px;font-size:15px;line-height:24px;color:#61616c;">Verify your email address to finish creating your Recordly account. Open it on the same computer where you requested it, with the app running.</p>
+<table role="presentation" cellspacing="0" cellpadding="0"><tr><td bgcolor="#18181b" style="border-radius:9px;text-align:center;"><a href="{{ .ConfirmationURL }}" style="display:inline-block;padding:15px 24px;border:1px solid #18181b;border-radius:9px;color:#ffffff;font-size:14px;font-weight:700;text-decoration:none;">Verify your email &rarr;</a></td></tr></table>
+<p style="margin:26px 0 0;font-size:12px;line-height:20px;color:#777782;">This link can only be used once. If it has expired, request a new one from the app.</p>
+</td></tr><tr><td style="padding:24px 4px 0;font-size:12px;line-height:20px;color:#858590;">Didn't request this? You can safely ignore this email.<br>Recordly &middot; Beautiful screen recordings.</td></tr></table>
+</td></tr></table></body></html>
diff --git a/services/supabase/templates/magic-link.html b/services/supabase/templates/magic-link.html
new file mode 100644
index 00000000..3cfdbc83
--- /dev/null
+++ b/services/supabase/templates/magic-link.html
@@ -0,0 +1,14 @@
+<!doctype html>
+<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Sign in to Recordly</title></head>
+<body style="margin:0;padding:0;background:#f5f5f7;color:#18181b;font-family:Arial,Helvetica,sans-serif;">
+<div style="display:none;max-height:0;overflow:hidden;">Your secure sign-in link for Recordly. Open it on the computer where you requested it.</div>
+<table role="presentation" width="100%" cellspacing="0" cellpadding="0" style="background:#f5f5f7;"><tr><td align="center" style="padding:48px 20px;">
+<table role="presentation" width="480" cellspacing="0" cellpadding="0" style="width:100%;max-width:480px;"><tr><td style="padding:0 0 24px;font-size:22px;font-weight:700;letter-spacing:-.7px;">Recordly<span style="color:#7759e8;">.</span></td></tr>
+<tr><td style="padding:36px 32px;background:#ffffff;border:1px solid #e7e7ec;border-radius:16px;">
+<p style="margin:0 0 16px;font-size:11px;line-height:16px;font-weight:700;letter-spacing:1.5px;color:#7759e8;">YOUR ACCOUNT</p>
+<h1 style="margin:0 0 16px;font-size:28px;line-height:34px;letter-spacing:-.8px;">Back to creating.</h1>
+<p style="margin:0 0 28px;font-size:15px;line-height:24px;color:#61616c;">Use this secure link to sign in to Recordly. Open it on the same computer where you requested it, with the app running.</p>
+<table role="presentation" cellspacing="0" cellpadding="0"><tr><td bgcolor="#18181b" style="border-radius:9px;text-align:center;"><a href="{{ .ConfirmationURL }}" style="display:inline-block;padding:15px 24px;border:1px solid #18181b;border-radius:9px;color:#ffffff;font-size:14px;font-weight:700;text-decoration:none;">Sign in to Recordly &rarr;</a></td></tr></table>
+<p style="margin:26px 0 0;font-size:12px;line-height:20px;color:#777782;">This link can only be used once. If it has expired, request a new one from the app.</p>
+</td></tr><tr><td style="padding:24px 4px 0;font-size:12px;line-height:20px;color:#858590;">Didn't request this? You can safely ignore this email.<br>Recordly &middot; Beautiful screen recordings.</td></tr></table>
+</td></tr></table></body></html>
diff --git a/src/components/auth/OnboardingController.tsx b/src/components/auth/OnboardingController.tsx
new file mode 100644
index 00000000..455780de
--- /dev/null
+++ b/src/components/auth/OnboardingController.tsx
@@ -0,0 +1,51 @@
+import { useCallback, useEffect, useRef, useState } from "react";
+import type { User } from "@supabase/supabase-js";
+import { loadAppSetting, saveAppSetting } from "@/lib/appSettings";
+import { RecordlySignInDialog } from "./RecordlySignInDialog";
+
+const SEEN_KEY = "recordly.onboarding.v1.seen";
+
+export function OnboardingController({
+ requestNonce,
+ ready,
+ user,
+ configured,
+ callbackError,
+}: {
+ requestNonce: number;
+ ready: boolean;
+ user: User | null;
+ configured: boolean;
+ callbackError?: string;
+}) {
+ const [open, setOpen] = useState(false);
+ const checked = useRef(false);
+ useEffect(() => {
+ if (requestNonce > 0) setOpen(true);
+ }, [requestNonce]);
+ const close = useCallback(() => {
+ saveAppSetting(SEEN_KEY, true);
+ setOpen(false);
+ }, []);
+
+ useEffect(() => {
+ if (!ready || checked.current) return;
+ checked.current = true;
+ if (!loadAppSetting<boolean>(SEEN_KEY)) setOpen(true);
+ }, [ready]);
+
+ return (
+ <RecordlySignInDialog
+ onboarding
+ variant="wide"
+ open={open}
+ onOpenChange={(value) => {
+ if (!value) close();
+ }}
+ user={user}
+ configured={configured}
+ callbackError={callbackError}
+ onAuthenticated={close}
+ />
+ );
+}
diff --git a/src/components/auth/OnboardingFeature.tsx b/src/components/auth/OnboardingFeature.tsx
new file mode 100644
index 00000000..ea8817f6
--- /dev/null
+++ b/src/components/auth/OnboardingFeature.tsx
@@ -0,0 +1,147 @@
+import { Button, Description, Modal, Surface } from "@heroui/react";
+import { AnimatePresence, motion, useReducedMotion } from "motion/react";
+import {
+ ArrowLeft,
+ ArrowRight,
+ Check,
+ Link,
+ Monitor,
+ Play,
+ Record,
+ SlidersHorizontal,
+} from "@phosphor-icons/react";
+
+const features = [
+ {
+ name: "Record",
+ title: "Start with a moment.",
+ description: "Choose your screen or a window. Add your voice and camera, then hit record.",
+ },
+ {
+ name: "Preview",
+ title: "Make it yours.",
+ description: "Trim the take, frame your video, and bring the important details into focus.",
+ },
+ {
+ name: "Share",
+ title: "Ready when you are.",
+ description:
+ "Publish a link for anyone to watch, or save the finished video to your device.",
+ },
+];
+
+// Decorative product illustrations stay crisp as the image frame changes size.
+function FeatureIllustration({ step }: { step: number }) {
+ return (
+ <div
+ aria-hidden="true"
+ className="flex h-full items-center justify-center p-6 sm:p-10"
+ >
+ <div className="relative w-full max-w-[580px] overflow-hidden rounded-2xl border border-white/50 bg-white/85 text-zinc-900 shadow-2xl backdrop-blur-xl">
+ <div className="flex items-center gap-1.5 border-b border-black/5 px-4 py-3">
+ {[0, 1, 2].map((i) => (
+ <span key={i} className="size-2 rounded-full bg-zinc-300" />
+ ))}
+ <span className="ml-3 text-xs font-medium">
+ {features[step].name === "Share" ? "Your recording" : "Recordly"}
+ </span>
+ </div>
+ <div className="relative mx-5 mb-5 mt-4 flex aspect-video items-center justify-center overflow-hidden rounded-lg bg-gradient-to-br from-indigo-200 via-sky-100 to-rose-200">
+ <div className="flex w-3/5 flex-col gap-3 rounded-lg bg-white/90 p-5 shadow-lg">
+ <div className="h-2 w-1/3 rounded bg-indigo-300" />
+ <div className="h-3 w-4/5 rounded bg-zinc-700" />
+ <div className="h-2 w-full rounded bg-zinc-200" />
+ <div className="h-2 w-2/3 rounded bg-zinc-200" />
+ </div>
+ {step === 0 && (
+ <div className="absolute bottom-3 flex items-center gap-3 rounded-xl bg-white px-4 py-2 shadow-lg">
+ <Monitor size={20} />
+ <span className="text-xs">Entire screen</span>
+ <Record size={24} weight="fill" className="text-red-500" />
+ </div>
+ )}
+ {step === 1 && (
+ <div className="absolute bottom-3 flex items-center gap-3 rounded-xl bg-white px-4 py-2 shadow-lg">
+ <SlidersHorizontal size={20} />
+ <div className="h-1.5 w-24 rounded-full bg-blue-500" />
+ <span className="text-xs">Preview</span>
+ </div>
+ )}
+ {step === 2 && (
+ <div className="absolute flex size-14 items-center justify-center rounded-full bg-white/90 shadow-lg">
+ <Play size={24} weight="fill" />
+ </div>
+ )}
+ </div>
+ {step === 2 && (
+ <div className="mx-5 mb-5 flex items-center justify-center gap-2 rounded-lg bg-blue-500 p-3 text-sm font-medium text-white">
+ <Link size={18} />
+ Copy link
+ <Check size={16} />
+ </div>
+ )}
+ </div>
+ </div>
+ );
+}
+
+export function OnboardingFeature({
+ step,
+ onStep,
+ onFinish,
+}: {
+ step: number;
+ onStep: (step: number) => void;
+ onFinish: () => void;
+}) {
+ const reduceMotion = useReducedMotion();
+ const feature = features[step];
+ return (
+ <div className="absolute inset-0 flex flex-col">
+ <div className="relative min-h-0 flex-1 overflow-hidden">
+ <AnimatePresence mode="wait" initial={false}>
+ <motion.div
+ key={step}
+ initial={{ opacity: 0, y: reduceMotion ? 0 : 12 }}
+ animate={{ opacity: 1, y: 0 }}
+ exit={{ opacity: 0 }}
+ transition={{ duration: reduceMotion ? 0 : 0.2 }}
+ className="absolute inset-0"
+ >
+ <FeatureIllustration step={step} />
+ </motion.div>
+ </AnimatePresence>
+ </div>
+ <Surface className="shrink-0 border-t border-separator px-6 py-5 sm:px-8 sm:py-6">
+ <div className="flex flex-col gap-5 sm:flex-row sm:items-end sm:justify-between">
+ <Modal.Header aria-live="polite" className="min-w-0 flex-1 gap-2">
+ <Modal.Heading className="text-2xl font-semibold tracking-tight sm:text-3xl">
+ {feature.title}
+ </Modal.Heading>
+ <Description className="text-sm leading-relaxed">
+ {feature.description}
+ </Description>
+ </Modal.Header>
+ <Modal.Footer className="shrink-0 gap-2">
+ <Button
+ isIconOnly
+ aria-label={step === 0 ? "Back to sign in" : "Previous feature"}
+ variant="secondary"
+ onPress={() => onStep(step - 1)}
+ >
+ <ArrowLeft size={18} />
+ </Button>
+ <Button
+ isIconOnly
+ aria-label={step === 2 ? "Get started" : "Next"}
+ variant="secondary"
+ onPress={() => (step === 2 ? onFinish() : onStep(step + 1))}
+ >
+ <ArrowRight size={18} />
+ </Button>
+ </Modal.Footer>
+ </div>
+ </Surface>
+ </div>
+ );
+}
diff --git a/src/components/auth/RecordlySignInDialog.tsx b/src/components/auth/RecordlySignInDialog.tsx
index 482a1d03..671f3626 100644
--- a/src/components/auth/RecordlySignInDialog.tsx
+++ b/src/components/auth/RecordlySignInDialog.tsx
@@ -1,3 +1,5 @@
+import { GithubLogo } from "@phosphor-icons/react";
+import { OnboardingFeature } from "./OnboardingFeature";
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
import { demoLoginEnabled } from "@/lib/auth/demoSession";
import { useI18n } from "@/contexts/I18nContext";
@@ -17,7 +19,7 @@ import {
Alert,
} from "@heroui/react";
import {
- sendPasswordReset,
+ sendSignInLink,
signInWithEmail,
signInWithSocial,
signOutRecordly,
@@ -29,6 +31,7 @@ export type SignInReason = "account" | "share";
type Props = {
variant?: "compact" | "wide";
+ onboarding?: boolean;
open: boolean;
onOpenChange: (open: boolean) => void;
reason?: SignInReason;
@@ -49,6 +52,7 @@ function friendlyAuthError(
return t("editor.cloud.googleUnavailable");
}
if (action === "azure") return "Microsoft sign-in is not available yet.";
+ if (action === "github") return "GitHub sign-in is not available yet.";
return t("editor.cloud.providerUnavailable");
}
return message;
@@ -56,6 +60,7 @@ function friendlyAuthError(
export function RecordlySignInDialog({
variant = "compact",
+ onboarding = false,
open,
onOpenChange,
user,
@@ -65,20 +70,24 @@ export function RecordlySignInDialog({
}: Props) {
const { t } = useI18n();
const awaitingSignIn = useRef(false);
- const wide = variant === "wide";
+ const wide = onboarding || variant === "wide";
+ const [featureStep, setFeatureStep] = useState(-1);
+ const feature = onboarding && featureStep >= 0;
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
+ const demoEmail = demoLoginEnabled && email.trim().toLowerCase() === "[email protected]";
const [busy, setBusy] = useState<string>();
const [message, setMessage] = useState<string>();
- const [resetSent, setResetSent] = useState(false);
+ const [linkSent, setLinkSent] = useState(false);
useEffect(() => {
if (!open) {
setPassword("");
+ setFeatureStep(-1);
awaitingSignIn.current = false;
setBusy(undefined);
setMessage(undefined);
- setResetSent(false);
+ setLinkSent(false);
}
}, [open]);
@@ -88,14 +97,15 @@ export function RecordlySignInDialog({
else if (awaitingSignIn.current) {
awaitingSignIn.current = false;
setMessage(undefined);
- onAuthenticated();
+ if (onboarding) setFeatureStep(0);
+ else onAuthenticated();
}
- }, [open, user, onAuthenticated]);
+ }, [open, user, onAuthenticated, onboarding]);
const run = async (label: string, action: () => Promise<unknown>) => {
setBusy(label);
setMessage(undefined);
- setResetSent(false);
+ setLinkSent(false);
try {
await action();
} catch (error) {
@@ -108,6 +118,10 @@ export function RecordlySignInDialog({
const submitEmail = (event: FormEvent<HTMLFormElement>) => {
event.preventDefault();
if ((!configured && !demoLoginEnabled) || busy) return;
+ if (!demoEmail) {
+ emailSignInLink();
+ return;
+ }
void run("email", async () => {
if (!configured && email.trim().toLowerCase() !== "[email protected]") {
throw new Error("Email sign-in is not available yet.");
@@ -116,15 +130,17 @@ export function RecordlySignInDialog({
});
};
- const forgotPassword = () => {
- if (!email.trim()) {
+ const emailSignInLink = () => {
+ if (!email.trim() || !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email.trim())) {
setMessage(t("editor.cloud.enterEmail"));
return;
}
- void run("reset", async () => {
- await sendPasswordReset(email.trim());
- setMessage(t("editor.cloud.resetSent"));
- setResetSent(true);
+ void run("link", async () => {
+ await sendSignInLink(email.trim());
+ setMessage(
+ "Check your inbox to verify your email and continue to Recordly. Open the link on this computer with Recordly running.",
+ );
+ setLinkSent(true);
});
};
@@ -143,239 +159,282 @@ export function RecordlySignInDialog({
<Modal.Backdrop>
<Modal.Container size="cover" placement="center" className="p-4 sm:p-8">
<MotionDialog
- layout
+ layout={!onboarding}
transition={transition}
- className={`h-auto min-h-0 w-full max-h-[calc(100dvh-48px)] gap-0 overflow-y-auto rounded-[32px] p-2 ${wide ? "max-w-[1120px] md:grid md:grid-cols-2 md:aspect-[28/19]" : "max-w-[600px]"}`}
+ aria-label={onboarding ? "Welcome to Recordly" : undefined}
+ data-onboarding-state={
+ onboarding ? (feature ? "feature" : "login") : undefined
+ }
+ className={`h-auto min-h-0 w-full max-h-[calc(100dvh-48px)] gap-0 overflow-y-auto rounded-[32px] p-2 ${wide ? `max-w-[1120px] md:grid ${feature ? "md:grid-cols-1 md:aspect-[16/10]" : "md:grid-cols-2 md:aspect-[28/19]"}` : "max-w-[600px]"}`}
>
<div
- aria-hidden="true"
- className={`relative h-32 shrink-0 overflow-hidden rounded-[24px] sm:h-36 ${wide ? "md:order-2 md:h-full md:min-h-0" : ""}`}
+ data-onboarding-artwork={onboarding || undefined}
+ className={`relative shrink-0 overflow-hidden rounded-[24px] ${feature ? "h-[min(680px,calc(100dvh-96px))] min-h-[440px] md:col-span-full md:h-full" : `h-32 sm:h-36 ${wide ? "md:order-2 md:h-full md:min-h-0" : ""}`}`}
>
- <picture>
- {wide && (
- <source
- media="(min-width: 768px)"
- srcSet={`${import.meta.env.BASE_URL}auth/login-side.png`}
- />
- )}
- <img
- src={artwork}
- alt=""
- className={`absolute inset-0 size-full object-cover object-[center_40%] ${wide ? "md:object-center" : ""}`}
+ <motion.img
+ layout={onboarding && !reduceMotion}
+ transition={{ ...transition, duration: reduceMotion ? 0 : 0.5 }}
+ src={
+ wide
+ ? `${import.meta.env.BASE_URL}auth/login-side.png`
+ : artwork
+ }
+ alt=""
+ className="absolute inset-0 size-full object-cover object-center"
+ />
+ {feature && (
+ <OnboardingFeature
+ step={featureStep}
+ onStep={setFeatureStep}
+ onFinish={onAuthenticated}
/>
- </picture>
+ )}
</div>
<Modal.CloseTrigger
aria-label={t("common.actions.close")}
className="z-20"
/>
- <motion.div
- layout="position"
- transition={transition}
- className={`flex flex-1 flex-col justify-center px-6 py-7 sm:px-10 ${wide ? "md:order-1 md:min-w-0" : ""}`}
- >
- <div className="w-full max-w-[420px] self-center space-y-5 @container">
- <motion.div {...reveal}>
- <Modal.Header className="items-center gap-4 text-center">
- <div
- className="flex items-center gap-3"
- aria-label="Recordly"
- >
- <img
- src={`${import.meta.env.BASE_URL}app-icons/recordly-128.png`}
- alt=""
- className="size-12 rounded-xl"
- />
- <span className="text-3xl font-semibold tracking-tight">
- Recordly
- </span>
- </div>
- <Modal.Heading className="whitespace-nowrap text-[clamp(12px,5cqw,22px)] font-semibold leading-tight tracking-tight">
- {user
- ? "Your account"
- : "Beautiful, shareable screen recordings"}
- </Modal.Heading>
- {user && (
- <Description className="text-sm">
- {user.email}
- </Description>
- )}
- </Modal.Header>
- </motion.div>
- {user ? (
- <Button
- variant="secondary"
- className="w-full"
- isDisabled={disabled}
- onPress={() => void run("signout", signOutRecordly)}
- >
- <SignOut className="size-4" />
- {busy === "signout"
- ? t("editor.cloud.signingOut")
- : t("editor.cloud.signOut")}
- </Button>
- ) : (
- <>
- <motion.div
- {...reveal}
- transition={{
- ...transition,
- delay: reduceMotion ? 0 : 0.05,
- }}
- className="flex flex-col items-center gap-3"
- >
- <Button
- variant="secondary"
- size="lg"
- className="w-full gap-3"
- isDisabled={disabled || !configured}
- onPress={() =>
- void run("google", () =>
- signInWithSocial("google"),
- )
- }
- >
- <img
- src={`${import.meta.env.BASE_URL}auth/google-logo.png`}
- alt=""
- className="size-5 shrink-0"
- />
- Continue with Google
- </Button>
- <Button
- variant="secondary"
- size="lg"
- className="w-full gap-3"
- isDisabled={disabled || !configured}
- onPress={() =>
- void run("azure", () =>
- signInWithSocial("azure"),
- )
- }
+ {!feature && (
+ <motion.div
+ layout="position"
+ transition={transition}
+ className={`flex flex-1 flex-col justify-center px-5 py-6 sm:px-8 ${wide ? "md:order-1 md:min-w-0" : ""}`}
+ >
+ <div className="w-full max-w-[420px] self-center space-y-4 @container">
+ <motion.div {...reveal}>
+ <Modal.Header className="items-center gap-3 text-center">
+ <div
+ className="flex items-center gap-3"
+ aria-label="Recordly"
>
<img
- src={`${import.meta.env.BASE_URL}auth/microsoft-logo.svg`}
+ src={`${import.meta.env.BASE_URL}app-icons/recordly-128.png`}
alt=""
- className="size-5 shrink-0"
+ className="size-12 rounded-xl"
/>
- Continue with Microsoft
- </Button>
- </motion.div>
- <div className="flex items-center gap-4">
- <Separator className="flex-1" />
- <span className="text-xs text-muted">
- or continue with email
- </span>
- <Separator className="flex-1" />
- </div>
- <Form className="flex flex-col" onSubmit={submitEmail}>
- <TextField
- name="email"
- type="email"
- value={email}
- onChange={(value) => {
- setEmail(value);
- setMessage(undefined);
- if (!value.trim()) setPassword("");
+ <span className="text-3xl font-semibold tracking-tight">
+ Recordly
+ </span>
+ </div>
+ <Modal.Heading className="whitespace-nowrap text-[clamp(12px,5cqw,22px)] font-semibold leading-tight tracking-tight">
+ {user
+ ? "Your account"
+ : "Beautiful, shareable screen recordings"}
+ </Modal.Heading>
+ <Description className="text-sm">
+ {user ? user.email : "Sign in to get started"}
+ </Description>
+ </Modal.Header>
+ </motion.div>
+ {user && onboarding ? (
+ <Button
+ variant="primary"
+ className="w-full"
+ onPress={() => setFeatureStep(0)}
+ >
+ Continue
+ </Button>
+ ) : user ? (
+ <Button
+ variant="secondary"
+ className="w-full"
+ isDisabled={disabled}
+ onPress={() => void run("signout", signOutRecordly)}
+ >
+ <SignOut className="size-4" />
+ {busy === "signout"
+ ? t("editor.cloud.signingOut")
+ : t("editor.cloud.signOut")}
+ </Button>
+ ) : (
+ <>
+ <motion.div
+ {...reveal}
+ transition={{
+ ...transition,
+ delay: reduceMotion ? 0 : 0.05,
}}
- isRequired
- isDisabled={disabled}
+ className="grid grid-cols-3 gap-2"
>
- <Label>Email</Label>
- <Input
- className="h-12"
- placeholder="[email protected]"
- autoComplete="email"
- />
- <FieldError />
- </TextField>
- <AnimatePresence initial={false}>
- {expanded && (
- <motion.div
- key="password-fields"
- initial={{ height: 0, opacity: 0 }}
- animate={{ height: "auto", opacity: 1 }}
- exit={{ height: 0, opacity: 0 }}
- transition={transition}
- className="overflow-hidden"
- inert={!expanded}
+ {(
+ [
+ {
+ provider: "google",
+ label: "Google",
+ image: "google-logo.png",
+ },
+ {
+ provider: "azure",
+ label: "Microsoft",
+ image: "microsoft-logo.svg",
+ },
+ {
+ provider: "github",
+ label: "GitHub",
+ image: null,
+ },
+ ] as const
+ ).map(({ provider, label, image }) => (
+ <Button
+ key={provider}
+ variant="secondary"
+ aria-label={`Continue with ${label}`}
+ className="h-11 w-full min-w-0 gap-2 rounded-xl px-2 text-xs font-medium text-foreground @[360px]:text-sm"
+ isDisabled={disabled || !configured}
+ onPress={() =>
+ void run(provider, () =>
+ signInWithSocial(provider),
+ )
+ }
>
+ {image ? (
+ <img
+ src={`${import.meta.env.BASE_URL}auth/${image}`}
+ alt=""
+ className="size-4 shrink-0"
+ />
+ ) : (
+ <GithubLogo
+ aria-hidden="true"
+ weight="fill"
+ className="size-4 shrink-0"
+ />
+ )}
+ {label}
+ </Button>
+ ))}
+ </motion.div>
+ <div className="flex items-center gap-4">
+ <Separator className="flex-1" />
+ <span className="text-xs text-muted">
+ or continue with email
+ </span>
+ <Separator className="flex-1" />
+ </div>
+ <Form className="flex flex-col" onSubmit={submitEmail}>
+ <TextField
+ name="email"
+ type="email"
+ value={email}
+ onChange={(value) => {
+ setEmail(value);
+ setLinkSent(false);
+ setMessage(undefined);
+ if (!value.trim()) setPassword("");
+ }}
+ isRequired
+ isDisabled={disabled}
+ >
+ <Label>Email</Label>
+ <Input
+ className="h-12"
+ placeholder="[email protected]"
+ autoComplete="email"
+ />
+ <FieldError />
+ </TextField>
+ {!demoEmail && (
+ <Button
+ type="submit"
+ variant="primary"
+ className="mt-3 h-12 w-full"
+ isDisabled={disabled || !configured}
+ >
+ {busy === "link"
+ ? "Sending sign-in link…"
+ : "Email me a magic link"}
+ </Button>
+ )}
+ <AnimatePresence initial={false}>
+ {expanded && demoEmail && (
<motion.div
- initial={{ y: reduceMotion ? 0 : -8 }}
- animate={{ y: 0 }}
- exit={{ y: reduceMotion ? 0 : -8 }}
+ key="password-fields"
+ initial={{ height: 0, opacity: 0 }}
+ animate={{ height: "auto", opacity: 1 }}
+ exit={{ height: 0, opacity: 0 }}
transition={transition}
- className="flex flex-col gap-5 px-1 pb-1 pt-5"
+ className="overflow-hidden"
+ inert={!expanded}
>
- <TextField
- name="password"
- type="password"
- value={password}
- onChange={setPassword}
- isRequired
- isDisabled={disabled}
+ <motion.div
+ initial={{
+ y: reduceMotion ? 0 : -8,
+ }}
+ animate={{ y: 0 }}
+ exit={{ y: reduceMotion ? 0 : -8 }}
+ transition={transition}
+ className="flex flex-col gap-5 px-1 pb-1 pt-5"
>
- <Label>Password</Label>
- <Input
- className="h-12"
- autoComplete="current-password"
- />
- <FieldError />
- </TextField>
- {configured && (
- <Button
- variant="ghost"
- size="sm"
- className="-mt-3 self-end"
+ <TextField
+ name="password"
+ type="password"
+ value={password}
+ onChange={setPassword}
+ isRequired
isDisabled={disabled}
- onPress={forgotPassword}
>
- {t(
- "editor.cloud.forgotPassword",
- )}
+ <Label>Password</Label>
+ <Input
+ className="h-12"
+ autoComplete="current-password"
+ />
+ <FieldError />
+ </TextField>
+ <Button
+ type="submit"
+ size="lg"
+ className="w-full"
+ isDisabled={
+ disabled ||
+ (!configured &&
+ !demoLoginEnabled)
+ }
+ >
+ {busy === "email"
+ ? t(
+ "editor.cloud.signingIn",
+ )
+ : "Sign in"}
</Button>
- )}
- <Button
- type="submit"
- size="lg"
- className="w-full"
- isDisabled={
- disabled ||
- (!configured &&
- !demoLoginEnabled)
- }
- >
- {busy === "email"
- ? t("editor.cloud.signingIn")
- : "Sign in"}
- </Button>
+ </motion.div>
</motion.div>
- </motion.div>
- )}
- </AnimatePresence>
- </Form>
- </>
- )}
- {message || callbackError ? (
- <Alert
- status={resetSent && !callbackError ? "success" : "danger"}
- >
- <Alert.Indicator />
- <Alert.Content>
- <Alert.Description>
- {message || callbackError}
- </Alert.Description>
- </Alert.Content>
- </Alert>
- ) : null}
- {!configured && !demoLoginEnabled && !user && (
- <Description role="status">
- {t("editor.cloud.unavailable")}
- </Description>
- )}
- </div>
- </motion.div>
+ )}
+ </AnimatePresence>
+ </Form>
+ </>
+ )}
+ {onboarding && !user && (
+ <Button
+ variant="ghost"
+ className="w-full"
+ onPress={() => setFeatureStep(0)}
+ >
+ Continue without signing in
+ </Button>
+ )}
+ {message || callbackError ? (
+ <Alert
+ status={
+ linkSent && !callbackError ? "success" : "danger"
+ }
+ >
+ <Alert.Indicator />
+ <Alert.Content>
+ <Alert.Description>
+ {message || callbackError}
+ </Alert.Description>
+ </Alert.Content>
+ </Alert>
+ ) : null}
+ {!configured && !demoLoginEnabled && !user && (
+ <Description role="status">
+ {t("editor.cloud.unavailable")}
+ </Description>
+ )}
+ </div>
+ </motion.div>
+ )}
</MotionDialog>
</Modal.Container>
</Modal.Backdrop>
diff --git a/src/components/video-editor/SettingsPanel.tsx b/src/components/video-editor/SettingsPanel.tsx
index 9ea6279d..6a66c552 100644
--- a/src/components/video-editor/SettingsPanel.tsx
+++ b/src/components/video-editor/SettingsPanel.tsx
@@ -419,6 +419,7 @@ function CursorClickEffectCards({
}
interface SettingsPanelProps {
+ onShowOnboarding?: () => void;
advanced?: boolean;
panelMode?: "editor" | "background";
activeEffectSection?: EditorEffectSection;
@@ -875,6 +876,7 @@ function CursorStylePreview({
}
export function SettingsPanel({
+ onShowOnboarding,
advanced = false,
panelMode = "editor",
activeEffectSection: activeEffectSectionProp,
@@ -2251,6 +2253,14 @@ export function SettingsPanel({
categories={advanced ? ["general", "motion", "advanced"] : ["general", "motion"]}
>
<SettingsCategory category="general">
+ {onShowOnboarding && (
+ <SettingsRow title="Onboarding">
+ <Button variant="secondary" size="sm" onClick={onShowOnboarding}>
+ Show onboarding
+ </Button>
+ </SettingsRow>
+ )}
+
<SettingsRow title={t("editor.theme.appearance", "Appearance")} stacked>
<ChoiceGroup
type="single"
diff --git a/src/components/video-editor/layout/EditorShell.tsx b/src/components/video-editor/layout/EditorShell.tsx
index d7a6037c..812465f9 100644
--- a/src/components/video-editor/layout/EditorShell.tsx
+++ b/src/components/video-editor/layout/EditorShell.tsx
@@ -1,3 +1,4 @@
+import { OnboardingController } from "@/components/auth/OnboardingController";
import { AccountProfileContext } from "@/components/ui/account-avatar";
import { DashboardSettingsContext } from "../dashboard/DashboardSettings";
import { RecordlySignInDialog, type SignInReason } from "@/components/auth/RecordlySignInDialog";
@@ -55,6 +56,8 @@ type Props = {
};
export function EditorShell(props: Props) {
+ const [onboardingRequest, setOnboardingRequest] = useState(0);
+ const showOnboarding = useCallback(() => setOnboardingRequest((value) => value + 1), []);
const [signInOpen, setSignInOpen] = useState(false);
const [signInReason, setSignInReason] = useState<SignInReason>("account");
const [shareRequestNonce, setShareRequestNonce] = useState(0);
@@ -137,13 +140,23 @@ export function EditorShell(props: Props) {
() => (
<SettingsPanel
{...settingsPanelProps}
+ onShowOnboarding={showOnboarding}
activeEffectSection="settings"
selectedAnnotationId={null}
selectedClipId={null}
advanced
/>
),
- [settingsPanelProps],
+ [settingsPanelProps, showOnboarding],
+ );
+ const onboarding = (
+ <OnboardingController
+ requestNonce={onboardingRequest}
+ ready={!project.loading && !auth.loading}
+ user={auth.user}
+ configured={auth.configured}
+ callbackError={auth.callbackError}
+ />
);
const editorDialogs = (
<AccountProfileContext.Provider value={auth.user}>
@@ -202,6 +215,7 @@ export function EditorShell(props: Props) {
onAuthenticated={handleAuthenticated}
/>
{editorDialogs}
+ {onboarding}
<Toaster className="pointer-events-auto" />
</>
);
@@ -232,6 +246,7 @@ export function EditorShell(props: Props) {
onAuthenticated={handleAuthenticated}
/>
{editorDialogs}
+ {onboarding}
<Toaster className="pointer-events-auto" />
</div>
);
@@ -341,7 +356,10 @@ export function EditorShell(props: Props) {
timeline.setSelectedCaptionId(null);
ui.setActiveEffectSection(section);
}}
- settingsPanelProps={settingsPanelProps}
+ settingsPanelProps={{
+ ...settingsPanelProps,
+ onShowOnboarding: showOnboarding,
+ }}
/>
<EditorPreviewPanel
t={t}
@@ -434,6 +452,7 @@ export function EditorShell(props: Props) {
onAuthenticated={handleAuthenticated}
/>
{editorDialogs}
+ {onboarding}
<CropEditorDialog
open={ui.showCropModal}
t={t}
diff --git a/src/lib/auth/recordlyAuth.test.ts b/src/lib/auth/recordlyAuth.test.ts
index b5416867..7df0cb16 100644
--- a/src/lib/auth/recordlyAuth.test.ts
+++ b/src/lib/auth/recordlyAuth.test.ts
@@ -1,5 +1,6 @@
import { afterEach, beforeEach, expect, it, vi } from "vitest";
+const emailOtp = vi.hoisted(() => vi.fn(async (_options: unknown) => ({ error: null })));
const exchange = vi.hoisted(() => vi.fn(async (_code: string) => ({ error: null })));
const oauth = vi.hoisted(() =>
vi.fn(async (_options: unknown) => ({
@@ -8,12 +9,15 @@ const oauth = vi.hoisted(() =>
})),
);
vi.mock("@supabase/supabase-js", () => ({
- createClient: () => ({ auth: { exchangeCodeForSession: exchange, signInWithOAuth: oauth } }),
+ createClient: () => ({
+ auth: { exchangeCodeForSession: exchange, signInWithOAuth: oauth, signInWithOtp: emailOtp },
+ }),
}));
beforeEach(() => {
vi.resetModules();
exchange.mockClear();
oauth.mockClear();
+ emailOtp.mockClear();
vi.stubEnv("VITE_SUPABASE_URL", "https://auth.example.test");
vi.stubEnv("VITE_SUPABASE_PUBLISHABLE_KEY", "test-key");
});
@@ -53,3 +57,28 @@ it("requests Microsoft's email scope and opens its OAuth URL externally", async
);
expect(openExternalUrl).toHaveBeenCalledExactlyOnceWith("https://auth.example.test/oauth");
});
+
+for (const dev of [true, false]) {
+ it(`requests an app-initiated email link with the ${dev ? "development" : "installed"} callback`, async () => {
+ vi.stubEnv("DEV", dev);
+ const { sendSignInLink } = await import("./recordlyAuth");
+ await sendSignInLink("[email protected]");
+ expect(emailOtp).toHaveBeenCalledExactlyOnceWith({
+ email: "[email protected]",
+ options: {
+ emailRedirectTo: dev
+ ? "http://127.0.0.1:43821/auth/callback"
+ : "recordly://auth/callback",
+ shouldCreateUser: true,
+ },
+ });
+ });
+}
+
+it("does not accept dashboard implicit session tokens as a PKCE callback", async () => {
+ const { completeAuthCallback } = await import("./recordlyAuth");
+ await expect(
+ completeAuthCallback("recordly://auth/callback#access_token=test&refresh_token=test"),
+ ).rejects.toThrow("Request a new sign-in link from Recordly");
+ expect(exchange).not.toHaveBeenCalled();
+});
diff --git a/src/lib/auth/recordlyAuth.ts b/src/lib/auth/recordlyAuth.ts
index 38c16fa9..8b36b787 100644
--- a/src/lib/auth/recordlyAuth.ts
+++ b/src/lib/auth/recordlyAuth.ts
@@ -42,6 +42,15 @@ export async function signInWithEmail(email: string, password: string): Promise<
return data.user;
}
+export async function sendSignInLink(email: string): Promise<void> {
+ const client = requireAuth();
+ const { error } = await client.auth.signInWithOtp({
+ email,
+ options: { emailRedirectTo: callbackUrl, shouldCreateUser: true },
+ });
+ if (error) throw error;
+}
+
export async function sendPasswordReset(email: string): Promise<void> {
const client = requireAuth();
const { error } = await client.auth.resetPasswordForEmail(email, { redirectTo: callbackUrl });
@@ -54,7 +63,7 @@ async function openAuthUrl(url: string | null) {
if (!result.success) throw new Error(result.error || "Could not open the sign-in page.");
}
-export async function signInWithSocial(provider: "google" | "azure"): Promise<void> {
+export async function signInWithSocial(provider: "google" | "azure" | "github"): Promise<void> {
const client = requireAuth();
const { data, error } = await client.auth.signInWithOAuth({
provider: provider as Provider,
@@ -85,7 +94,9 @@ async function exchangeAuthCallback(url: string): Promise<void> {
const providerError = params.get("error_description") || params.get("error");
if (providerError) throw new Error(providerError);
const code = params.get("code");
- if (!code) throw new Error("The sign-in callback did not include an authorization code.");
+ if (!code) {
+ throw new Error("Request a new sign-in link from Recordly, then open it on this computer.");
+ }
const client = requireAuth();
const { error } = await client.auth.exchangeCodeForSession(code);
if (error) throw error;
diff --git a/tests/ui/bridge.ts b/tests/ui/bridge.ts
index 477a6e17..4927b610 100644
--- a/tests/ui/bridge.ts
+++ b/tests/ui/bridge.ts
@@ -11,7 +11,7 @@ export async function installDesktopBridge(page: Page, videoFixture = "preview.m
};
Object.assign(window, {
electronAPI: {
- getAppSetting: () => null,
+ getAppSetting: (key: string) => key === "recordly.onboarding.v1.seen" ? true : null,
finishRecordingStartup: async () => undefined,
showProjectDashboard: async () => {
document.documentElement.dataset.dashboardOpened = "true";
diff --git a/tests/ui/onboarding.spec.ts b/tests/ui/onboarding.spec.ts
new file mode 100644
index 00000000..d677b9bc
--- /dev/null
+++ b/tests/ui/onboarding.spec.ts
@@ -0,0 +1,94 @@
+import { expect, test } from "@playwright/test";
+import { installDesktopBridge } from "./bridge";
+
+test("settings button replays login and the expanding feature tour", async ({ page }) => {
+ await installDesktopBridge(page);
+ await page.goto("/?windowType=editor");
+ await expect(page.getByRole("button", { name: "Home", exact: true })).toBeVisible();
+ await page.getByRole("radio", { name: "Settings", exact: true }).click();
+ await page.getByRole("button", { name: "Show onboarding" }).click();
+ const tour = page.getByRole("dialog", { name: "Welcome to Recordly" });
+ await expect(tour).toHaveAttribute("data-onboarding-state", "login");
+ await expect(tour.getByText("Sign in to get started", { exact: true })).toBeVisible();
+ await expect(tour.getByRole("button", { name: "Email me a magic link" })).toBeVisible();
+ await tour.getByPlaceholder("[email protected]").fill("[email protected]");
+ await expect(tour.getByRole("button", { name: "Email me a magic link" })).toBeVisible();
+ await expect
+ .poll(() => tour.evaluate((element) => getComputedStyle(element).opacity))
+ .toBe("1");
+ await page.screenshot({ path: "test-results/onboarding-login.png", animations: "disabled" });
+ const artwork = tour.locator("[data-onboarding-artwork]");
+ const loginWidth = (await artwork.boundingBox())!.width;
+ await tour.getByRole("button", { name: "Continue without signing in" }).click();
+ await expect(tour).toHaveAttribute("data-onboarding-state", "feature");
+ await expect(tour.getByRole("heading", { name: "Start with a moment." })).toBeVisible();
+ await expect
+ .poll(async () => (await artwork.boundingBox())!.width)
+ .toBeGreaterThan(loginWidth * 1.7);
+ await expect(artwork).toHaveCSS("transform", "none");
+ await expect(artwork.locator(":scope > img")).toHaveCSS("transform", "none");
+ await page.screenshot({ path: "test-results/onboarding-record.png", animations: "disabled" });
+ await tour.getByRole("button", { name: "Next", exact: true }).click();
+ await expect(tour.getByRole("heading", { name: "Make it yours." })).toBeVisible();
+ await tour.getByRole("button", { name: "Next", exact: true }).click();
+ await expect(tour.getByRole("heading", { name: "Ready when you are." })).toBeVisible();
+ await tour.getByRole("button", { name: "Get started" }).click();
+ await expect(tour).not.toBeVisible();
+ await page.getByRole("radio", { name: "Settings", exact: true }).click();
+ await page.getByRole("button", { name: "Show onboarding" }).click();
+ await expect(tour).toHaveAttribute("data-onboarding-state", "login");
+});
+
+test("first launch persists completion and signed-in users can continue", async ({ page }) => {
+ await installDesktopBridge(page);
+ await page.addInitScript(() => {
+ window.electronAPI.getAppSetting = (key) => JSON.parse(localStorage.getItem(key) || "null");
+ window.electronAPI.setAppSetting = (key, value) => {
+ localStorage.setItem(key, JSON.stringify(value));
+ return true;
+ };
+ sessionStorage.setItem("recordly.demo-session", "1");
+ });
+ await page.goto("/?windowType=editor");
+ const tour = page.getByRole("dialog", { name: "Welcome to Recordly" });
+ await tour.getByRole("button", { name: "Continue", exact: true }).click();
+ await tour.getByRole("button", { name: "Next", exact: true }).click();
+ await tour.getByRole("button", { name: "Next", exact: true }).click();
+ await tour.getByRole("button", { name: "Get started" }).click();
+ await expect
+ .poll(() => page.evaluate(() => localStorage.getItem("recordly.onboarding.v1.seen")))
+ .toBe("true");
+ await page.reload();
+ await expect(page.getByRole("button", { name: "Home", exact: true })).toBeVisible();
+ await expect(tour).not.toBeVisible();
+});
+
+test("feature banner fits a compact window with reduced motion", async ({ page }) => {
+ await installDesktopBridge(page);
+ await page.setViewportSize({ width: 620, height: 740 });
+ await page.emulateMedia({ reducedMotion: "reduce" });
+ await page.goto("/?windowType=editor");
+ await expect(page.getByRole("button", { name: "Home", exact: true })).toBeVisible();
+ await page.getByRole("radio", { name: "Settings", exact: true }).click();
+ await page.getByRole("button", { name: "Show onboarding" }).click();
+ const tour = page.getByRole("dialog", { name: "Welcome to Recordly" });
+ await tour.getByRole("button", { name: "Continue without signing in" }).click();
+ await expect(tour.getByRole("button", { name: "Next", exact: true })).toBeInViewport();
+ await page.screenshot({ path: "test-results/onboarding-compact.png" });
+ await tour.getByRole("button", { name: "Back to sign in" }).click();
+ await expect(tour).toHaveAttribute("data-onboarding-state", "login");
+});
+
+test("successful sign-in advances to Feature without closing onboarding", async ({ page }) => {
+ await installDesktopBridge(page);
+ await page.goto("/?windowType=editor");
+ await expect(page.getByRole("button", { name: "Home", exact: true })).toBeVisible();
+ await page.getByRole("radio", { name: "Settings", exact: true }).click();
+ await page.getByRole("button", { name: "Show onboarding" }).click();
+ const tour = page.getByRole("dialog", { name: "Welcome to Recordly" });
+ await tour.getByPlaceholder("[email protected]").fill("[email protected]");
+ await tour.locator('input[type="password"]').fill("1234");
+ await tour.getByRole("button", { name: "Sign in", exact: true }).click();
+ await expect(tour).toHaveAttribute("data-onboarding-state", "feature");
+ await expect(tour.getByRole("heading", { name: "Start with a moment." })).toBeVisible();
+});
diff --git a/vite.config.ts b/vite.config.ts
index 18e57e80..0e20a5fe 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -111,6 +111,8 @@ export default defineConfig(({ mode }) => ({
},
optimizeDeps: {
entries: ["index.html"],
+ // React Aria imports this CommonJS shim through its ESM collection modules.
+ include: ["use-sync-external-store/shim"],
exclude: [
"react-icons/bs",
"react-icons/fa",