Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

fix(eve): refine Vercel sign-in screen (#1974)

Timo Lins267a59a7ee15
diff --git a/.changeset/calm-vercel-sign-in.md b/.changeset/calm-vercel-sign-in.md
new file mode 100644
index 000000000..b1ae46d21
--- /dev/null
+++ b/.changeset/calm-vercel-sign-in.md
@@ -0,0 +1,5 @@
+---
+"eve": patch
+---
+
+Align the Sign in with Vercel Web Chat screen with eve's default status page while keeping the generated app name primary and Vercel branding confined to the authentication button.
diff --git a/apps/docs/registry/channel/web-sign-in-with-vercel/app/_components/web-chat-auth.tsx b/apps/docs/registry/channel/web-sign-in-with-vercel/app/_components/web-chat-auth.tsx
index 3b1217e7f..64170b712 100644
--- a/apps/docs/registry/channel/web-sign-in-with-vercel/app/_components/web-chat-auth.tsx
+++ b/apps/docs/registry/channel/web-sign-in-with-vercel/app/_components/web-chat-auth.tsx
@@ -36,27 +36,58 @@ export function SignIn() {
}
return (
- <main className="flex h-dvh items-center justify-center bg-background px-6 text-foreground">
- <div className="flex w-full max-w-sm flex-col items-center gap-6 text-center">
- <div className="space-y-2">
- <h1 className="break-words font-medium text-4xl tracking-tighter">{AGENT_NAME}</h1>
- <p className="text-muted-foreground text-sm">
- Team members can sign in with Vercel to chat.
- </p>
+ <main className="flex min-h-dvh items-center justify-center bg-background px-8 text-foreground">
+ <div className="flex w-full max-w-[22rem] flex-col gap-5">
+ <div className="text-foreground opacity-[0.08] dark:opacity-[0.12]">
+ <EveWordmark className="h-auto w-[4.875rem]" />
</div>
- <Button disabled={pending} onClick={signIn}>
- Sign in with Vercel
- </Button>
- {error ? (
- <p className="text-destructive text-sm" role="alert">
- {error}
+ <section aria-label="Sign in" className="flex flex-col gap-2">
+ <h1 className="max-w-full break-words font-medium text-sm leading-6">{AGENT_NAME}</h1>
+ <p className="flex flex-wrap items-center gap-2 text-muted-foreground text-sm leading-6">
+ <span className="inline-flex items-center gap-2 text-emerald-600 dark:text-emerald-400">
+ <span aria-hidden="true" className="size-1.5 rounded-full bg-current" />
+ Ready
+ </span>
+ <span aria-hidden="true" className="text-border">
+ /
+ </span>
+ <span>Sign in to start a session</span>
</p>
- ) : null}
+ <Button className="mt-3 w-full gap-2 text-sm" disabled={pending} onClick={signIn}>
+ <svg aria-hidden="true" className="size-3 fill-current" viewBox="0 0 24 20">
+ <path d="M12 0 24 20H0L12 0Z" />
+ </svg>
+ <span className="leading-5">{pending ? "Redirecting…" : "Continue with Vercel"}</span>
+ </Button>
+ {error ? (
+ <p className="text-destructive text-sm" role="alert">
+ {error}
+ </p>
+ ) : null}
+ </section>
</div>
</main>
);
}
+function EveWordmark({ className }: { readonly className?: string }) {
+ return (
+ <svg
+ aria-hidden="true"
+ className={className}
+ fill="none"
+ viewBox="0 0 169 53"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ d="M169 8.47h-51.39L81.73 53H70.36L113 0H169zM169 44.51v8.47h-45.87V44.5zM45.87 52.98H0V44.5h45.87zM38.66 30.55H0v-8.47h38.66z"
+ fill="currentColor"
+ />
+ <path d="M169 30.55h-38.66v-8.47H169zM75.52 8.47H0V0h75.52z" fill="currentColor" />
+ </svg>
+ );
+}
+
export function AccountControl({
email,
image,
diff --git a/packages/eve/src/setup/scaffold/create/web-template.ts b/packages/eve/src/setup/scaffold/create/web-template.ts
index 4258d97e8..0ab7a74fe 100644
--- a/packages/eve/src/setup/scaffold/create/web-template.ts
+++ b/packages/eve/src/setup/scaffold/create/web-template.ts
@@ -79,7 +79,7 @@ export const WEB_APP_SIGN_IN_WITH_VERCEL_TEMPLATE_FILES = {
"agent/channels/eve.ts":
'import { eveChannel } from "eve/channels/eve";\nimport { localDev, type AuthFn, vercelOidc } from "eve/channels/auth";\nimport { auth } from "@/lib/auth";\n\nconst betterAuthSession: AuthFn<Request> = async (request) => {\n const session = await auth.api.getSession({ headers: request.headers });\n if (!session) return null;\n\n const attributes: Record<string, string> = {\n email: session.user.email,\n name: session.user.name,\n };\n if (session.user.image) {\n attributes.picture = session.user.image;\n }\n\n return {\n attributes,\n authenticator: "better-auth:vercel",\n principalId: session.user.id,\n principalType: "user",\n };\n};\n\nexport default eveChannel({\n auth: [betterAuthSession, vercelOidc(), localDev()],\n});\n',
"app/_components/web-chat-auth.tsx":
- '"use client";\n\nimport { LogOutIcon } from "lucide-react";\nimport { useState } from "react";\nimport { Button } from "@/components/ui/button";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from "@/components/ui/dropdown-menu";\nimport { authClient } from "@/lib/auth-client";\n\nconst AGENT_NAME = "__EVE_INIT_APP_NAME__";\n\nexport function SignIn() {\n const [pending, setPending] = useState(false);\n const [error, setError] = useState<string>();\n\n async function signIn() {\n setPending(true);\n setError(undefined);\n try {\n const result = await authClient.signIn.social({\n callbackURL: "/",\n provider: "vercel",\n });\n if (!result.error) return;\n setPending(false);\n setError("Sign-in failed. Try again.");\n } catch {\n setPending(false);\n setError("Sign-in failed. Try again.");\n }\n }\n\n return (\n <main className="flex h-dvh items-center justify-center bg-background px-6 text-foreground">\n <div className="flex w-full max-w-sm flex-col items-center gap-6 text-center">\n <div className="space-y-2">\n <h1 className="break-words font-medium text-4xl tracking-tighter">{AGENT_NAME}</h1>\n <p className="text-muted-foreground text-sm">\n Team members can sign in with Vercel to chat.\n </p>\n </div>\n <Button disabled={pending} onClick={signIn}>\n Sign in with Vercel\n </Button>\n {error ? (\n <p className="text-destructive text-sm" role="alert">\n {error}\n </p>\n ) : null}\n </div>\n </main>\n );\n}\n\nexport function AccountControl({\n email,\n image,\n name,\n}: {\n readonly email: string;\n readonly image?: string | null;\n readonly name: string;\n}) {\n const [imageFailed, setImageFailed] = useState(false);\n const [pending, setPending] = useState(false);\n const initials = getInitials(name, email);\n\n async function signOut() {\n setPending(true);\n try {\n await authClient.signOut({\n fetchOptions: {\n onError: () => setPending(false),\n onSuccess: () => window.location.assign("/"),\n },\n });\n } catch {\n setPending(false);\n }\n }\n\n return (\n <div className="fixed top-3 right-3 z-10">\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n aria-label={`Open account menu for ${name}`}\n className="size-9 cursor-pointer overflow-hidden rounded-full p-0"\n size="icon"\n variant="outline"\n >\n {image && !imageFailed ? (\n <img\n alt=""\n className="size-full object-cover"\n onError={() => setImageFailed(true)}\n src={image}\n />\n ) : (\n <span aria-hidden="true" className="font-medium text-xs">\n {initials}\n </span>\n )}\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align="end" className="w-64">\n <div className="min-w-0 px-2 py-1.5 text-sm">\n <span className="block truncate font-medium leading-5" title={name}>\n {name}\n </span>\n <span className="block truncate text-muted-foreground leading-5" title={email}>\n {email}\n </span>\n </div>\n <DropdownMenuSeparator />\n <DropdownMenuItem\n className="cursor-pointer justify-between"\n disabled={pending}\n onSelect={signOut}\n >\n {pending ? "Logging out…" : "Log out"}\n <LogOutIcon aria-hidden="true" />\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n );\n}\n\nfunction getInitials(name: string, email: string): string {\n const parts = name.trim().split(/\\s+/).filter(Boolean);\n if (parts.length >= 2) {\n return `${parts[0]?.[0] ?? ""}${parts.at(-1)?.[0] ?? ""}`.toUpperCase();\n }\n return (parts[0]?.[0] ?? email[0] ?? "?").toUpperCase();\n}\n',
+ '"use client";\n\nimport { LogOutIcon } from "lucide-react";\nimport { useState } from "react";\nimport { Button } from "@/components/ui/button";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from "@/components/ui/dropdown-menu";\nimport { authClient } from "@/lib/auth-client";\n\nconst AGENT_NAME = "__EVE_INIT_APP_NAME__";\n\nexport function SignIn() {\n const [pending, setPending] = useState(false);\n const [error, setError] = useState<string>();\n\n async function signIn() {\n setPending(true);\n setError(undefined);\n try {\n const result = await authClient.signIn.social({\n callbackURL: "/",\n provider: "vercel",\n });\n if (!result.error) return;\n setPending(false);\n setError("Sign-in failed. Try again.");\n } catch {\n setPending(false);\n setError("Sign-in failed. Try again.");\n }\n }\n\n return (\n <main className="flex min-h-dvh items-center justify-center bg-background px-8 text-foreground">\n <div className="flex w-full max-w-[22rem] flex-col gap-5">\n <div className="text-foreground opacity-[0.08] dark:opacity-[0.12]">\n <EveWordmark className="h-auto w-[4.875rem]" />\n </div>\n <section aria-label="Sign in" className="flex flex-col gap-2">\n <h1 className="max-w-full break-words font-medium text-sm leading-6">{AGENT_NAME}</h1>\n <p className="flex flex-wrap items-center gap-2 text-muted-foreground text-sm leading-6">\n <span className="inline-flex items-center gap-2 text-emerald-600 dark:text-emerald-400">\n <span aria-hidden="true" className="size-1.5 rounded-full bg-current" />\n Ready\n </span>\n <span aria-hidden="true" className="text-border">\n /\n </span>\n <span>Sign in to start a session</span>\n </p>\n <Button className="mt-3 w-full gap-2 text-sm" disabled={pending} onClick={signIn}>\n <svg aria-hidden="true" className="size-3 fill-current" viewBox="0 0 24 20">\n <path d="M12 0 24 20H0L12 0Z" />\n </svg>\n <span className="leading-5">{pending ? "Redirecting…" : "Continue with Vercel"}</span>\n </Button>\n {error ? (\n <p className="text-destructive text-sm" role="alert">\n {error}\n </p>\n ) : null}\n </section>\n </div>\n </main>\n );\n}\n\nfunction EveWordmark({ className }: { readonly className?: string }) {\n return (\n <svg\n aria-hidden="true"\n className={className}\n fill="none"\n viewBox="0 0 169 53"\n xmlns="http://www.w3.org/2000/svg"\n >\n <path\n d="M169 8.47h-51.39L81.73 53H70.36L113 0H169zM169 44.51v8.47h-45.87V44.5zM45.87 52.98H0V44.5h45.87zM38.66 30.55H0v-8.47h38.66z"\n fill="currentColor"\n />\n <path d="M169 30.55h-38.66v-8.47H169zM75.52 8.47H0V0h75.52z" fill="currentColor" />\n </svg>\n );\n}\n\nexport function AccountControl({\n email,\n image,\n name,\n}: {\n readonly email: string;\n readonly image?: string | null;\n readonly name: string;\n}) {\n const [imageFailed, setImageFailed] = useState(false);\n const [pending, setPending] = useState(false);\n const initials = getInitials(name, email);\n\n async function signOut() {\n setPending(true);\n try {\n await authClient.signOut({\n fetchOptions: {\n onError: () => setPending(false),\n onSuccess: () => window.location.assign("/"),\n },\n });\n } catch {\n setPending(false);\n }\n }\n\n return (\n <div className="fixed top-3 right-3 z-10">\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n aria-label={`Open account menu for ${name}`}\n className="size-9 cursor-pointer overflow-hidden rounded-full p-0"\n size="icon"\n variant="outline"\n >\n {image && !imageFailed ? (\n <img\n alt=""\n className="size-full object-cover"\n onError={() => setImageFailed(true)}\n src={image}\n />\n ) : (\n <span aria-hidden="true" className="font-medium text-xs">\n {initials}\n </span>\n )}\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align="end" className="w-64">\n <div className="min-w-0 px-2 py-1.5 text-sm">\n <span className="block truncate font-medium leading-5" title={name}>\n {name}\n </span>\n <span className="block truncate text-muted-foreground leading-5" title={email}>\n {email}\n </span>\n </div>\n <DropdownMenuSeparator />\n <DropdownMenuItem\n className="cursor-pointer justify-between"\n disabled={pending}\n onSelect={signOut}\n >\n {pending ? "Logging out…" : "Log out"}\n <LogOutIcon aria-hidden="true" />\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n );\n}\n\nfunction getInitials(name: string, email: string): string {\n const parts = name.trim().split(/\\s+/).filter(Boolean);\n if (parts.length >= 2) {\n return `${parts[0]?.[0] ?? ""}${parts.at(-1)?.[0] ?? ""}`.toUpperCase();\n }\n return (parts[0]?.[0] ?? email[0] ?? "?").toUpperCase();\n}\n',
"app/api/auth/[...all]/route.ts":
'import { toNextJsHandler } from "better-auth/next-js";\nimport { auth } from "@/lib/auth";\n\nexport const { GET, POST } = toNextJsHandler(auth);\n',
"app/layout.tsx":
diff --git a/packages/eve/src/setup/scaffold/index.integration.test.ts b/packages/eve/src/setup/scaffold/index.integration.test.ts
index 628beb8ab..a499b8fb7 100644
--- a/packages/eve/src/setup/scaffold/index.integration.test.ts
+++ b/packages/eve/src/setup/scaffold/index.integration.test.ts
@@ -335,6 +335,10 @@ describe("ensureChannel", () => {
"utf8",
);
expect(accountSource).toContain('className="size-9 cursor-pointer');
+ expect(accountSource).toContain("Continue with Vercel");
+ expect(accountSource).toContain('viewBox="0 0 24 20"');
+ expect(accountSource).toContain('viewBox="0 0 169 53"');
+ expect(accountSource).toContain("Sign in to start a session");
expect(accountSource).toContain("Log out");
expect(accountSource).not.toContain("__EVE_INIT_APP_NAME__");
});