Open source CapCut alternative.
TypeScript
feat(site): split the Cut nav auth entry into a Log in link and Sign up pill
David Le7c1be5a42f96
diff --git a/site/src/app/_components/landing/TopNav.tsx b/site/src/app/_components/landing/TopNav.tsxindex b473a428..e0e6789a 100644--- a/site/src/app/_components/landing/TopNav.tsx+++ b/site/src/app/_components/landing/TopNav.tsx@@ -21,9 +21,9 @@ type Props = {// Signed-in pill into the product. The Cut landing points it at the Cut// projects home, which lives under a different base per host.signedInPill?: { href: string; label: string };- // Signed-out pill into auth. The Cut landing shows a "Log in" pill here (the- // sign-in screen offers "Create account"), so the nav has a visible way in.- signedOutPill?: { href: string; label: string };+ // Signed-out auth cluster: a quiet "Log in" link next to a dominant+ // "Sign up" pill. The Cut landing wires both into the auth screens.+ signedOutAuth?: { logInHref: string; signUpHref: string };};export function TopNav({@@ -31,7 +31,7 @@ export function TopNav({wordmark = "Donkey",authToggle,signedInPill = { href: "/app", label: "Dashboard" },- signedOutPill,+ signedOutAuth,}: Props) {// Signed-in visitors don't need the auth links or the download CTA; the whole// right cluster collapses to a single white button into the product. During the@@ -83,10 +83,22 @@ export function TopNav({<PillButton href={signedInPill.href} variant="secondary" size="sm">{signedInPill.label}</PillButton>- ) : signedOutPill ? (- <PillButton href={signedOutPill.href} variant="secondary" size="sm">- {signedOutPill.label}- </PillButton>+ ) : signedOutAuth ? (+ <>+ <Link+ href={signedOutAuth.logInHref}+ className="whitespace-nowrap text-sm font-semibold text-ink no-underline"+ >+ Log in+ </Link>+ <PillButton+ href={signedOutAuth.signUpHref}+ variant="primary"+ size="sm"+ >+ Sign up+ </PillButton>+ </>) : authToggle ? (<Linkhref={authToggle.href}diff --git a/site/src/app/_components/landing/useAppEntryHref.ts b/site/src/app/_components/landing/useAppEntryHref.tsindex 12726c5a..0036a13f 100644--- a/site/src/app/_components/landing/useAppEntryHref.ts+++ b/site/src/app/_components/landing/useAppEntryHref.ts@@ -10,6 +10,12 @@ export function signInHrefFor(appTarget: string): string {return `/sign-in?callbackURL=${encodeURIComponent(appTarget)}`;}+// Sign-up mirror of signInHrefFor; the auth screens read callbackURL from the+// query string in either mode.+export function signUpHrefFor(appTarget: string): string {+ return `/sign-up?callbackURL=${encodeURIComponent(appTarget)}`;+}+// Where a landing CTA should actually go: straight into the app when signed in,// or to sign-in when signed out. During the initial (pending) client render the// session is unknown, matching the static server HTML, so CTAs render the appdiff --git a/site/src/app/cut/_components/landing/CutLanding.tsx b/site/src/app/cut/_components/landing/CutLanding.tsxindex 2e5b4c2e..c75b1031 100644--- a/site/src/app/cut/_components/landing/CutLanding.tsx+++ b/site/src/app/cut/_components/landing/CutLanding.tsx@@ -1,7 +1,10 @@"use client";import { TopNav } from "@/app/_components/landing/TopNav";-import { signInHrefFor } from "@/app/_components/landing/useAppEntryHref";+import {+ signInHrefFor,+ signUpHrefFor,+} from "@/app/_components/landing/useAppEntryHref";import { BG, BLACK } from "@/app/_components/landing/theme";import { CutFinalCTA } from "@/app/cut/_components/landing/CutFinalCTA";import { CutFooter } from "@/app/cut/_components/landing/CutFooter";@@ -14,7 +17,8 @@ import { CutWorksWith } from "@/app/cut/_components/landing/CutWorksWith";// with Cut-only content. `root` is "" on donkeycut.com and "/cut" in dev, so// links into the app resolve on either host. Every CTA into the app is gated on// session (useAppEntryHref): signed-out clicks route to sign-in first. The nav-// mirrors this — a "Log in" pill when signed out, "Go to App" when signed in.+// mirrors this — a "Log in" link with a "Sign up" pill when signed out,+// "Go to App" when signed in.export function CutLanding({ root }: { root: string }) {return (<main@@ -30,7 +34,10 @@ export function CutLanding({ root }: { root: string }) {homeHref={root || "/"}wordmark="Donkey Cut"signedInPill={{ href: `${root}/app`, label: "Go to App" }}- signedOutPill={{ href: signInHrefFor(`${root}/app`), label: "Log in" }}+ signedOutAuth={{+ logInHref: signInHrefFor(`${root}/app`),+ signUpHref: signUpHrefFor(`${root}/app`),+ }}/><CutHero root={root} /><CutWorksWith />