Email for professionals and teams
Cleanup layout
Hieu Nguyen (Jack)d049b28df571
diff --git a/.dev.vars.example b/.dev.vars.exampleindex c3a2d80..f7aa01c 100644--- a/.dev.vars.example+++ b/.dev.vars.example@@ -1,5 +1,6 @@NEXTJS_ENV=development# Preferred: scoped API token.+# This is an app runtime token, not the Cloudflare deploy/build token.CF_TOKEN=your_api_token_with_zone_email_permissionsCF_ACCOUNT_ID=your_account_idCF_EMAIL_WORKER_NAME=mailflarediff --git a/README.md b/README.mdindex ea1b58c..d734325 100644--- a/README.md+++ b/README.md@@ -61,7 +61,7 @@ Keep `wrangler.jsonc` committed. Cloudflare's deploy button uses it to detect thRequired setup values:-- `CF_TOKEN` — scoped Cloudflare API token with Zone Read, Email Routing Edit, Email Sending Edit, and Email Routing Rules Write.+- `CF_TOKEN` — runtime scoped Cloudflare API token with Zone Read, Email Routing Edit, Email Sending Edit, and Email Routing Rules Write. This is separate from Cloudflare's deploy/build token; Cloudflare does not automatically expose the deploy token to this app.- `CF_ACCOUNT_ID` — optional unless your token can access multiple accounts.- `CF_EMAIL_WORKER_NAME` — must match the Worker name in `wrangler.jsonc`; default is `mailflare`.@@ -73,6 +73,8 @@ After deployment, route inbound mail to the Worker in Cloudflare Email Routing.If onboarding fails with `Cloudflare API 403 ... code 9109: Invalid access token`, Cloudflare rejected the credential before checking domain permissions.+The Deploy to Cloudflare flow can authenticate and deploy the Worker, but it does not create a runtime `CF_TOKEN` for Mailflare's onboarding API calls. Create `CF_TOKEN` manually from Cloudflare dashboard user API tokens and enter it as a deploy secret/variable.+Verify the token:```bashdiff --git a/package.json b/package.jsonindex a4bf02b..e7d0f8c 100644--- a/package.json+++ b/package.json@@ -21,7 +21,7 @@"cloudflare": {"bindings": {"CF_TOKEN": {- "description": "Cloudflare API token with `Zone Read`, `Email Routing Edit`, `Email Sending Edit`, and `Email Routing Rules Write` permissions for the zones you will connect."+ "description": "Runtime Cloudflare API token used by Mailflare onboarding to call the Zones and Email Routing APIs. Cloudflare's deploy/build token is not passed to the app, so create this separately at https://dash.cloudflare.com/profile/api-tokens with `Zone Read`, `Email Routing Edit`, `Email Sending Edit`, and `Email Routing Rules Write` permissions for the zones you will connect. Paste only the token secret value, without `Bearer`."},"CF_ACCOUNT_ID": {"description": "Optional Cloudflare account ID. Leave blank unless your API token can access multiple accounts."diff --git a/src/app/layout.tsx b/src/app/layout.tsxindex 45f54c5..d9b3278 100644--- a/src/app/layout.tsx+++ b/src/app/layout.tsx@@ -14,7 +14,7 @@ const geistMono = Geist_Mono({});export const metadata: Metadata = {- title: "Email Platform",+ title: "Mailflare",description: "Multi-tenant email on Cloudflare",};diff --git a/src/app/login/login-client.tsx b/src/app/login/login-client.tsxindex d22e4cc..498bc24 100644--- a/src/app/login/login-client.tsx+++ b/src/app/login/login-client.tsx@@ -11,54 +11,73 @@ import { Label } from "@/components/ui/label";import { submitLogin } from "./utils";export function LoginClient() {- const router = useRouter();- const [error, setError] = useState<string | null>(null);- const [loading, setLoading] = useState(false);+ const router = useRouter();+ const [error, setError] = useState<string | null>(null);+ const [loading, setLoading] = useState(false);- async function onSubmit(e: React.FormEvent<HTMLFormElement>) {- e.preventDefault();- setLoading(true);- setError(null);+ async function onSubmit(e: React.FormEvent<HTMLFormElement>) {+ e.preventDefault();+ setLoading(true);+ setError(null);- const { ok, data } = await submitLogin(new FormData(e.currentTarget));- setLoading(false);- if (!ok) {- setError(data.error ?? "Login failed");- return;- }- router.push(data.redirect ?? "/inbox");- }+ const { ok, data } = await submitLogin(new FormData(e.currentTarget));+ setLoading(false);+ if (!ok) {+ setError(data.error ?? "Login failed");+ return;+ }+ router.push(data.redirect ?? "/inbox");+ }- return (- <AuthShell- icon={Mail}- title="Sign in to Mail"- description="Open your Cloudflare-powered mailbox and continue from the same inbox workspace."- footer={- <Link href="/register" className="inline-flex items-center gap-2 hover:underline">- Create account- <ArrowRight className="h-4 w-4" />- </Link>- }- >- <form onSubmit={onSubmit} className="space-y-5">- <div className="space-y-2">- <Label htmlFor="email">Email</Label>- <Input id="email" name="email" type="email" autoComplete="email" required />- </div>- <div className="space-y-2">- <Label htmlFor="password">Password</Label>- <Input id="password" name="password" type="password" autoComplete="current-password" required />- </div>- {error && (- <p className="rounded-2xl border border-red-100 bg-red-50 px-4 py-3 text-sm font-medium text-red-700">- {error}- </p>- )}- <Button type="submit" className="h-11 w-full rounded-full px-6 active:scale-[0.98]" disabled={loading}>- {loading ? "Signing in..." : "Sign in"}- </Button>- </form>- </AuthShell>- );+ return (+ <AuthShell+ icon={Mail}+ title="Sign in"+ description="Open your mailbox and continue from the same inbox workspace."+ footer={+ <Link+ href="/register"+ className="inline-flex items-center gap-2 hover:underline"+ >+ Create account+ <ArrowRight className="h-4 w-4" />+ </Link>+ }+ >+ <form onSubmit={onSubmit} className="space-y-5">+ <div className="space-y-2">+ <Label htmlFor="email">Email</Label>+ <Input+ id="email"+ name="email"+ type="email"+ autoComplete="email"+ required+ />+ </div>+ <div className="space-y-2">+ <Label htmlFor="password">Password</Label>+ <Input+ id="password"+ name="password"+ type="password"+ autoComplete="current-password"+ required+ />+ </div>+ {error && (+ <p className="rounded-2xl border border-red-100 bg-red-50 px-4 py-3 text-sm font-medium text-red-700">+ {error}+ </p>+ )}+ <Button+ type="submit"+ className="h-11 w-full rounded-full px-6 active:scale-[0.98]"+ disabled={loading}+ >+ {loading ? "Signing in..." : "Sign in"}+ </Button>+ </form>+ </AuthShell>+ );}diff --git a/src/app/page.tsx b/src/app/page.tsxindex dc24256..3b6da08 100644--- a/src/app/page.tsx+++ b/src/app/page.tsx@@ -1,154 +1,178 @@import Link from "next/link";-import { ArrowRight, CheckCircle2, Clock3, Inbox, Mail, Search, ShieldCheck } from "lucide-react";+import { getEnv } from "@/lib/cloudflare";import { Button } from "@/components/ui/button";import { getCurrentUser } from "@/lib/auth/cookies";-import { getEnv } from "@/lib/cloudflare";-import {- deliverySignals,- getHomeActions,- heroMessages,- inboxStats,- landingNavItems,- sidebarItems,-} from "./utils";+import { getHomeActions, heroMessages, sidebarItems } from "./utils";+import { ArrowRight, Inbox, Mail, Search, ShieldCheck } from "lucide-react";export const dynamic = "force-dynamic";export default async function HomePage() {- const user = await getCurrentUser(getEnv());- const actions = getHomeActions(Boolean(user));+ const user = await getCurrentUser(getEnv());+ const actions = getHomeActions(Boolean(user));- return (- <div className="min-h-[100dvh] bg-[#f6f8fc] text-neutral-900">- <header className="mx-auto flex h-16 w-full max-w-7xl items-center justify-between px-4 sm:px-6 lg:px-8">- <Link href="/" className="flex items-center gap-3" aria-label="Email Platform home">- <span className="flex h-10 w-10 items-center justify-center rounded-2xl bg-blue-600 text-white shadow-sm">- <Mail className="h-5 w-5" />- </span>- <span className="text-base font-semibold tracking-tight">Email Platform</span>- </Link>+ return (+ <div className="min-h-dvh bg-[#f6f8fc] text-neutral-900">+ <header className="mx-auto flex h-16 w-full max-w-7xl items-center justify-between px-4 sm:px-6 lg:px-8">+ <Link+ href="/"+ className="flex items-center gap-3"+ aria-label="Email Platform home"+ >+ <span className="flex h-8 w-8 items-center justify-center rounded-lg bg-blue-600 text-white shadow-sm">+ <Mail className="h-5 w-5" />+ </span>+ <span className="text-base font-semibold tracking-tight">+ Mailflare+ </span>+ </Link>- <nav className="hidden items-center gap-6 text-sm font-medium text-neutral-600 md:flex">+ {/* <nav className="hidden items-center gap-6 text-sm font-medium text-neutral-600 md:flex">{landingNavItems.map((item) => (<a key={item.href} href={item.href} className="transition-colors hover:text-neutral-950">{item.label}</a>))}- </nav>+ </nav> */}- <div className="flex items-center gap-2">- {actions.map((action) => (- <Button key={action.href} variant={action.variant} asChild>- <Link href={action.href}>{action.label}</Link>- </Button>- ))}- </div>- </header>+ <div className="flex items-center gap-2">+ {actions.map((action) => (+ <Button key={action.href} variant={action.variant} asChild>+ <Link href={action.href}>{action.label}</Link>+ </Button>+ ))}+ </div>+ </header>- <main>- <section className="mx-auto grid max-w-7xl grid-cols-1 gap-10 px-4 pb-12 pt-8 sm:px-6 md:pt-16 lg:grid-cols-[0.86fr_1.14fr] lg:px-8">- <div className="flex max-w-2xl flex-col justify-center">- <div className="mb-6 flex w-fit items-center gap-2 rounded-full border border-blue-100 bg-white px-3 py-1.5 text-sm font-medium text-blue-800 shadow-sm">- <ShieldCheck className="h-4 w-4" />- Cloudflare-native email operations- </div>- <h1 className="max-w-[12ch] text-5xl font-semibold leading-[0.96] tracking-tight text-neutral-950 sm:text-6xl lg:text-7xl">- Mailboxes that feel like your inbox.- </h1>- <p className="mt-6 max-w-xl text-lg leading-8 text-neutral-600">- Add domains, route inbound mail, send through API keys, and manage team mailboxes from one quiet- workspace built around the message list.- </p>- <div className="mt-8 flex flex-col gap-3 sm:flex-row">- <Button size="lg" asChild className="rounded-full px-6">- <Link href={actions.at(-1)?.href ?? "/register"}>- {user ? "Open dashboard" : "Create account"}- <ArrowRight className="h-4 w-4" />- </Link>- </Button>- <Button size="lg" variant="outline" asChild className="rounded-full border-neutral-200 bg-white px-6">- <Link href={user ? "/inbox" : "/login"}>{user ? "View inbox" : "Log in"}</Link>- </Button>- </div>- </div>+ <main>+ <section className="mx-auto grid max-w-7xl grid-cols-1 gap-10 px-4 pb-12 pt-8 sm:px-6 md:pt-16 lg:grid-cols-[0.86fr_1.14fr] lg:px-8">+ <div className="flex max-w-2xl flex-col justify-center">+ <div className="mb-6 flex w-fit items-center gap-2 text-sm font-medium text-blue-800">+ <ShieldCheck className="h-4 w-4" />+ Cloudflare-native email operations+ </div>+ <h1 className="max-w-[12ch] text-5xl font-semibold leading-[0.96] tracking-tight text-neutral-950 sm:text-6xl lg:text-7xl">+ Mailboxes that feel like your inbox.+ </h1>+ <p className="mt-6 max-w-xl text-lg leading-8 text-neutral-600">+ Add domains, route inbound mail, send through API keys, and manage+ team mailboxes from one quiet workspace built around the message+ list.+ </p>+ <div className="mt-8 flex flex-col gap-3 sm:flex-row">+ <Button size="lg" asChild className="rounded-full px-6">+ <Link href={actions.at(-1)?.href ?? "/register"}>+ {user ? "Open dashboard" : "Create account"}+ <ArrowRight className="h-4 w-4" />+ </Link>+ </Button>+ <Button+ size="lg"+ variant="outline"+ asChild+ className="rounded-full border-neutral-200 bg-white px-6"+ >+ <Link href={user ? "/inbox" : "/login"}>+ {user ? "View inbox" : "Log in"}+ </Link>+ </Button>+ </div>+ </div>- <div className="relative min-h-[520px] overflow-hidden rounded-[2rem] border border-white bg-white shadow-[0_24px_70px_-45px_rgba(30,64,175,0.55)]">- <div className="grid h-full min-h-[520px] grid-cols-[176px_1fr] bg-white">- <aside className="hidden flex-col gap-2 bg-[#f6f8fc] px-3 py-5 sm:flex">- <div className="mb-4 flex items-center gap-3 px-3 text-neutral-700">- <Inbox className="h-5 w-5" />- <span className="font-semibold">Mail</span>- </div>- <div className="mb-3 flex h-12 w-fit items-center gap-2 rounded-2xl bg-blue-100 px-5 text-sm font-semibold text-blue-950 shadow-sm">- <Mail className="h-4 w-4" />- Compose- </div>- {sidebarItems.map((item) => {- const Icon = item.icon;- return (- <div- key={item.label}- className={`flex h-9 items-center justify-between rounded-r-full px-3 text-sm font-medium ${- item.active ? "bg-blue-100 text-blue-950" : "text-neutral-600"- }`}- >- <span className="flex items-center gap-3">- <Icon className="h-4 w-4" />- {item.label}- </span>- {item.count && <span className="text-xs text-blue-800">{item.count}</span>}- </div>- );- })}- </aside>+ <div className="relative min-h-[520px] overflow-hidden rounded-[2rem] border border-white bg-white shadow-[0_24px_70px_-45px_rgba(30,64,175,0.55)]">+ <div className="grid h-full min-h-[520px] grid-cols-[176px_1fr] bg-white">+ <aside className="hidden flex-col gap-2 bg-[#f6f8fc] px-3 py-5 sm:flex">+ <div className="mb-4 flex items-center gap-3 px-3 text-neutral-700">+ <Inbox className="h-5 w-5" />+ <span className="font-semibold">Mail</span>+ </div>+ <div className="mb-3 flex h-12 w-fit items-center gap-2 rounded-2xl bg-blue-100 px-5 text-sm font-semibold text-blue-950 shadow-sm">+ <Mail className="h-4 w-4" />+ Compose+ </div>+ {sidebarItems.map((item) => {+ const Icon = item.icon;+ return (+ <div+ key={item.label}+ className={`flex h-9 items-center justify-between rounded-r-full px-3 text-sm font-medium ${+ item.active+ ? "bg-blue-100 text-blue-950"+ : "text-neutral-600"+ }`}+ >+ <span className="flex items-center gap-3">+ <Icon className="h-4 w-4" />+ {item.label}+ </span>+ {item.count && (+ <span className="text-xs text-blue-800">+ {item.count}+ </span>+ )}+ </div>+ );+ })}+ </aside>- <div className="col-span-2 flex min-w-0 flex-col sm:col-span-1">- <div className="flex h-16 items-center gap-3 bg-[#f6f8fc] px-4">- <div className="flex h-12 flex-1 items-center gap-3 rounded-full bg-[#eaf1fb] px-4 text-neutral-600">- <Search className="h-5 w-5" />- <span className="text-[15px]">Search mail</span>- </div>- <div className="flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-blue-600 text-white">- <Mail className="h-4 w-4" />- </div>- </div>+ <div className="col-span-2 flex min-w-0 flex-col sm:col-span-1">+ <div className="flex h-16 items-center gap-3 bg-[#f6f8fc] px-4">+ <div className="flex h-12 flex-1 items-center gap-3 rounded-full bg-[#eaf1fb] px-4 text-neutral-600">+ <Search className="h-5 w-5" />+ <span className="text-[15px]">Search mail</span>+ </div>+ <div className="flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-blue-600 text-white">+ <Mail className="h-4 w-4" />+ </div>+ </div>- <div className="flex min-h-0 flex-1 flex-col overflow-hidden rounded-tl-3xl bg-white">- <div className="flex h-14 items-center justify-between border-b border-neutral-200 px-6">- <div className="flex items-center gap-3">- <h2 className="text-xl font-medium text-neutral-800">Priority inbox</h2>- <span className="rounded-full bg-neutral-100 px-2.5 py-1 text-xs font-medium text-neutral-600">- 18- </span>- </div>- <span className="hidden text-sm font-medium text-neutral-500 md:inline">Updated 2 min ago</span>- </div>- <div className="divide-y divide-neutral-100">- {heroMessages.map((message) => (- <div- key={message.sender}- className="grid min-h-14 grid-cols-[28px_minmax(112px,180px)_1fr_auto] items-center gap-3 px-5 text-sm hover:bg-[#f2f6fc]"- >- <message.icon className="h-4 w-4 text-neutral-300" />- <span className="truncate font-semibold text-neutral-900">{message.sender}</span>- <span className="truncate text-neutral-600">- <span className="font-medium text-neutral-900">{message.subject}</span>- <span className="hidden text-neutral-500 md:inline"> - {message.preview}</span>- </span>- <span className="rounded-full bg-blue-50 px-2.5 py-1 text-xs font-semibold text-blue-700">- {message.badge}- </span>- </div>- ))}- </div>- </div>- </div>- </div>- </div>- </section>+ <div className="flex min-h-0 flex-1 flex-col overflow-hidden rounded-tl-3xl bg-white">+ <div className="flex h-14 items-center justify-between border-b border-neutral-200 px-6">+ <div className="flex items-center gap-3">+ <h2 className="text-xl font-medium text-neutral-800">+ Priority inbox+ </h2>+ <span className="rounded-full bg-neutral-100 px-2.5 py-1 text-xs font-medium text-neutral-600">+ 18+ </span>+ </div>+ <span className="hidden text-sm font-medium text-neutral-500 md:inline">+ Updated 2 min ago+ </span>+ </div>+ <div className="divide-y divide-neutral-100">+ {heroMessages.map((message) => (+ <div+ key={message.sender}+ className="grid min-h-14 grid-cols-[28px_minmax(112px,180px)_1fr_auto] items-center gap-3 px-5 text-sm hover:bg-[#f2f6fc]"+ >+ <message.icon className="h-4 w-4 text-neutral-300" />+ <span className="truncate font-semibold text-neutral-900">+ {message.sender}+ </span>+ <span className="truncate text-neutral-600">+ <span className="font-medium text-neutral-900">+ {message.subject}+ </span>+ <span className="hidden text-neutral-500 md:inline">+ {" "}+ - {message.preview}+ </span>+ </span>+ <span className="rounded-full bg-blue-50 px-2.5 py-1 text-xs font-semibold text-blue-700">+ {message.badge}+ </span>+ </div>+ ))}+ </div>+ </div>+ </div>+ </div>+ </div>+ </section>- <section id="workflow" className="mx-auto grid max-w-7xl grid-cols-1 gap-6 px-4 pb-16 sm:px-6 lg:grid-cols-[1.1fr_0.9fr] lg:px-8">- <div id="api" className="rounded-[1.75rem] border border-neutral-200 bg-white p-6 shadow-sm">+ {/* <section id="workflow" className="mx-auto grid max-w-7xl grid-cols-1 gap-6 px-4 pb-16 sm:px-6 lg:grid-cols-[1.1fr_0.9fr] lg:px-8">+ <div id="api" className="rounded-[1.75rem] bg-white p-6 shadow-sm shadow-neutral-200/50"><div className="mb-6 flex items-center justify-between gap-4"><div><p className="text-sm font-semibold text-blue-700">Operational view</p>@@ -166,7 +190,7 @@ export default async function HomePage() {</div></div>- <div id="domains" className="rounded-[1.75rem] border border-neutral-200 bg-white p-6 shadow-sm">+ <div id="domains" className="rounded-[1.75rem] bg-white p-6 shadow-sm shadow-neutral-200/50"><p className="text-sm font-semibold text-blue-700">Delivery signals</p><div className="mt-5 space-y-4">{deliverySignals.map((signal) => (@@ -177,8 +201,8 @@ export default async function HomePage() {))}</div></div>- </section>- </main>- </div>- );+ </section> */}+ </main>+ </div>+ );}diff --git a/src/app/register/register-client.tsx b/src/app/register/register-client.tsxindex 527e067..61043f5 100644--- a/src/app/register/register-client.tsx+++ b/src/app/register/register-client.tsx@@ -8,142 +8,191 @@ import { AuthShell } from "@/components/auth/auth-shell";import { Button } from "@/components/ui/button";import { Input } from "@/components/ui/input";import { Label } from "@/components/ui/label";-import { getSetupStatus, submitPrimaryDomain, submitRegistration } from "./utils";+import {+ getSetupStatus,+ submitPrimaryDomain,+ submitRegistration,+} from "./utils";export function RegisterClient() {- const router = useRouter();- const [hasPrimaryDomain, setHasPrimaryDomain] = useState<boolean | null>(null);- const [primaryDomain, setPrimaryDomain] = useState<string | null>(null);- const [setupDomain, setSetupDomain] = useState<string | null>(null);- const [step, setStep] = useState<1 | 2>(1);- const [error, setError] = useState<string | null>(null);- const [loading, setLoading] = useState(false);+ const router = useRouter();+ const [hasPrimaryDomain, setHasPrimaryDomain] = useState<boolean | null>(+ null,+ );+ const [primaryDomain, setPrimaryDomain] = useState<string | null>(null);+ const [setupDomain, setSetupDomain] = useState<string | null>(null);+ const [step, setStep] = useState<1 | 2>(1);+ const [error, setError] = useState<string | null>(null);+ const [loading, setLoading] = useState(false);- useEffect(() => {- void getSetupStatus()- .then((data) => {- setHasPrimaryDomain(data.hasPrimaryDomain);- setPrimaryDomain(data.primaryDomain?.hostname ?? null);- })- .catch(() => setHasPrimaryDomain(true));- }, []);+ useEffect(() => {+ void getSetupStatus()+ .then((data) => {+ setHasPrimaryDomain(data.hasPrimaryDomain);+ setPrimaryDomain(data.primaryDomain?.hostname ?? null);+ })+ .catch(() => setHasPrimaryDomain(true));+ }, []);- async function onDomainSubmit(e: React.FormEvent<HTMLFormElement>) {- e.preventDefault();- setLoading(true);- setError(null);+ async function onDomainSubmit(e: React.FormEvent<HTMLFormElement>) {+ e.preventDefault();+ setLoading(true);+ setError(null);- const { ok, data } = await submitPrimaryDomain(new FormData(e.currentTarget));- setLoading(false);- if (!ok || !data.domain) {- setError(typeof data.error === "string" ? data.error : "Domain setup failed");- return;- }- setSetupDomain(data.domain.hostname);- setStep(2);- }+ const { ok, data } = await submitPrimaryDomain(+ new FormData(e.currentTarget),+ );+ setLoading(false);+ if (!ok || !data.domain) {+ setError(+ typeof data.error === "string" ? data.error : "Domain setup failed",+ );+ return;+ }+ setSetupDomain(data.domain.hostname);+ setStep(2);+ }- async function onSubmit(e: React.FormEvent<HTMLFormElement>) {- e.preventDefault();- setLoading(true);- setError(null);+ async function onSubmit(e: React.FormEvent<HTMLFormElement>) {+ e.preventDefault();+ setLoading(true);+ setError(null);- const form = new FormData(e.currentTarget);- const firstRun = hasPrimaryDomain === false;- const domain = firstRun ? setupDomain : primaryDomain;- if (!domain) {- setLoading(false);- setError("Domain setup is not complete");- return;- }+ const form = new FormData(e.currentTarget);+ const firstRun = hasPrimaryDomain === false;+ const domain = firstRun ? setupDomain : primaryDomain;+ if (!domain) {+ setLoading(false);+ setError("Domain setup is not complete");+ return;+ }- const { ok, data } = await submitRegistration(form, { firstRun, domain });- setLoading(false);- if (!ok) {- setError(typeof data.error === "string" ? data.error : "Registration failed");- return;- }- router.push(data.redirect ?? "/inbox");- }+ const { ok, data } = await submitRegistration(form, { firstRun, domain });+ setLoading(false);+ if (!ok) {+ setError(+ typeof data.error === "string" ? data.error : "Registration failed",+ );+ return;+ }+ router.push(data.redirect ?? "/inbox");+ }- const firstRun = hasPrimaryDomain === false;- const accountDomain = firstRun ? setupDomain : primaryDomain;- const showDomainStep = firstRun && step === 1;+ const firstRun = hasPrimaryDomain === false;+ const accountDomain = firstRun ? setupDomain : primaryDomain;+ const showDomainStep = firstRun && step === 1;- return (- <AuthShell- icon={MailPlus}- title={showDomainStep ? "Add your domain" : "Create your mailbox"}- description={- showDomainStep- ? "Connect the primary Cloudflare zone first so routing records can be created before the first mailbox."- : `Choose a mailbox username on ${accountDomain ?? "the primary domain"} and add a recovery email.`- }- steps={- firstRun- ? [- { label: "Domain", active: step === 1 },- { label: "Account", active: step === 2 },- ]- : undefined- }- footer={- <Link href="/login" className="inline-flex items-center gap-2 hover:underline">- Sign in instead- <ArrowRight className="h-4 w-4" />- </Link>- }- >- {showDomainStep ? (- <form onSubmit={onDomainSubmit} className="space-y-5">- <div className="space-y-2">- <Label htmlFor="domain">Primary domain</Label>- <Input id="domain" name="domain" placeholder="example.com" autoComplete="url" required />- <p className="text-xs leading-5 text-neutral-500">- The domain must already be a Cloudflare zone on this account.- </p>- </div>- {error && (- <p className="rounded-2xl border border-red-100 bg-red-50 px-4 py-3 text-sm font-medium text-red-700">- {error}- </p>- )}- <Button type="submit" className="h-11 w-full rounded-full px-6 active:scale-[0.98]" disabled={loading}>- {loading ? "Adding domain..." : "Continue"}- </Button>- </form>- ) : (- <form onSubmit={onSubmit} className="space-y-5">- <div className="space-y-2">- <Label htmlFor="username">Username</Label>- <div className="grid grid-cols-[minmax(0,1fr)_auto] items-center gap-2">- <Input id="username" name="username" placeholder="you" autoComplete="username" required />- <span className="max-w-36 truncate text-sm font-medium text-neutral-500">@{accountDomain ?? "domain"}</span>- </div>- </div>- <div className="space-y-2">- <Label htmlFor="resetEmail">Recovery email</Label>- <Input id="resetEmail" name="resetEmail" type="email" placeholder="[email protected]" required />- <p className="text-xs leading-5 text-neutral-500">Used later for password reset.</p>- </div>- <div className="space-y-2">- <Label htmlFor="password">Password</Label>- <Input id="password" name="password" type="password" minLength={8} autoComplete="new-password" required />- </div>- {error && (- <p className="rounded-2xl border border-red-100 bg-red-50 px-4 py-3 text-sm font-medium text-red-700">- {error}- </p>- )}- <Button- type="submit"- className="h-11 w-full rounded-full px-6 active:scale-[0.98]"- disabled={loading || hasPrimaryDomain === null}- >- {loading ? "Creating..." : "Create account"}- </Button>- </form>- )}- </AuthShell>- );+ return (+ <AuthShell+ icon={MailPlus}+ title={showDomainStep ? "Add your domain" : "Create your mailbox"}+ // description={+ // showDomainStep+ // ? "Connect the primary Cloudflare zone first so routing records can be created before the first mailbox."+ // : `Choose a mailbox username on ${accountDomain ?? "the primary domain"} and add a recovery email.`+ // }+ steps={+ firstRun+ ? [+ { label: "Domain", active: step === 1 },+ { label: "Account", active: step === 2 },+ ]+ : undefined+ }+ footer={+ <Link+ href="/login"+ className="inline-flex items-center gap-2 hover:underline"+ >+ Sign in instead+ <ArrowRight className="h-4 w-4" />+ </Link>+ }+ >+ {showDomainStep ? (+ <form onSubmit={onDomainSubmit} className="space-y-5">+ <div className="space-y-2">+ <Label htmlFor="domain">Primary domain</Label>+ <Input+ id="domain"+ name="domain"+ placeholder="example.com"+ autoComplete="url"+ required+ />+ <p className="text-xs leading-5 text-neutral-500">+ The domain must already be a Cloudflare zone on this account.+ </p>+ </div>+ {error && (+ <p className="rounded-2xl border border-red-100 bg-red-50 px-4 py-3 text-sm font-medium text-red-700">+ {error}+ </p>+ )}+ <Button+ type="submit"+ className="h-11 w-full rounded-full px-6 active:scale-[0.98]"+ disabled={loading}+ >+ {loading ? "Adding domain..." : "Continue"}+ </Button>+ </form>+ ) : (+ <form onSubmit={onSubmit} className="space-y-5">+ <div className="space-y-2">+ <Label htmlFor="username">Username</Label>+ <div className="grid grid-cols-[minmax(0,1fr)_auto] items-center gap-2 relative">+ <Input+ id="username"+ name="username"+ placeholder="you"+ autoComplete="username"+ required+ className="pr-34"+ />+ <span className="max-w-36 truncate text-sm font-medium text-neutral-500 absolute top-2.5 right-5">+ @{accountDomain ?? "domain"}+ </span>+ </div>+ </div>+ <div className="space-y-2">+ <Label htmlFor="password">Password</Label>+ <Input+ id="password"+ name="password"+ type="password"+ minLength={8}+ autoComplete="new-password"+ required+ />+ </div>++ <div className="space-y-2">+ <Label htmlFor="resetEmail">Recovery email</Label>+ <Input+ id="resetEmail"+ name="resetEmail"+ type="email"+ placeholder="[email protected]"+ required+ />+ {/* <p className="text-xs leading-5 text-neutral-500">Used later for password reset.</p> */}+ </div>++ {error && (+ <p className="rounded-2xl border border-red-100 bg-red-50 px-4 py-3 text-sm font-medium text-red-700">+ {error}+ </p>+ )}+ <Button+ type="submit"+ className="h-11 w-full rounded-full px-6 active:scale-[0.98] mt-8"+ disabled={loading || hasPrimaryDomain === null}+ >+ {loading ? "Creating..." : "Create account"}+ </Button>+ </form>+ )}+ </AuthShell>+ );}diff --git a/src/components/auth/auth-shell.tsx b/src/components/auth/auth-shell.tsxindex 5cf2fb9..81ceb96 100644--- a/src/components/auth/auth-shell.tsx+++ b/src/components/auth/auth-shell.tsx@@ -1,89 +1,19 @@-import { Inbox, MailCheck, Search, ShieldCheck } from "lucide-react";import type { AuthShellProps } from "./types";export function AuthShell({ icon: Icon, title, description, children, footer, steps }: AuthShellProps) {return (- <div className="min-h-[100dvh] bg-[#f6f8fc] p-4 text-neutral-900 sm:p-6">+ <div className="min-h-dvh bg-[#f6f8fc] p-4 text-neutral-900 sm:p-6"><div className="mx-auto flex min-h-[calc(100dvh-32px)] max-w-6xl items-center sm:min-h-[calc(100dvh-48px)]">- <div className="grid w-full overflow-hidden rounded-[2rem] border border-white bg-white shadow-[0_24px_70px_-45px_rgba(30,64,175,0.55)] lg:grid-cols-[1.05fr_440px]">- <section className="relative hidden min-h-[620px] overflow-hidden bg-[#f6f8fc] p-5 lg:block">- <div className="grid h-full grid-cols-[168px_1fr] overflow-hidden rounded-[1.5rem] border border-neutral-100 bg-white">- <aside className="flex flex-col gap-2 bg-[#f6f8fc] px-3 py-5">- <div className="mb-4 flex items-center gap-3 px-3 text-neutral-700">- <Inbox className="h-5 w-5" />- <span className="font-semibold">Mail</span>- </div>- <div className="mb-3 flex h-12 w-fit items-center gap-2 rounded-2xl bg-blue-100 px-5 text-sm font-semibold text-blue-950 shadow-sm">- <Icon className="h-4 w-4" />- Compose- </div>- {["Inbox", "Sent", "Drafts", "Settings"].map((item, index) => (- <div- key={item}- className={`flex h-9 items-center rounded-r-full px-3 text-sm font-medium ${- index === 0 ? "bg-blue-100 text-blue-950" : "text-neutral-600"- }`}- >- {item}- </div>- ))}- </aside>+ <div className="mx-auto bg-white overflow-hidden rounded-4xl shadow-lg shadow-neutral-200/50">- <div className="flex min-w-0 flex-col">- <div className="flex h-16 items-center gap-3 bg-[#f6f8fc] px-4">- <div className="flex h-12 flex-1 items-center gap-3 rounded-full bg-[#eaf1fb] px-4 text-neutral-600">- <Search className="h-5 w-5" />- <span className="text-[15px]">Search mail</span>- </div>- </div>- <div className="flex min-h-0 flex-1 flex-col overflow-hidden rounded-tl-3xl bg-white">- <div className="flex h-14 items-center justify-between border-b border-neutral-200 px-6">- <div className="flex items-center gap-3">- <h2 className="text-xl font-medium text-neutral-800">Inbox</h2>- <span className="rounded-full bg-neutral-100 px-2.5 py-1 text-xs font-medium text-neutral-600">- 4- </span>- </div>- <MailCheck className="h-4 w-4 text-neutral-400" />- </div>- <div className="divide-y divide-neutral-100">- {[- ["Route monitor", "DNS records verified", "Ready"],- ["API delivery", "Message accepted by worker", "Sent"],- ["Mailbox setup", "First address is active", "New"],- ["Security", "Session protected", "OK"],- ].map(([sender, subject, badge]) => (- <div- key={sender}- className="grid min-h-14 grid-cols-[minmax(110px,170px)_1fr_auto] items-center gap-3 px-5 text-sm hover:bg-[#f2f6fc]"- >- <span className="truncate font-semibold text-neutral-900">{sender}</span>- <span className="truncate font-medium text-neutral-700">{subject}</span>- <span className="rounded-full bg-blue-50 px-2.5 py-1 text-xs font-semibold text-blue-700">- {badge}- </span>- </div>- ))}- </div>- </div>- </div>- </div>- </section>-- <section className="flex min-h-[620px] flex-col justify-between p-6 sm:p-10">+ <section className="flex flex-col justify-between p-6 sm:p-10"><div>- <div className="mb-8 flex h-12 w-12 items-center justify-center rounded-2xl bg-blue-100 text-blue-700">- <Icon className="h-6 w-6" />- </div><div className="mb-8">- <div className="mb-3 flex items-center gap-2 text-sm font-semibold text-blue-700">- <ShieldCheck className="h-4 w-4" />- Cloudflare mail workspace- </div>+<h1 className="max-w-sm text-4xl font-semibold leading-tight tracking-tight text-neutral-950">{title}</h1>- <p className="mt-4 max-w-md text-sm leading-6 text-neutral-600">{description}</p>+ {description && <p className="mt-4 max-w-md text-sm leading-6 text-neutral-600">{description}</p>}</div>{steps && (<div className="mb-8 flex gap-2 text-xs font-semibold">diff --git a/src/components/auth/types.d.ts b/src/components/auth/types.d.tsindex 77d78c5..0aedaf0 100644--- a/src/components/auth/types.d.ts+++ b/src/components/auth/types.d.ts@@ -9,7 +9,7 @@ export type AuthShellStep = {export type AuthShellProps = {icon: LucideIcon;title: string;- description: ReactNode;+ description?: ReactNode;children: ReactNode;footer: ReactNode;steps?: AuthShellStep[];diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsxindex 69f98b5..62bb1ce 100644--- a/src/components/ui/button.tsx+++ b/src/components/ui/button.tsx@@ -14,9 +14,9 @@ const buttonVariants = cva(destructive: "bg-red-600 text-white hover:bg-red-700",},size: {- default: "h-10 px-4 py-2",- sm: "h-8 rounded-md px-3 text-xs",- lg: "h-11 rounded-md px-8",+ default: "h-10 px-6 py-2 rounded-xl",+ sm: "h-8 rounded-lg px-3 text-xs",+ lg: "h-11 rounded-xl px-8",},},defaultVariants: {diff --git a/src/components/ui/input.tsx b/src/components/ui/input.tsxindex 0b7ca8a..3b37894 100644--- a/src/components/ui/input.tsx+++ b/src/components/ui/input.tsx@@ -6,7 +6,7 @@ export const Input = React.forwardRef<HTMLInputElement, React.ComponentProps<"in<inputtype={type}className={cn(- "flex h-10 w-full rounded-md border border-neutral-200 bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-neutral-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50 dark:border-neutral-800",+ "flex h-10 w-full rounded-md border border-neutral-200 bg-transparent px-3 py-2 text-sm shadow-sm shadow-neutral-200/50 placeholder:text-neutral-500 focus-visible:outline-none focus-visible:border-blue-600 disabled:cursor-not-allowed disabled:opacity-50",className,)}ref={ref}