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.

Add NotFoundHint

Steven Tey76bab5593109
diff --git a/apps/web/app/not-found-hint.tsx b/apps/web/app/not-found-hint.tsx
new file mode 100644
index 0000000000..8bcfb42910
--- /dev/null
+++ b/apps/web/app/not-found-hint.tsx
@@ -0,0 +1,44 @@
+"use client";
+
+import { Button } from "@dub/ui";
+import { SessionProvider, signOut, useSession } from "next-auth/react";
+import Link from "next/link";
+import { useState } from "react";
+
+export function NotFoundHint() {
+ return (
+ <SessionProvider>
+ <NotFoundHintChild />
+ </SessionProvider>
+ );
+}
+
+function NotFoundHintChild() {
+ const { data: session } = useSession();
+ const [isLoading, setIsLoading] = useState(false);
+
+ return session ? (
+ <>
+ <p className="text-neutral-600">
+ You're signed in as{" "}
+ <b className="text-neutral-800">{session.user?.email}</b>.
+ </p>
+ <Button
+ text="Sign in as a different user"
+ onClick={() => {
+ setIsLoading(true);
+ signOut();
+ }}
+ loading={isLoading}
+ className="w-fit"
+ />
+ </>
+ ) : (
+ <Link
+ href="/"
+ className="flex h-9 w-fit items-center justify-center rounded-md border border-black bg-black px-4 text-sm text-white hover:bg-neutral-800 hover:ring-4 hover:ring-neutral-200"
+ >
+ Go back home
+ </Link>
+ );
+}
diff --git a/apps/web/app/not-found.tsx b/apps/web/app/not-found.tsx
index ef032749ad..0db7180fc1 100644
--- a/apps/web/app/not-found.tsx
+++ b/apps/web/app/not-found.tsx
@@ -1,6 +1,7 @@
import { NewBackground } from "@/ui/shared/new-background";
import { Wordmark } from "@dub/ui";
import Link from "next/link";
+import { NotFoundHint } from "./not-found-hint";
export default function NotFound() {
return (
@@ -12,12 +13,7 @@ export default function NotFound() {
<h1 className="font-display bg-gradient-to-r from-black to-neutral-600 bg-clip-text text-5xl font-semibold text-transparent">
404
</h1>
- <Link
- href="/"
- className="flex h-9 w-fit items-center justify-center rounded-md border border-black bg-black px-4 text-sm text-white hover:bg-neutral-800 hover:ring-4 hover:ring-neutral-200"
- >
- Go back home
- </Link>
+ <NotFoundHint />
</div>
<NewBackground showAnimation />
</>