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.

SignedInHint

Steven Tey8333b0a797eb
diff --git a/apps/web/app/app.dub.co/(onboarding)/layout.tsx b/apps/web/app/app.dub.co/(onboarding)/layout.tsx
index 2e2d5102eb..acd1f82aad 100644
--- a/apps/web/app/app.dub.co/(onboarding)/layout.tsx
+++ b/apps/web/app/app.dub.co/(onboarding)/layout.tsx
@@ -1,45 +1,13 @@
-"use client";
-
import Toolbar from "@/ui/layout/toolbar/toolbar";
-import { PropsWithChildren, useState } from "react";
-import { usePathname } from "next/navigation";
-import { signOut, useSession } from "next-auth/react";
-import { Button } from "@dub/ui";
+import { PropsWithChildren } from "react";
+import { SignedInHint } from "./signed-in-hint";
export default function Layout({ children }: PropsWithChildren) {
- const pathname = usePathname();
- const isWorkspacePage = pathname === "/onboarding/workspace";
- const { data: session } = useSession();
- const [isLoading, setIsLoading] = useState(false);
-
return (
<>
{children}
<Toolbar show={["help"]} />
- {isWorkspacePage && (
- <div className="fixed bottom-0 left-0 z-40 m-5 flex flex-col gap-2">
- <div className="flex items-center gap-1 text-neutral-600 text-xs">
- You're signed in as{" "}
- {session ? (
- <b className="text-neutral-800">{session.user?.email}</b>
- ) : (
- <span className="h-3 w-32 rounded-md border border-neutral-300 bg-neutral-200" />
- )}
- </div>
- <Button
- variant="secondary"
- text="Sign in as a different user"
- onClick={() => {
- setIsLoading(true);
- signOut({
- callbackUrl: "/login",
- });
- }}
- loading={isLoading}
- className="h-8 text-xs rounded-lg px-3 shadow-sm w-fit"
- />
- </div>
- )}
+ <SignedInHint />
</>
);
}
diff --git a/apps/web/app/app.dub.co/(onboarding)/signed-in-hint.tsx b/apps/web/app/app.dub.co/(onboarding)/signed-in-hint.tsx
new file mode 100644
index 0000000000..7ace5fedbb
--- /dev/null
+++ b/apps/web/app/app.dub.co/(onboarding)/signed-in-hint.tsx
@@ -0,0 +1,35 @@
+"use client";
+
+import { Button } from "@dub/ui";
+import { signOut, useSession } from "next-auth/react";
+import { useState } from "react";
+
+export function SignedInHint() {
+ const { data: session } = useSession();
+ const [isLoading, setIsLoading] = useState(false);
+
+ return (
+ <div className="fixed bottom-0 left-0 z-40 m-5 flex flex-col gap-2">
+ <div className="flex items-center gap-1 text-xs text-neutral-600">
+ You're signed in as{" "}
+ {session ? (
+ <b className="text-neutral-800">{session.user?.email}</b>
+ ) : (
+ <span className="h-3 w-32 rounded-md border border-neutral-300 bg-neutral-200" />
+ )}
+ </div>
+ <Button
+ variant="secondary"
+ text="Sign in as a different user"
+ onClick={() => {
+ setIsLoading(true);
+ signOut({
+ callbackUrl: "/login",
+ });
+ }}
+ loading={isLoading}
+ className="h-8 w-fit rounded-lg px-3 text-xs shadow-sm"
+ />
+ </div>
+ );
+}