diff --git a/apps/fabro-web/app/routes/auth-login.tsx b/apps/fabro-web/app/routes/auth-login.tsx index e7aed1627..e3f0ad278 100644 --- a/apps/fabro-web/app/routes/auth-login.tsx +++ b/apps/fabro-web/app/routes/auth-login.tsx @@ -9,7 +9,8 @@ export async function loader() { export default function AuthLogin({ loaderData }: any) { const methods = loaderData?.methods ?? []; - const isDevToken = methods.includes("dev-token"); + const hasDevToken = methods.includes("dev-token"); + const hasGitHub = methods.includes("github"); const navigate = useNavigate(); const [token, setToken] = useState(""); const [error, setError] = useState(null); @@ -32,12 +33,28 @@ export default function AuthLogin({ loaderData }: any) { Sign in to Fabro

- {isDevToken - ? "Paste your dev token to continue." - : "Authenticate with your GitHub account to continue."} + {hasGitHub + ? "Authenticate with your GitHub account to continue." + : "Paste your dev token to continue."}

-
- {isDevToken ? ( +
+ {hasGitHub ? ( + + + Sign in with GitHub + + ) : null} + {hasDevToken && hasGitHub ? ( + + ) : hasDevToken ? (

- Paste the dev token from your terminal or cat ~/.fabro/dev-token + Paste the dev token from your terminal or{" "} + cat ~/.fabro/dev-token

{error ? (

{error}

) : null}
- ) : ( - - - Sign in with GitHub - - )} + ) : null}
); } +function DevTokenCollapsible({ + token, + setToken, + error, + onSubmit, +}: { + token: string; + setToken: (v: string) => void; + error: string | null; + onSubmit: (e: React.FormEvent) => void; +}) { + const [open, setOpen] = useState(false); + + return ( +
+ + {open ? ( +
+ setToken(event.target.value)} + placeholder="fabro_dev_..." + className="w-full rounded-lg border border-line-strong bg-panel px-4 py-2.5 text-sm text-fg outline-none focus:border-teal-500" + /> + + {error ? ( +

{error}

+ ) : null} +
+ ) : null} +
+ ); +} + function GitHubMark() { return (