Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

improve `NotFoundHint`

Steven Tey0615533aa4f7
diff --git a/apps/web/app/not-found-hint.tsx b/apps/web/app/not-found-hint.tsx
index ca3956f0e0..64ad7d5828 100644
--- a/apps/web/app/not-found-hint.tsx
+++ b/apps/web/app/not-found-hint.tsx
@@ -1,6 +1,6 @@
"use client";
-import { Button } from "@dub/ui";
+import { Button, LoadingSpinner } from "@dub/ui";
import { SessionProvider, signOut, useSession } from "next-auth/react";
import Link from "next/link";
import { useState } from "react";
@@ -14,36 +14,43 @@ export function NotFoundHint() {
}
function NotFoundHintChild() {
- const { data: session } = useSession();
+ const { data: session, status } = useSession();
const [isLoading, setIsLoading] = useState(false);
- if (!session) {
- return (
- <Link href="/">
- <Button text="Return home" />
- </Link>
- );
+ if (status === "loading") {
+ return <LoadingSpinner />;
}
return (
<>
- <div className="flex items-center gap-2 text-neutral-600">
- You're signed in as{" "}
- {session ? (
- <b className="text-neutral-800">{session.user?.email}.</b>
- ) : (
- <span className="h-5 w-40 rounded-md border border-neutral-300 bg-neutral-200" />
+ <h1 className="font-display bg-gradient-to-r from-black to-neutral-600 bg-clip-text text-5xl font-semibold text-transparent">
+ 404
+ </h1>
+ <div className="flex flex-col items-center gap-4">
+ {session && (
+ <p className="text-neutral-600">
+ You're signed in as{" "}
+ <b className="text-neutral-800">{session.user?.email}.</b>
+ </p>
)}
+ <div className="flex flex-col gap-2">
+ <Button
+ text="Sign in as a different user"
+ onClick={() => {
+ setIsLoading(true);
+ signOut();
+ }}
+ loading={isLoading}
+ />
+ <Link href="/workspaces">
+ <Button
+ text="View all my workspaces"
+ variant="outline"
+ className="mx-auto h-fit w-fit px-2 py-1 text-xs"
+ />
+ </Link>
+ </div>
</div>
- <Button
- text="Sign in as a different user"
- onClick={() => {
- setIsLoading(true);
- signOut();
- }}
- loading={isLoading}
- className="w-fit"
- />
</>
);
}
diff --git a/apps/web/app/not-found.tsx b/apps/web/app/not-found.tsx
index 0db7180fc1..7b3009db01 100644
--- a/apps/web/app/not-found.tsx
+++ b/apps/web/app/not-found.tsx
@@ -1,21 +1,34 @@
-import { NewBackground } from "@/ui/shared/new-background";
-import { Wordmark } from "@dub/ui";
+import { AuroraGradient } from "@/ui/shared/aurora-gradient";
+import { Grid, Wordmark } from "@dub/ui";
+import { cn } from "@dub/utils";
import Link from "next/link";
import { NotFoundHint } from "./not-found-hint";
export default function NotFound() {
return (
<>
- <div className="relative z-10 flex h-screen w-screen flex-col items-center justify-center gap-6">
+ <div className="absolute inset-0 isolate overflow-hidden bg-white">
+ <div
+ className={cn(
+ "absolute inset-y-0 left-1/2 w-[1200px] -translate-x-1/2",
+ "[mask-composite:intersect] [mask-image:linear-gradient(black,transparent_320px),linear-gradient(90deg,transparent,black_5%,black_95%,transparent)]",
+ )}
+ >
+ <Grid
+ cellSize={60}
+ patternOffset={[0.75, 0]}
+ className="text-neutral-200"
+ />
+ </div>
+ <AuroraGradient />
+ </div>
+
+ <div className="relative flex h-screen w-screen flex-col items-center justify-center gap-6">
<Link href="/" className="absolute left-4 top-3">
<Wordmark className="h-6" />
</Link>
- <h1 className="font-display bg-gradient-to-r from-black to-neutral-600 bg-clip-text text-5xl font-semibold text-transparent">
- 404
- </h1>
<NotFoundHint />
</div>
- <NewBackground showAnimation />
</>
);
}