The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Add login button to header
Tim Wilson1a8df76e1ea3
diff --git a/apps/web/app/partners.dub.co/(apply)/apply/[programSlug]/application/page.tsx b/apps/web/app/partners.dub.co/(apply)/apply/[programSlug]/application/page.tsxindex cf647825f4..90b44b1f6b 100644--- a/apps/web/app/partners.dub.co/(apply)/apply/[programSlug]/application/page.tsx+++ b/apps/web/app/partners.dub.co/(apply)/apply/[programSlug]/application/page.tsx@@ -46,6 +46,7 @@ export default async function ApplicationPage({wordmark: program.wordmark,}}slug={programSlug}+ showApply={false}/><div className="p-6">{/* Hero section */}diff --git a/apps/web/app/partners.dub.co/(apply)/apply/[programSlug]/application/success/page.tsx b/apps/web/app/partners.dub.co/(apply)/apply/[programSlug]/application/success/page.tsxindex 670ca6735a..f86a94a913 100644--- a/apps/web/app/partners.dub.co/(apply)/apply/[programSlug]/application/success/page.tsx+++ b/apps/web/app/partners.dub.co/(apply)/apply/[programSlug]/application/success/page.tsx@@ -92,7 +92,8 @@ export default async function SuccessPage({wordmark: program.wordmark,}}slug={programSlug}- showButtons={false}+ showLogin={false}+ showApply={false}/><div className="p-6"><div className="grid grid-cols-1 gap-5 sm:pt-20">diff --git a/apps/web/app/partners.dub.co/(apply)/apply/[programSlug]/header.tsx b/apps/web/app/partners.dub.co/(apply)/apply/[programSlug]/header.tsxindex 0adb7e6290..d922751961 100644--- a/apps/web/app/partners.dub.co/(apply)/apply/[programSlug]/header.tsx+++ b/apps/web/app/partners.dub.co/(apply)/apply/[programSlug]/header.tsx@@ -3,17 +3,24 @@import { Button, useScroll, Wordmark } from "@dub/ui";import { cn } from "@dub/utils";import { Program } from "@prisma/client";+import { useSession } from "next-auth/react";import Link from "next/link";+import { useRouter } from "next/navigation";export function Header({program,slug,- showButtons = true,+ showLogin = true,+ showApply = true,}: {program: Pick<Program, "wordmark" | "logo">;slug: string;- showButtons?: boolean;+ showLogin?: boolean;+ showApply?: boolean;}) {+ const router = useRouter();+ const { data: session } = useSession();+const scrolled = useScroll(0);return (@@ -41,13 +48,25 @@ export function Header({)}</Link>- {showButtons && (- <Button- type="button"- text="Apply"- className="h-8 w-fit border-[var(--brand)] bg-[var(--brand)] hover:bg-[var(--brand)] hover:ring-[var(--brand-ring)]"- />- )}+ <div className="flex items-center gap-2">+ {showLogin && !session?.user && (+ <Button+ type="button"+ variant="outline"+ text="Log in"+ className="text-neutral-600"+ onClick={() => router.push(`/login?next=/apply/${slug}`)}+ />+ )}+ {showApply && (+ <Button+ type="button"+ text="Apply"+ className="h-8 w-fit border-[var(--brand)] bg-[var(--brand)] hover:bg-[var(--brand)] hover:ring-[var(--brand-ring)]"+ onClick={() => router.push(`/apply/${slug}/application`)}+ />+ )}+ </div></header>);}