+
+
+ {eyebrow}
+
+
{resolvedPanelTitle}
+
{resolvedPanelCopy}
+
+
+ {desktopAuthRequested ? (
+
+ Finish auth here and we'll send you back into the OpenWork desktop app.
+ {desktopRedirectUrl ? (
+
+
+
+
+ {desktopGrant ? (
+
+ ) : null}
+
+
+ If OpenWork does not open automatically, copy the sign-in link or one-time code and paste it into the OpenWork desktop app.
+
+
+ ) : null}
+
+ ) : null}
+
+
+
+ {!verificationRequired ? (
+
+
{authMode === "sign-in" ? "Need an account?" : "Already have an account?"}
+
+
+ ) : null}
+
+ {showAuthFeedback ? (
+
+
{authInfo}
+ {authError ?
{authError}
: null}
+ {!authError && verificationRequired ? (
+
+
+ Waiting for your verification code
+
+ ) : null}
+
+ ) : null}
+
+ );
+}
diff --git a/ee/apps/den-web/app/(den)/_components/auth-screen.tsx b/ee/apps/den-web/app/(den)/_components/auth-screen.tsx
index b4667e8d1..f4dbd3de4 100644
--- a/ee/apps/den-web/app/(den)/_components/auth-screen.tsx
+++ b/ee/apps/den-web/app/(den)/_components/auth-screen.tsx
@@ -2,44 +2,11 @@
import { PaperMeshGradient } from "@openwork/ui/react";
import { Dithering } from "@paper-design/shaders-react";
-import { ArrowRight, CheckCircle2 } from "lucide-react";
import { usePathname, useRouter } from "next/navigation";
-import { useEffect, useRef, useState } from "react";
+import { useEffect, useRef } from "react";
import { isSamePathname } from "../_lib/client-route";
import { useDenFlow } from "../_providers/den-flow-provider";
-
-function getDesktopGrant(url: string | null) {
- if (!url) return null;
- try {
- const parsed = new URL(url);
- const grant = parsed.searchParams.get("grant")?.trim() ?? "";
- return grant || null;
- } catch {
- return null;
- }
-}
-
-function GitHubLogo() {
- return (
-
@@ -92,45 +38,9 @@ export function AuthScreen() {
const router = useRouter();
const pathname = usePathname();
const routingRef = useRef(false);
- const [copiedDesktopField, setCopiedDesktopField] = useState<"link" | "code" | null>(null);
- const {
- authMode,
- setAuthMode,
- email,
- setEmail,
- password,
- setPassword,
- verificationCode,
- setVerificationCode,
- verificationRequired,
- authBusy,
- authInfo,
- authError,
- user,
- sessionHydrated,
- desktopAuthRequested,
- desktopRedirectUrl,
- desktopRedirectBusy,
- showAuthFeedback,
- submitAuth,
- submitVerificationCode,
- resendVerificationCode,
- cancelVerification,
- beginSocialAuth,
- resolveUserLandingRoute,
- } = useDenFlow();
- const desktopGrant = getDesktopGrant(desktopRedirectUrl);
+ const { user, sessionHydrated, desktopAuthRequested, resolveUserLandingRoute } = useDenFlow();
const hasResolvedSession = sessionHydrated && Boolean(user) && !desktopAuthRequested;
- const copyDesktopValue = async (field: "link" | "code", value: string | null) => {
- if (!value) return;
- await navigator.clipboard.writeText(value);
- setCopiedDesktopField(field);
- window.setTimeout(() => {
- setCopiedDesktopField((current) => (current === field ? null : current));
- }, 1800);
- };
-
useEffect(() => {
if (!hasResolvedSession || routingRef.current) {
return;
@@ -148,18 +58,6 @@ export function AuthScreen() {
});
}, [hasResolvedSession, pathname, resolveUserLandingRoute, router]);
- const panelTitle = verificationRequired
- ? "Verify your email."
- : authMode === "sign-up"
- ? "Create your Cloud account."
- : "Sign in to Cloud.";
-
- const panelCopy = verificationRequired
- ? "Enter the six-digit code from your inbox to finish setup."
- : authMode === "sign-up"
- ? "Start with email, GitHub, or Google."
- : "Welcome back. Keep your team setup in sync across Cloud and desktop.";
-
if (!sessionHydrated) {
return (
@@ -241,212 +139,7 @@ export function AuthScreen() {
body="We found your account and are sending you to the right Cloud destination now."
/>
) : (
-
-
-
- Account
-
-
{panelTitle}
-
{panelCopy}
-
-
- {desktopAuthRequested ? (
-
- Finish auth here and we'll send you back into the OpenWork desktop app.
- {desktopRedirectUrl ? (
-
-
-
-
- {desktopGrant ? (
-
- ) : null}
-
-
- If OpenWork does not open automatically, copy the sign-in link or one-time code and paste it into the OpenWork desktop app.
-
-
- ) : null}
-
- ) : null}
-
-
-
- {!verificationRequired ? (
-
-
{authMode === "sign-in" ? "Need an account?" : "Already have an account?"}
-
-
- ) : null}
-
- {showAuthFeedback ? (
-
-
{authInfo}
- {authError ?
{authError}
: null}
- {!authError && verificationRequired ? (
-
-
- Waiting for your verification code
-
- ) : null}
-
- ) : null}
-
+
)}
diff --git a/ee/apps/den-web/app/(den)/_components/join-org-screen.tsx b/ee/apps/den-web/app/(den)/_components/join-org-screen.tsx
index 34e70e321..e56055add 100644
--- a/ee/apps/den-web/app/(den)/_components/join-org-screen.tsx
+++ b/ee/apps/den-web/app/(den)/_components/join-org-screen.tsx
@@ -2,7 +2,7 @@
import Link from "next/link";
import { useRouter } from "next/navigation";
-import { useEffect, useMemo, useState } from "react";
+import { useEffect, useState } from "react";
import { getErrorMessage, requestJson } from "../_lib/den-flow";
import {
PENDING_ORG_INVITATION_STORAGE_KEY,
@@ -13,6 +13,7 @@ import {
type DenInvitationPreview,
} from "../_lib/den-org";
import { useDenFlow } from "../_providers/den-flow-provider";
+import { AuthPanel } from "./auth-panel";
function LoadingCard({ title, body }: { title: string; body: string }) {
return (
@@ -51,22 +52,6 @@ export function JoinOrgScreen({ invitationId }: { invitationId: string }) {
const [joinBusy, setJoinBusy] = useState(false);
const [joinError, setJoinError] = useState