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 user ID section

Steven Teyf9546ef21f86
diff --git a/apps/web/app/app.dub.co/(dashboard)/settings/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/settings/page-client.tsx
index 872359a769..edcde616ef 100644
--- a/apps/web/app/app.dub.co/(dashboard)/settings/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/settings/page-client.tsx
@@ -3,6 +3,7 @@
import DeleteAccountSection from "@/ui/account/delete-account";
import UpdateDefaultWorkspace from "@/ui/account/update-default-workspace";
import UploadAvatar from "@/ui/account/upload-avatar";
+import UserId from "@/ui/account/user-id";
import { Form } from "@dub/ui";
import { APP_NAME } from "@dub/utils";
import { useSession } from "next-auth/react";
@@ -72,6 +73,7 @@ export default function SettingsPageClient() {
}
/>
<UploadAvatar />
+ <UserId />
<UpdateDefaultWorkspace />
<DeleteAccountSection />
</>
diff --git a/apps/web/ui/account/user-id.tsx b/apps/web/ui/account/user-id.tsx
new file mode 100644
index 0000000000..9ca30c226f
--- /dev/null
+++ b/apps/web/ui/account/user-id.tsx
@@ -0,0 +1,36 @@
+"use client";
+
+import { CopyButton } from "@dub/ui";
+import { useSession } from "next-auth/react";
+
+export default function UserId() {
+ const { data: session } = useSession() as
+ | {
+ data: { user: { id: string } };
+ }
+ | { data: null };
+
+ return (
+ <>
+ <div className="rounded-lg border border-gray-200 bg-white">
+ <div className="relative flex flex-col space-y-6 p-5 sm:p-10">
+ <div className="flex flex-col space-y-3">
+ <h2 className="text-xl font-medium">Your User ID</h2>
+ <p className="text-sm text-gray-500">
+ This is your unique account identifier on Dub.
+ </p>
+ </div>
+ {session?.user?.id ? (
+ <div className="flex w-full max-w-md items-center justify-between rounded-md border border-gray-300 bg-white p-2">
+ <p className="text-sm text-gray-500">{session.user.id}</p>
+ <CopyButton value={session.user.id} className="rounded-md" />
+ </div>
+ ) : (
+ <div className="h-[2.35rem] w-full max-w-md animate-pulse rounded-md bg-gray-200" />
+ )}
+ </div>
+ <div className="h-14 rounded-b-lg border-t border-gray-200 bg-gray-50" />
+ </div>
+ </>
+ );
+}