Skip to content

Open source CapCut alternative.

TypeScript

fix(site): show the Download button in the header only on the main landing page

David Lee637290d18ab
diff --git a/site/src/app/_components/landing/AuthScreen.tsx b/site/src/app/_components/landing/AuthScreen.tsx
index 3b42000a..a4f2dffa 100644
--- a/site/src/app/_components/landing/AuthScreen.tsx
+++ b/site/src/app/_components/landing/AuthScreen.tsx
@@ -138,10 +138,10 @@ export function AuthScreen({ mode }: Props) {
return (
<main className="min-h-screen w-full bg-background font-system text-ink antialiased">
<TopNav
- ctaHref={screenCopy.alternateHref}
- ctaLabel={copy[otherMode].title}
- showAuthLinks={false}
- ctaShowArrow={false}
+ authToggle={{
+ href: screenCopy.alternateHref,
+ label: copy[otherMode].title,
+ }}
/>
<section className="mx-auto grid w-full max-w-[1400px] grid-cols-1 justify-items-center gap-16 px-6 pt-[44px] pb-[240px] text-center min-[900px]:gap-24 min-[900px]:px-12 min-[900px]:pt-[72px] min-[900px]:pb-[360px]">
<div>
diff --git a/site/src/app/_components/landing/DonkeyLanding.tsx b/site/src/app/_components/landing/DonkeyLanding.tsx
index 854b40d5..ab7f403c 100644
--- a/site/src/app/_components/landing/DonkeyLanding.tsx
+++ b/site/src/app/_components/landing/DonkeyLanding.tsx
@@ -25,7 +25,7 @@ export default function DonkeyLanding() {
WebkitFontSmoothing: "antialiased",
}}
>
- <TopNav />
+ <TopNav showDownload />
<Hero />
<TrustedBy />
<Solutions />
diff --git a/site/src/app/_components/landing/PricingPage.tsx b/site/src/app/_components/landing/PricingPage.tsx
index 3789a2b1..c59c8160 100644
--- a/site/src/app/_components/landing/PricingPage.tsx
+++ b/site/src/app/_components/landing/PricingPage.tsx
@@ -13,7 +13,7 @@ import { pricingPlans } from "@/app/_components/landing/pricingPlans";
export function PricingPage() {
return (
<main className="min-h-screen w-full max-w-full overflow-x-hidden bg-background font-system text-ink antialiased">
- <TopNav ctaHref="/sign-in" ctaLabel="Log in" ctaShowArrow={false} />
+ <TopNav />
<section className="mx-auto w-full max-w-[1400px] px-6 pt-[44px] pb-12 md:px-12 md:pt-[72px] md:pb-16">
<h1 className="max-w-[700px] text-[52px] leading-[0.9] font-semibold tracking-normal break-words md:max-w-[1304px] md:text-[112px]">
Pick the plan.
diff --git a/site/src/app/_components/landing/TopNav.tsx b/site/src/app/_components/landing/TopNav.tsx
index da0bfc61..100cc74f 100644
--- a/site/src/app/_components/landing/TopNav.tsx
+++ b/site/src/app/_components/landing/TopNav.tsx
@@ -13,21 +13,20 @@ import { cn } from "@/lib/utils";
const NAV_ICON_SIZE = 59;
type Props = {
- ctaHref?: string;
- ctaLabel?: string;
homeHref?: string;
+ // Log in + Sign up cluster. Hidden when an authToggle is supplied.
showAuthLinks?: boolean;
- // The arrow accent is reserved for the download CTA; non-download CTAs
- // (Log in, Get started, auth toggles) pass false.
- ctaShowArrow?: boolean;
+ // The Download pill belongs to the main landing page only.
+ showDownload?: boolean;
+ // Sign-in/up pages swap the auth links for a single toggle to the other mode.
+ authToggle?: { href: string; label: string };
};
export function TopNav({
- ctaHref = DONKEY_INSTALL_URL,
- ctaLabel = "Download",
homeHref = "/",
showAuthLinks = true,
- ctaShowArrow = true,
+ showDownload = false,
+ authToggle,
}: 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
@@ -78,6 +77,13 @@ export function TopNav({
<PillButton href="/app" variant="secondary" size="sm">
Dashboard
</PillButton>
+ ) : authToggle ? (
+ <Link
+ href={authToggle.href}
+ className="whitespace-nowrap text-sm font-semibold text-ink no-underline"
+ >
+ {authToggle.label}
+ </Link>
) : (
<>
{showAuthLinks ? (
@@ -95,23 +101,14 @@ export function TopNav({
</span>
</>
) : null}
- {ctaShowArrow ? (
+ {showDownload ? (
<span className="hidden md:inline-flex">
- <PillButton href={ctaHref} variant="dark" size="sm">
- {ctaLabel}
+ <PillButton href={DONKEY_INSTALL_URL} variant="dark" size="sm">
+ Download
<ArrowRight size={14} />
</PillButton>
</span>
- ) : (
- // Non-download CTAs (auth toggles) read as a plain text link,
- // matching the "Log in" link on the home page.
- <Link
- href={ctaHref}
- className="whitespace-nowrap text-sm font-semibold text-ink no-underline"
- >
- {ctaLabel}
- </Link>
- )}
+ ) : null}
</>
)}
</div>
diff --git a/site/src/app/install/page.tsx b/site/src/app/install/page.tsx
index 5f591fb3..e4a6989d 100644
--- a/site/src/app/install/page.tsx
+++ b/site/src/app/install/page.tsx
@@ -2,7 +2,6 @@ import type { Metadata } from "next";
import { Footer } from "@/app/_components/landing/Footer";
import { TopNav } from "@/app/_components/landing/TopNav";
-import { DONKEY_DOWNLOAD_URL } from "@/app/_components/landing/data";
import { BG, BLACK } from "@/app/_components/landing/theme";
import { InstallInstructions } from "@/app/install/_components/InstallInstructions";
@@ -24,7 +23,7 @@ export default function InstallPage() {
WebkitFontSmoothing: "antialiased",
}}
>
- <TopNav ctaHref={DONKEY_DOWNLOAD_URL} ctaLabel="Download" />
+ <TopNav />
<InstallInstructions />
<Footer />
</main>