Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

[Feature]: Replace Join The Waitlist CTA button when user is authenticated (#1002)

Dharmik Jadave8042ed98a73
diff --git a/apps/web/src/app/[locale]/_components/hero.tsx b/apps/web/src/app/[locale]/_components/hero.tsx
index cbbc4753..462d5f3e 100644
--- a/apps/web/src/app/[locale]/_components/hero.tsx
+++ b/apps/web/src/app/[locale]/_components/hero.tsx
@@ -1,10 +1,11 @@
-import { Github, Mail, Sparkle, Twitter } from '@repo/ui/icons';
+import { Compass, Github, Mail, Sparkle, Twitter } from '@repo/ui/icons';
import Link from 'next/link';
import { Balancer } from 'react-wrap-balancer';
import { Button } from '@repo/ui/components/button';
import { HeroIllustration, BackgroundGrid } from './hero-illustration';
import { getScopedI18n } from '~/locales/server';
import { Ghost } from './hero-ghost';
+import { getServerAuthSession } from '@repo/auth/server';
function TypeHeroLogo3D() {
return (
@@ -145,7 +146,7 @@ function BeamOfLight() {
export async function Hero() {
const t = await getScopedI18n('landing.hero');
-
+ const session = await getServerAuthSession();
return (
<section className="-mt-[56px] min-h-[calc(100vh)] overflow-hidden lg:min-h-0 lg:pt-[56px]">
<Ghost />
@@ -184,28 +185,60 @@ export async function Hero() {
<Balancer>{t('description')}</Balancer>
</p>
<div className="flex flex-col-reverse gap-3 md:flex-row">
- <Button
- asChild
- className="hero-join-button group relative mx-auto w-fit overflow-hidden rounded-xl p-[2px] font-bold transition-all duration-300 hover:bg-transparent hover:shadow-[0_0_2rem_-0.5rem_#FFB800] dark:hidden md:mr-0 lg:mr-auto"
- >
- <Link href="/waitlist">
- <span className="inline-flex h-full w-fit items-center gap-1 rounded-[10px] bg-white px-4 py-2 text-[#FFB800] transition-all duration-300">
- <Mail className="mr-1 h-4 w-4 stroke-[3]" />
- {t('buttons.waitlist')}
- </span>
- </Link>
- </Button>
- <Button
- asChild
- className="hero-join-button-dark group relative mx-auto hidden w-fit overflow-hidden rounded-xl p-[1px] font-bold transition-all duration-300 dark:block dark:hover:shadow-[0_0_2rem_-0.5rem_#fff8] md:mr-0 lg:mr-auto"
- >
- <Link href="/waitlist">
- <span className="inline-flex h-full w-fit items-center gap-1 rounded-xl px-4 py-2 transition-all duration-300 dark:bg-neutral-900 dark:text-white group-hover:dark:bg-black">
- <Mail className="mr-1 h-4 w-4 stroke-[3]" />
- {t('buttons.waitlist')}
- </span>
- </Link>
- </Button>
+ {!session && (
+ <Button
+ asChild
+ className="hero-join-button group relative mx-auto w-fit overflow-hidden rounded-xl p-[2px] font-bold transition-all duration-300 hover:bg-transparent hover:shadow-[0_0_2rem_-0.5rem_#FFB800] dark:hidden md:mr-0 lg:mr-auto"
+ >
+ <Link href="/waitlist">
+ <span className="inline-flex h-full w-fit items-center gap-1 rounded-[10px] bg-white px-4 py-2 text-[#FFB800] transition-all duration-300">
+ <Mail className="mr-1 h-4 w-4 stroke-[3]" />
+ {t('buttons.waitlist')}
+ </span>
+ </Link>
+ </Button>
+ )}
+ {!session && (
+ <Button
+ asChild
+ className="hero-join-button-dark group relative mx-auto hidden w-fit overflow-hidden rounded-xl p-[1px] font-bold transition-all duration-300 dark:block dark:hover:shadow-[0_0_2rem_-0.5rem_#fff8] md:mr-0 lg:mr-auto"
+ >
+ <Link href="/waitlist">
+ <span className="inline-flex h-full w-fit items-center gap-1 rounded-xl px-4 py-2 transition-all duration-300 dark:bg-neutral-900 dark:text-white group-hover:dark:bg-black">
+ <Mail className="mr-1 h-4 w-4 stroke-[3]" />
+ {t('buttons.waitlist')}
+ </span>
+ </Link>
+ </Button>
+ )}
+ {session ? (
+ <Button
+ asChild
+ className="hero-join-button group relative mx-auto w-fit overflow-hidden rounded-xl p-[2px] font-bold transition-all duration-300 hover:bg-transparent hover:shadow-[0_0_2rem_-0.5rem_#FFB800] dark:hidden md:mr-0 lg:mr-auto"
+ variant="outline"
+ >
+ <Link href="/explore">
+ <span className="inline-flex h-full w-fit items-center gap-2 rounded-[10px] bg-white px-4 py-2 text-[#FFB800] transition-all duration-300">
+ <Compass className="h-4 w-4" />
+ Explore
+ </span>
+ </Link>
+ </Button>
+ ) : null}
+ {session ? (
+ <Button
+ asChild
+ className="hero-join-button-dark group relative mx-auto hidden w-fit overflow-hidden rounded-xl p-[1px] font-bold transition-all duration-300 dark:block dark:hover:shadow-[0_0_2rem_-0.5rem_#fff8] md:mr-0 lg:mr-auto"
+ variant="outline"
+ >
+ <Link href="/explore">
+ <span className="inline-flex h-full w-fit items-center gap-2 rounded-xl px-4 py-2 transition-all duration-300 dark:bg-neutral-900 dark:text-white group-hover:dark:bg-black">
+ <Compass className="h-4 w-4" />
+ Explore
+ </span>
+ </Link>
+ </Button>
+ ) : null}
<div className="flex gap-3">
<Button
asChild
diff --git a/packages/ui/src/icons.ts b/packages/ui/src/icons.ts
index bf286dbd..635df175 100644
--- a/packages/ui/src/icons.ts
+++ b/packages/ui/src/icons.ts
@@ -19,6 +19,7 @@ export {
Circle,
Clipboard,
Command,
+ Compass,
Copy,
Diamond,
ExternalLink,