Skip to content

Email for professionals and teams

improve display for mobile

Hieu Nguyen (Jack)ac1101f28f46
diff --git a/src/app/(admin)/accounts/[id]/layout.tsx b/src/app/(admin)/accounts/[id]/layout.tsx
index 047faab..7da09cf 100644
--- a/src/app/(admin)/accounts/[id]/layout.tsx
+++ b/src/app/(admin)/accounts/[id]/layout.tsx
@@ -3,7 +3,7 @@ import { AccountSettingsNav } from "@/components/accounts/account-settings-nav";
export default function AccountSettingsLayout({ children }: { children: ReactNode }) {
return (
- <div className="flex min-h-[calc(100dvh-5rem)] flex-col gap-8 lg:flex-row">
+ <div className="flex min-h-[calc(100dvh-5rem)] flex-col gap-8 max-md:pb-20 md:flex-row">
<div className="min-w-0 flex-1">{children}</div>
<AccountSettingsNav />
</div>
diff --git a/src/app/(admin)/accounts/[id]/mailboxes/page.tsx b/src/app/(admin)/accounts/[id]/mailboxes/page.tsx
index 469ba16..25c429c 100644
--- a/src/app/(admin)/accounts/[id]/mailboxes/page.tsx
+++ b/src/app/(admin)/accounts/[id]/mailboxes/page.tsx
@@ -79,7 +79,7 @@ export default function AccountMailboxesPage() {
return (
<div className="space-y-6">
<div>
- <h1 className="text-3xl font-medium text-neutral-900">Mailboxes</h1>
+ <h1 className="text-2xl md:text-3xl font-medium text-neutral-900">Mailboxes</h1>
<p className="mt-2 text-sm text-neutral-500">
Manage inboxes owned by {account?.name ?? "this account"}.
</p>
diff --git a/src/app/(admin)/accounts/[id]/page.tsx b/src/app/(admin)/accounts/[id]/page.tsx
index 750059d..c8c2cfe 100644
--- a/src/app/(admin)/accounts/[id]/page.tsx
+++ b/src/app/(admin)/accounts/[id]/page.tsx
@@ -59,7 +59,7 @@ export default function AccountDetailsPage() {
return (
<div className="space-y-6">
<div>
- <h1 className="text-3xl font-medium text-neutral-900">Details</h1>
+ <h1 className="text-2xl md:text-3xl font-medium text-neutral-900">Details</h1>
<p className="mt-2 text-sm text-neutral-500">Update this account&apos;s profile and status.</p>
</div>
<section className="space-y-5 rounded-3xl bg-white p-6">
diff --git a/src/app/(admin)/accounts/[id]/password/page.tsx b/src/app/(admin)/accounts/[id]/password/page.tsx
index 4978f23..25dc2ee 100644
--- a/src/app/(admin)/accounts/[id]/password/page.tsx
+++ b/src/app/(admin)/accounts/[id]/password/page.tsx
@@ -25,7 +25,7 @@ export default function AccountPasswordPage() {
return (
<div className="space-y-6">
<div>
- <h1 className="text-3xl font-medium text-neutral-900">Password</h1>
+ <h1 className="text-2xl md:text-3xl font-medium text-neutral-900">Password</h1>
<p className="mt-2 text-sm text-neutral-500">Reset the password for {account?.name ?? "this account"}.</p>
</div>
<form
diff --git a/src/app/(admin)/accounts/[id]/permissions/page.tsx b/src/app/(admin)/accounts/[id]/permissions/page.tsx
index c33e36d..8ef3dd6 100644
--- a/src/app/(admin)/accounts/[id]/permissions/page.tsx
+++ b/src/app/(admin)/accounts/[id]/permissions/page.tsx
@@ -83,7 +83,7 @@ export default function AccountPermissionsPage() {
return (
<div className="space-y-6">
<div>
- <h1 className="text-3xl font-medium text-neutral-900">Permissions</h1>
+ <h1 className="text-2xl md:text-3xl font-medium text-neutral-900">Permissions</h1>
<p className="mt-2 text-sm text-neutral-500">Control what this account can manage.</p>
</div>
{account?.isPrimaryAdmin && (
diff --git a/src/app/(admin)/accounts/page.tsx b/src/app/(admin)/accounts/page.tsx
index fe895c3..8271b64 100644
--- a/src/app/(admin)/accounts/page.tsx
+++ b/src/app/(admin)/accounts/page.tsx
@@ -1,5 +1,6 @@
"use client";
+import { mobilePrimaryActionClass } from "@/components/page-header-utils";
import { useEffect, useState } from "react";
import Link from "next/link";
import { Plus } from "lucide-react";
@@ -87,7 +88,7 @@ export default function AccountsPage() {
}
return <div className="space-y-6">
- <div className="flex items-center justify-between gap-4"><div><h1 className="text-3xl font-medium text-neutral-900">Accounts</h1><p className="mt-2 text-sm text-neutral-500">Manage Team accounts and their inboxes.</p></div>{!teamRequired && canManage && <Button onClick={() => setCreateOpen(true)}><Plus className="h-4 w-4" />New account</Button>}</div>
+ <div className="flex items-center justify-between gap-4"><div><h1 className="text-2xl md:text-3xl font-medium text-neutral-900">Accounts</h1><p className="mt-2 text-sm text-neutral-500">Manage Team accounts and their inboxes.</p></div>{!teamRequired && canManage && <Button className={mobilePrimaryActionClass} onClick={() => setCreateOpen(true)}><Plus className="h-4 w-4" />New account</Button>}</div>
<div className="relative">{teamRequired && <LicenseRequiredOverlay required="Team"><div className="min-h-48 rounded-3xl bg-white" /></LicenseRequiredOverlay>}<List>
{loading && <p className="text-sm text-neutral-500">Loading...</p>}
{accounts.map((account) => {
diff --git a/src/app/(admin)/activity/page.tsx b/src/app/(admin)/activity/page.tsx
index 62ecc6b..5229018 100644
--- a/src/app/(admin)/activity/page.tsx
+++ b/src/app/(admin)/activity/page.tsx
@@ -20,7 +20,7 @@ export default function ActivityPage() {
return (
<div className="space-y-6">
<div>
- <h1 className="text-3xl font-medium text-neutral-900">Activity</h1>
+ <h1 className="text-2xl md:text-3xl font-medium text-neutral-900">Activity</h1>
<p className="mt-1 text-sm text-neutral-500">
Login and logout activity across user accounts.
</p>
diff --git a/src/app/(admin)/admin/page.tsx b/src/app/(admin)/admin/page.tsx
index 6c7c8d8..9973e4f 100644
--- a/src/app/(admin)/admin/page.tsx
+++ b/src/app/(admin)/admin/page.tsx
@@ -90,7 +90,7 @@ export default function AdminSettingsPage() {
return (
<div>
<div className="mb-8">
- <h1 className="text-3xl font-medium text-neutral-900">Admin settings</h1>
+ <h1 className="text-2xl md:text-3xl font-medium text-neutral-900">Admin settings</h1>
<p className="mt-2 text-sm text-neutral-500">
Manage workspace-level mail infrastructure and integrations.
</p>
diff --git a/src/app/(admin)/agent/page.tsx b/src/app/(admin)/agent/page.tsx
index 7152b4c..c05cdca 100644
--- a/src/app/(admin)/agent/page.tsx
+++ b/src/app/(admin)/agent/page.tsx
@@ -65,6 +65,8 @@ export default function AdminAgentPage() {
void loadAgentModels(form, controller.signal).then((data) => {
setModels(data.models);
setModelSource(data.source);
+ const published = Object.fromEntries(data.models.flatMap((item) => item.rates ? [[item.id, item.rates]] : []));
+ if (Object.keys(published).length) setForm((current) => ({ ...current, rates: { ...current.rates, ...published } }));
}).catch((error) => {
if (!controller.signal.aborted) setModelError(error instanceof Error ? error.message : "Could not load models");
}).finally(() => { if (!controller.signal.aborted) setModelsLoading(false); });
@@ -88,7 +90,7 @@ export default function AdminAgentPage() {
}
return <div className="space-y-6">
- <div className="flex items-start justify-between gap-4"><div><h1 className="text-3xl font-medium text-neutral-900">Agent</h1><p className="mt-2 text-sm text-neutral-500">Choose the AI provider and models used by the email assistant for chat and drafts.</p></div><Link href="/ai-usage" className="shrink-0 rounded-xl border border-neutral-200 bg-white px-4 py-2 text-sm font-medium text-neutral-800 hover:bg-neutral-50">View Usage</Link></div>
+ <div className="flex items-start justify-between gap-4"><div><h1 className="text-2xl md:text-3xl font-medium text-neutral-900">Agent</h1><p className="mt-2 text-sm text-neutral-500">Choose the AI provider and models used by the email assistant for chat and drafts.</p></div><Link href="/ai-usage" className="shrink-0 rounded-xl border border-neutral-200 bg-white px-4 py-2 text-sm font-medium text-neutral-800 hover:bg-neutral-50">View Usage</Link></div>
<Card className="rounded-3xl border-0 bg-white p-6">
<CardContent className="flex items-center justify-between gap-4 p-0">
<div><p className="font-medium text-neutral-900">Enable assistant</p><p className="mt-1 text-sm text-neutral-500">Show assistant chat and allow automatic drafts for everyone.</p></div>
@@ -103,14 +105,14 @@ export default function AdminAgentPage() {
<Card className="rounded-3xl border-0 bg-white p-6">
<CardHeader className="py-0"><CardTitle className="flex items-center gap-2"><Bot className="h-5 w-5" />AI provider</CardTitle><CardDescription>Email content is sent to the selected provider when someone uses the assistant. Sending a draft still requires human approval.</CardDescription></CardHeader>
<CardContent className="pt-6"><form onSubmit={submit} className="space-y-5">
- <div className="space-y-2"><Label htmlFor="agent-provider">Provider</Label><select id="agent-provider" className="flex h-10 w-full rounded-md border border-input bg-background px-3 text-sm" value={form.provider} disabled={!loaded} onChange={(event) => setForm((current) => ({ ...current, provider: event.target.value as AgentAdminForm["provider"], baseUrl: event.target.value === "compatible" ? baseUrlForPreset(current.preset, current.baseUrl) : "", model: event.target.value === "cloudflare" ? DEFAULT_CLOUDFLARE_MODEL : "" }))}><option value="cloudflare">Cloudflare Workers AI</option><option value="compatible">OpenAI-compatible provider</option></select>{form.provider === "cloudflare" && !cloudflareAvailable && <p className="text-xs text-amber-700">Cloudflare Workers AI requires an AI binding on this installation.</p>}</div>
+ <div className="space-y-2"><Label htmlFor="agent-provider">Provider</Label><select id="agent-provider" className="flex h-10 w-full rounded-md border border-neutral-200 bg-transparent px-3 text-sm shadow-sm shadow-neutral-200/50 focus-visible:border-blue-600 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50" value={form.provider} disabled={!loaded} onChange={(event) => setForm((current) => ({ ...current, provider: event.target.value as AgentAdminForm["provider"], baseUrl: event.target.value === "compatible" ? baseUrlForPreset(current.preset, current.baseUrl) : "", model: event.target.value === "cloudflare" ? DEFAULT_CLOUDFLARE_MODEL : "" }))}><option value="cloudflare">Cloudflare Workers AI</option><option value="compatible">OpenAI-compatible provider</option></select>{form.provider === "cloudflare" && !cloudflareAvailable && <p className="text-xs text-amber-700">Cloudflare Workers AI requires an AI binding on this installation.</p>}</div>
{form.provider === "compatible" && <>
- <div className="space-y-2"><Label htmlFor="agent-preset">Provider template</Label><select id="agent-preset" className="flex h-10 w-full rounded-md border border-input bg-background px-3 text-sm" value={form.preset} onChange={(event) => { const preset = event.target.value as AgentProviderPreset; setForm((current) => ({ ...current, preset, baseUrl: baseUrlForPreset(preset), apiKey: "", model: "" })); }}>{PROVIDER_PRESETS.map((item) => <option key={item.id} value={item.id}>{item.label}</option>)}</select></div>
+ <div className="space-y-2"><Label htmlFor="agent-preset">Provider template</Label><select id="agent-preset" className="flex h-10 w-full rounded-md border border-neutral-200 bg-transparent px-3 text-sm shadow-sm shadow-neutral-200/50 focus-visible:border-blue-600 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50" value={form.preset} onChange={(event) => { const preset = event.target.value as AgentProviderPreset; setForm((current) => ({ ...current, preset, baseUrl: baseUrlForPreset(preset), apiKey: "", model: "" })); }}>{PROVIDER_PRESETS.map((item) => <option key={item.id} value={item.id}>{item.label}</option>)}</select></div>
<div className="space-y-2"><Label htmlFor="agent-url">API base URL</Label><Input id="agent-url" type="url" value={form.baseUrl} readOnly={form.preset !== "custom"} placeholder="https://provider.example/v1" onChange={(event) => setForm((current) => ({ ...current, baseUrl: event.target.value, model: "" }))} required /></div>
<div className="space-y-2"><Label htmlFor="agent-key">API key</Label><Input id="agent-key" type="password" value={form.apiKey} autoComplete="new-password" placeholder={canUseSavedKey ? "Saved key (leave blank to keep)" : "Enter API key"} onChange={(event) => setForm((current) => ({ ...current, apiKey: event.target.value }))} /><p className="text-xs text-neutral-500">{canUseSavedKey ? "An API key is saved on the server. Enter a new one to replace it." : "The API key is stored on the server and is never shown again."}</p></div>
</>}
- <div className="space-y-2"><p className="text-sm font-medium">Models</p><div className="max-h-64 space-y-2 overflow-y-auto rounded-md border border-input p-3">{modelsLoading && <p className="text-sm text-neutral-500">Loading models…</p>}{!modelsLoading && !models.length && <p className="text-sm text-neutral-500">Models unavailable</p>}{models.map((item) => <label key={item.id} className="flex items-start gap-2 text-sm"><Checkbox checked={selectedModelIds.includes(item.id)} onChange={(event) => setForm((current) => ({ ...current, model: toggleAgentModelId(current.model, item.id, event.target.checked) }))} /><span>{item.name === item.id ? item.id : `${item.name} · ${item.id}`}</span></label>)}</div>{modelSource === "suggested" && <p className="text-xs text-neutral-500">Showing suggested Cloudflare models because a full catalog is unavailable.</p>}{modelError && <p className="text-xs text-amber-700">{modelError}</p>}<Label htmlFor="agent-model-id" className="block pt-2 text-xs text-neutral-500">Or enter model IDs (comma-separated)</Label><Input id="agent-model-id" value={form.model} onChange={(event) => setForm((current) => ({ ...current, model: event.target.value }))} placeholder={form.provider === "cloudflare" ? DEFAULT_CLOUDFLARE_MODEL : "provider/model-id, provider/another-model"} required /><p className="text-xs text-neutral-500">Choose models that support tool calling so the assistant can read mail and create drafts. The first model is the default.</p></div>
- <div className="space-y-3"><p className="text-sm font-medium">Estimated cost rates</p><p className="text-xs text-neutral-500">Optional USD per 1 million tokens. Usage without both rates shows spending as unavailable.</p>{selectedModelIds.map((model) => <div key={model} className="grid gap-2 rounded-xl border border-neutral-200 p-3 sm:grid-cols-[minmax(0,1fr)_6rem_6rem]"><span className="min-w-0 break-all text-sm">{model}</span><label className="text-xs text-neutral-500">Input <Input type="number" min="0" step="any" value={form.rates[model]?.input ?? ""} onChange={(event) => setForm((current) => updateAgentModelRate(current, model, "input", event.target.value))} placeholder="USD / 1M" /></label><label className="text-xs text-neutral-500">Output <Input type="number" min="0" step="any" value={form.rates[model]?.output ?? ""} onChange={(event) => setForm((current) => updateAgentModelRate(current, model, "output", event.target.value))} placeholder="USD / 1M" /></label></div>)}</div>
+ <div className="space-y-2"><p className="text-sm font-medium">Models</p><div className="max-h-64 space-y-2 overflow-y-auto rounded-md border border-neutral-200 p-3">{modelsLoading && <p className="text-sm text-neutral-500">Loading models…</p>}{!modelsLoading && !models.length && <p className="text-sm text-neutral-500">Models unavailable</p>}{models.map((item) => <label key={item.id} className="flex items-start gap-2 text-sm"><Checkbox checked={selectedModelIds.includes(item.id)} onChange={(event) => setForm((current) => ({ ...current, model: toggleAgentModelId(current.model, item.id, event.target.checked) }))} /><span>{item.name === item.id ? item.id : `${item.name} · ${item.id}`}</span></label>)}</div>{modelSource === "suggested" && <p className="text-xs text-neutral-500">Showing suggested Cloudflare models because a full catalog is unavailable.</p>}{modelError && <p className="text-xs text-amber-700">{modelError}</p>}<Label htmlFor="agent-model-id" className="block pt-2 text-xs text-neutral-500">Or enter model IDs (comma-separated)</Label><Input id="agent-model-id" value={form.model} onChange={(event) => setForm((current) => ({ ...current, model: event.target.value }))} placeholder={form.provider === "cloudflare" ? DEFAULT_CLOUDFLARE_MODEL : "provider/model-id, provider/another-model"} required /><p className="text-xs text-neutral-500">Choose models that support tool calling so the assistant can read mail and create drafts. The first model is the default.</p></div>
+ <div className="space-y-3"><p className="text-sm font-medium">Estimated cost rates</p><p className="text-xs text-neutral-500">USD per 1 million tokens. Rates published by the provider are used automatically; enter them yourself for models that don't publish any. Usage without both rates shows spending as unavailable.</p>{selectedModelIds.map((model) => models.find((item) => item.id === model)?.rates ? <div key={model} className="grid gap-2 rounded-xl border border-neutral-200 p-3 text-sm sm:grid-cols-[minmax(0,1fr)_auto]"><span className="min-w-0 break-all">{model}</span><span className="text-neutral-500">Input ${form.rates[model]?.input} · Output ${form.rates[model]?.output} / 1M <span className="text-xs">(from provider)</span></span></div> : <div key={model} className="grid gap-2 rounded-xl border border-neutral-200 p-3 sm:grid-cols-[minmax(0,1fr)_6rem_6rem]"><span className="min-w-0 break-all text-sm">{model}</span><label className="text-xs text-neutral-500">Input <Input type="number" min="0" step="any" value={form.rates[model]?.input ?? ""} onChange={(event) => setForm((current) => updateAgentModelRate(current, model, "input", event.target.value))} placeholder="USD / 1M" /></label><label className="text-xs text-neutral-500">Output <Input type="number" min="0" step="any" value={form.rates[model]?.output ?? ""} onChange={(event) => setForm((current) => updateAgentModelRate(current, model, "output", event.target.value))} placeholder="USD / 1M" /></label></div>)}</div>
{status && <p role="status" className="text-sm text-neutral-700">{status}</p>}
<Button type="submit" disabled={!loaded || saving || !selectedModelIds.length || (form.provider === "cloudflare" && !cloudflareAvailable) || (form.provider === "compatible" && (!form.baseUrl || (!form.apiKey.trim() && !canUseSavedKey))) }>{saving ? "Saving…" : "Save agent settings"}</Button>
</form></CardContent>
diff --git a/src/app/(admin)/ai-usage/page.tsx b/src/app/(admin)/ai-usage/page.tsx
index 898f457..61a1b66 100644
--- a/src/app/(admin)/ai-usage/page.tsx
+++ b/src/app/(admin)/ai-usage/page.tsx
@@ -20,7 +20,7 @@ export default function AiUsagePage() {
const totals = data?.totals;
return <div className="space-y-6">
- <div className="flex items-start justify-between gap-4"><div><h1 className="text-3xl font-medium text-neutral-900">AI Usage</h1><p className="mt-2 text-sm text-neutral-500">Requests recorded since usage tracking was added.</p></div><Link href="/agent" className="shrink-0 text-sm font-medium text-blue-700 hover:underline">Back to Agent</Link></div>
+ <div className="flex items-start justify-between gap-4"><div><h1 className="text-2xl md:text-3xl font-medium text-neutral-900">AI Usage</h1><p className="mt-2 text-sm text-neutral-500">Requests recorded since usage tracking was added.</p></div><Link href="/agent" className="shrink-0 text-sm font-medium text-blue-700 hover:underline">Back to Agent</Link></div>
{error && <p role="alert" className="text-sm text-red-700">{error}</p>}
<div className="grid gap-4 sm:grid-cols-3">
<section className="rounded-2xl bg-white p-5"><p className="text-sm text-neutral-500">Total tokens</p><p className="mt-2 text-2xl font-semibold text-neutral-900">{totals ? formatTokenCount(totals.totalTokens) : "—"}</p></section>
diff --git a/src/app/(admin)/api-keys/page.tsx b/src/app/(admin)/api-keys/page.tsx
index 972c5d2..2fcd58f 100644
--- a/src/app/(admin)/api-keys/page.tsx
+++ b/src/app/(admin)/api-keys/page.tsx
@@ -1,5 +1,6 @@
"use client";
+import { mobilePrimaryActionClass } from "@/components/page-header-utils";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { useState } from "react";
import { Copy, KeyRound, Plus, Trash2 } from "lucide-react";
@@ -73,10 +74,10 @@ export default function ApiKeysPage() {
return (
<div className="space-y-6">
<div className="flex items-center justify-between gap-4">
- <h1 className="text-3xl font-medium">Admin API keys</h1>
+ <h1 className="text-2xl md:text-3xl font-medium">Admin API keys</h1>
<Dialog open={createOpen} onOpenChange={(open) => { if (create.isPending) return; setCreateOpen(open); if (!open) { setNewKey(null); setCopied(false); } }}>
<DialogTrigger asChild>
- <Button>
+ <Button className={mobilePrimaryActionClass}>
<Plus className="h-4 w-4" />
New API key
</Button>
diff --git a/src/app/(admin)/backups/page.tsx b/src/app/(admin)/backups/page.tsx
index f360cf4..ead9fe2 100644
--- a/src/app/(admin)/backups/page.tsx
+++ b/src/app/(admin)/backups/page.tsx
@@ -115,7 +115,7 @@ export default function BackupsPage() {
<div className="space-y-6">
<div className="flex items-start justify-between gap-4">
<div>
- <h1 className="text-3xl font-medium text-neutral-900">
+ <h1 className="text-2xl md:text-3xl font-medium text-neutral-900">
Database Backups
</h1>
<p className="mt-1 text-sm text-neutral-500">
diff --git a/src/app/(admin)/branding/page.tsx b/src/app/(admin)/branding/page.tsx
index b213c9f..f286758 100644
--- a/src/app/(admin)/branding/page.tsx
+++ b/src/app/(admin)/branding/page.tsx
@@ -26,7 +26,7 @@ export default function BrandingPage() {
return (
<div className="space-y-6">
<div>
- <h1 className="text-3xl font-medium text-neutral-900">Branding</h1>
+ <h1 className="text-2xl md:text-3xl font-medium text-neutral-900">Branding</h1>
<p className="mt-2 text-sm text-neutral-500">Custom branding is available with a Pro or Team license.</p>
</div>
<Card className="rounded-3xl border-0 bg-white p-6">
@@ -68,7 +68,7 @@ export default function BrandingPage() {
return (
<div className="space-y-6">
<div>
- <h1 className="text-3xl font-medium text-neutral-900">Branding</h1>
+ <h1 className="text-2xl md:text-3xl font-medium text-neutral-900">Branding</h1>
<p className="mt-2 text-sm text-neutral-500">Customize the app identity shown to everyone using this installation.</p>
</div>
<Card className="rounded-3xl border-0 bg-white p-6">
diff --git a/src/app/(admin)/domains/DomainItemCard.tsx b/src/app/(admin)/domains/DomainItemCard.tsx
index b8b36a7..3a54fef 100644
--- a/src/app/(admin)/domains/DomainItemCard.tsx
+++ b/src/app/(admin)/domains/DomainItemCard.tsx
@@ -39,8 +39,8 @@ export default function DomainItemCard({
const auth = dns?.auth;
return (
- <ListRow className="group relative flex-col items-stretch gap-3">
- <div className="flex items-start gap-4">
+ <ListRow className="group relative flex-col items-stretch gap-3 max-md:rounded-none max-md:border-b max-md:border-neutral-100 max-md:px-0 max-md:py-4 max-md:last:border-b-0">
+ <div className="flex flex-col items-start gap-3 md:flex-row md:gap-4">
<span className="relative flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-neutral-100 text-neutral-600">
<Globe2 className="h-5 w-5" />
<img
@@ -51,7 +51,7 @@ export default function DomainItemCard({
/>
</span>
- <div className="flex min-w-0 flex-1 flex-col gap-2">
+ <div className="flex w-full min-w-0 flex-1 flex-col gap-2">
<span className="min-w-0 truncate pr-10 text-sm font-semibold text-neutral-900">
{item.hostname}
</span>
diff --git a/src/app/(admin)/domains/page.tsx b/src/app/(admin)/domains/page.tsx
index 9a9425d..f7e492f 100644
--- a/src/app/(admin)/domains/page.tsx
+++ b/src/app/(admin)/domains/page.tsx
@@ -1,5 +1,6 @@
"use client";
+import { mobilePrimaryActionClass } from "@/components/page-header-utils";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { useRef, useState } from "react";
import { Button } from "@/components/ui/button";
@@ -205,7 +206,7 @@ export default function DomainsPage() {
<div className="space-y-6">
<div className="flex items-center justify-between gap-4">
<div>
- <h1 className="text-3xl font-medium">Domains</h1>
+ <h1 className="text-2xl md:text-3xl font-medium">Domains</h1>
<p className="mt-1 text-sm text-neutral-500">
{managesDns
? "Domains must be on your Cloudflare account. Email Routing is enabled automatically, and Email Sending can be enabled when available."
@@ -214,7 +215,7 @@ export default function DomainsPage() {
</div>
<Dialog open={createOpen} onOpenChange={setCreateOpen}>
<DialogTrigger asChild>
- <Button>
+ <Button className={mobilePrimaryActionClass}>
<Plus className="h-4 w-4" />
New domain
</Button>
diff --git a/src/app/(admin)/general/page.tsx b/src/app/(admin)/general/page.tsx
index b36ad2a..503a568 100644
--- a/src/app/(admin)/general/page.tsx
+++ b/src/app/(admin)/general/page.tsx
@@ -35,7 +35,7 @@ export default function GeneralSettingsPage() {
}
return <div className="space-y-6">
- <div><h1 className="text-3xl font-medium text-neutral-900">General</h1><p className="mt-2 text-sm text-neutral-500">Set limits for outgoing mail.</p></div>
+ <div><h1 className="text-2xl md:text-3xl font-medium text-neutral-900">General</h1><p className="mt-2 text-sm text-neutral-500">Set limits for outgoing mail.</p></div>
<Card className="rounded-3xl border-0 bg-white p-6">
<CardHeader className="py-0"><CardTitle>File attachments</CardTitle></CardHeader>
<CardContent className="pt-6"><form onSubmit={save} className="space-y-4">
diff --git a/src/app/(admin)/layout.tsx b/src/app/(admin)/layout.tsx
index bd160af..e02fff8 100644
--- a/src/app/(admin)/layout.tsx
+++ b/src/app/(admin)/layout.tsx
@@ -1,7 +1,6 @@
"use client";
import Link from "next/link";
-import { usePathname } from "next/navigation";
import { HelpCircle, Search } from "lucide-react";
import { AuthGuard } from "@/components/auth/auth-guard";
import { ComposeProvider } from "@/components/compose/compose-context";
@@ -11,6 +10,10 @@ import { MailboxSelector } from "@/components/mailbox-selector";
import { LicenseIndicator } from "@/components/license-indicator";
import { AdminNav } from "@/components/admin-nav";
import { SidebarProvider } from "@/components/sidebar-state";
+import clsx from "clsx";
+import { usePathname } from "next/navigation";
+import { adminPageTitles } from "@/components/admin-page-titles";
+import { SidebarAside, MobileTopBar } from "@/components/sidebar-aside";
import { SidebarResizeBoundary } from "@/components/sidebar-resize-boundary";
import { ShortcutsProvider } from "@/components/shortcuts";
@@ -37,25 +40,28 @@ export default function DashboardLayout({
(prefix) => pathname === prefix || pathname.startsWith(`${prefix}/`),
);
+ const mobileTitle = adminPageTitles[pathname];
+
return (
<AuthGuard requireMailbox requireRole="admin" requirePrimary={requirePrimary}>
- <SidebarProvider expandedWidth={256}>
+ <SidebarProvider expandedWidth={256} mobileOverlay>
<MailboxProvider>
<ComposeProvider>
<ShortcutsProvider>
- <div className="grid h-dvh grid-cols-[72px_minmax(0,1fr)] md:grid-cols-[var(--sidebar-width)_minmax(0,1fr)] overflow-hidden bg-[#f6f8fc] transition-[grid-template-columns]" style={{ transitionDuration: "var(--sidebar-transition-duration)" }}>
- <aside className="relative z-30 w-[var(--sidebar-width)] min-h-0 min-w-0 bg-[#f6f8fc]">
+ <div className="grid h-dvh grid-cols-[minmax(0,1fr)] md:grid-cols-[var(--sidebar-width)_minmax(0,1fr)] overflow-hidden bg-[#f6f8fc] transition-[grid-template-columns]" style={{ transitionDuration: "var(--sidebar-transition-duration)" }}>
+ <SidebarAside>
<div className="h-full overflow-y-auto overscroll-contain px-3 py-4 scrollbar-gutter-stable">
<AdminNav />
</div>
<SidebarResizeBoundary />
- </aside>
+ </SidebarAside>
<div className="flex min-h-0 min-w-0 flex-col">
+ <MobileTopBar title={mobileTitle} />
<span className="fixed top-2 right-4 flex items-center gap-4 z-90">
<LicenseIndicator />
<MailboxSelector />
</span>
- <main className="min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain rounded-tl-3xl px-6 py-10 scrollbar-gutter-stable lg:px-12">
+ <main className={clsx("page-flush min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain rounded-tl-3xl max-md:rounded-t-3xl max-md:bg-white max-md:pb-24 px-6 py-10 scrollbar-gutter-stable lg:px-12", mobileTitle && "max-md:[&_h1]:hidden")}>
<div className="w-full max-w-3xl">{children}</div>
</main>
</div>
diff --git a/src/app/(admin)/licenses/page.tsx b/src/app/(admin)/licenses/page.tsx
index 64409e7..4f95155 100644
--- a/src/app/(admin)/licenses/page.tsx
+++ b/src/app/(admin)/licenses/page.tsx
@@ -15,7 +15,7 @@ export default function LicensesPage() {
return (
<div className="space-y-6">
<div>
- <h1 className="text-3xl font-medium text-neutral-900">Licenses</h1>
+ <h1 className="text-2xl md:text-3xl font-medium text-neutral-900">Licenses</h1>
<p className="mt-2 text-sm text-neutral-500">
Choose a one-time license. Each purchase includes updates released
during the first year.
diff --git a/src/app/(admin)/mailboxes/[id]/page.tsx b/src/app/(admin)/mailboxes/[id]/page.tsx
index f7d896a..d3ab25f 100644
--- a/src/app/(admin)/mailboxes/[id]/page.tsx
+++ b/src/app/(admin)/mailboxes/[id]/page.tsx
@@ -117,7 +117,7 @@ export default function MailboxSettingsPage() {
<div className="space-y-6">
<div className="flex items-start justify-between gap-4">
<div className="min-w-0">
- <h1 className="truncate text-3xl font-medium text-neutral-900">
+ <h1 className="truncate text-2xl md:text-3xl font-medium text-neutral-900">
Settings
</h1>
{address ? (
diff --git a/src/app/(admin)/mailboxes/page.tsx b/src/app/(admin)/mailboxes/page.tsx
index b74a99f..267e784 100644
--- a/src/app/(admin)/mailboxes/page.tsx
+++ b/src/app/(admin)/mailboxes/page.tsx
@@ -1,5 +1,6 @@
"use client";
+import { mobilePrimaryActionClass } from "@/components/page-header-utils";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import Link from "next/link";
import { useRouter } from "next/navigation";
@@ -121,10 +122,10 @@ export default function MailboxesPage() {
return (
<div className="space-y-6">
<div className="flex items-center justify-between gap-4">
- <h1 className="text-3xl font-medium">Mailboxes</h1>
+ <h1 className="text-2xl md:text-3xl font-medium">Mailboxes</h1>
<Dialog open={createOpen} onOpenChange={setCreateOpen}>
<DialogTrigger asChild>
- <Button>
+ <Button className={mobilePrimaryActionClass}>
<Plus className="h-4 w-4" />
New mailbox
</Button>
diff --git a/src/app/(admin)/routing/page.tsx b/src/app/(admin)/routing/page.tsx
index 9cd1e2c..069d1f1 100644
--- a/src/app/(admin)/routing/page.tsx
+++ b/src/app/(admin)/routing/page.tsx
@@ -20,7 +20,7 @@ export default function RoutingPage() {
return (
<div className="space-y-8">
<div>
- <h1 className="text-3xl font-medium text-neutral-900">Routing</h1>
+ <h1 className="text-2xl md:text-3xl font-medium text-neutral-900">Routing</h1>
<p className="mt-1 text-sm text-neutral-500">
Configure domain-wide delivery, forwarding, and blocking rules.
</p>
diff --git a/src/app/(admin)/webhooks/page.tsx b/src/app/(admin)/webhooks/page.tsx
index fc58d63..53229ac 100644
--- a/src/app/(admin)/webhooks/page.tsx
+++ b/src/app/(admin)/webhooks/page.tsx
@@ -1,5 +1,6 @@
"use client";
+import { mobilePrimaryActionClass } from "@/components/page-header-utils";
import { useState } from "react";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { Activity, Plus, RefreshCw, Send, Trash2 } from "lucide-react";
@@ -94,6 +95,7 @@ export default function WebhooksPage() {
</p>
</div>
<Button
+ className={mobilePrimaryActionClass}
onClick={() => {
setError(null);
setDialogOpen(true);
diff --git a/src/app/(calendar)/booking/page.tsx b/src/app/(calendar)/booking/page.tsx
index f90699c..0ad242f 100644
--- a/src/app/(calendar)/booking/page.tsx
+++ b/src/app/(calendar)/booking/page.tsx
@@ -2,6 +2,7 @@
import { useEffect, useState } from "react";
import Link from "next/link";
+import { mobilePrimaryActionClass } from "@/components/page-header-utils";
import clsx from "clsx";
import { CalendarDays, Check, Clock3, Copy, ExternalLink, MapPin, MoreHorizontal, Plus } from "lucide-react";
import toast, { Toaster } from "react-hot-toast";
@@ -18,7 +19,8 @@ import type { BookingEvent, BookingForm, BookingHost } from "./types";
import { availabilityLabel, durationLabel, emptyBookingForm, formFromEvent } from "./utils";
export default function BookingsPage() {
- const { minimal } = useSidebar();
+ const { minimal: sidebarMinimal, mobile } = useSidebar();
+ const minimal = sidebarMinimal || mobile;
const [events, setEvents] = useState<BookingEvent[]>([]);
const [username, setUsername] = useState("");
const [hosts, setHosts] = useState<BookingHost[]>([]);
@@ -107,32 +109,32 @@ export default function BookingsPage() {
catch { toast.error("Could not copy booking link."); }
}
- return <div className={clsx("flex h-full min-h-0 flex-col bg-[#f6f8fc] pl-3 transition-[gap] duration-200 ease-in-out motion-reduce:transition-none lg:flex-row", minimal ? "gap-0" : "gap-3")}>
+ return <div className={clsx("flex h-full min-h-0 flex-col bg-[#f6f8fc] pl-3 max-md:pl-0 transition-[gap] duration-200 ease-in-out motion-reduce:transition-none lg:flex-row", minimal ? "gap-0" : "gap-3")}>
<Toaster position="bottom-right" />
{loading && <RouteLoadingBar />}
<UpcomingSidebar />
- <section className="min-h-0 min-w-0 flex-1 overflow-hidden overscroll-contain">
+ <section className="min-h-0 min-w-0 flex-1 overflow-hidden overscroll-contain max-md:rounded-t-3xl max-md:bg-white">
<div className="flex h-full min-h-0 min-w-0">
<div className="min-w-0 flex-1 overflow-y-auto overscroll-contain scrollbar-gutter-stable">
<div className="mx-auto max-w-6xl px-5 md:px-8">
- <section aria-label="Booking events" className="space-y-1 pt-3">
+ <section aria-label="Booking events" className="space-y-1 pt-3 max-md:pb-24">
- <div className="flex flex-wrap items-start justify-between gap-4 pb-6">
- <div><h1 className="text-3xl font-semibold text-neutral-900">Bookings</h1><p className="mt-1 text-sm text-neutral-500">Set the meetings people can book with you.</p></div>
- <div className="flex items-center gap-2">
+ <div className="flex flex-wrap items-start justify-between gap-4 pb-6 max-md:flex-nowrap max-md:gap-2">
+ <div className="min-w-0"><h1 className="text-xl font-semibold text-neutral-900 md:text-3xl">Bookings</h1><p className="mt-1 text-sm text-neutral-500">Set the meetings people can book with you.</p></div>
+ <div className="flex shrink-0 items-center gap-2">
- <Button variant="ghost" className="w-10">
+ <Button variant="ghost" className="w-10 max-md:-mr-2">
<Link href={`/c/${username}`} target="_blank" className="text-blue-700 underline underline-offset-2">
<ExternalLink size={18} />
</Link>
</Button>
- <Button type="button" onClick={startCreate} disabled={!currentUserId} className="rounded-full"><Plus size={18} />New event</Button></div>
+ <Button type="button" onClick={startCreate} disabled={!currentUserId} className={clsx("rounded-full", mobilePrimaryActionClass)}><Plus size={18} />New event</Button></div>
</div>
- {loading ? <BookingListSkeleton /> : listEvents.length === 0 ? <div className="rounded-2xl border border-dashed border-neutral-300 bg-white px-6 py-12 text-center"><CalendarDays className="mx-auto mb-3 h-8 w-8 text-neutral-400" /><h2 className="font-medium text-neutral-900">No booking events yet</h2><p className="mt-1 text-sm text-neutral-500">Create an event to share your availability.</p></div> : listEvents.map((event, i) => <article key={event.id} className={clsx(!event.enabled && "opacity-65", `relative flex flex-wrap items-center gap-4 rounded-md bg-white px-5 py-5`, i === 0 && "rounded-t-3xl")}>
- <div className="flex min-w-0 flex-1 items-start gap-4"><span className={`mt-1 flex h-5 w-5 shrink-0 items-center justify-center rounded-md border ${event.enabled ? "border-blue-600 bg-blue-600 text-white" : "border-neutral-300"}`}>{event.enabled && <Check className="h-3.5 w-3.5" />}</span><div className="min-w-0"><button type="button" onClick={() => startEdit(event)} className="text-left text-lg font-semibold text-neutral-900 hover:text-blue-700">{event.name}</button>{event.description && <p className="mt-1 line-clamp-2 whitespace-pre-wrap text-sm text-neutral-600">{event.description}</p>}<p className="mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-neutral-500"><span className="inline-flex items-center gap-1"><Clock3 className="h-3.5 w-3.5" />{durationLabel(event.durationMinutes)}</span><span>·</span><span className="inline-flex items-center gap-1"><MapPin className="h-3.5 w-3.5" />{event.location || "No location set"}</span></p><p className="mt-2 text-sm text-neutral-500">{availabilityLabel(event)}</p></div></div>
- <div className="ml-auto flex items-center gap-2">{event.enabled ? <><Button type="button" variant="outline" onClick={() => void copyLink(event)} className="h-9 rounded-full px-3"><Copy className="h-4 w-4" />Copy link</Button>{username && <Link href={`/c/${username}/${event.slug}`} target="_blank" aria-label={`Open booking page for ${event.name}`} className="rounded-full p-2 text-neutral-600 hover:bg-neutral-100"><ExternalLink className="h-4 w-4" /></Link>}</> : <Button type="button" variant="outline" disabled={event.isTemplate && savingTemplateId !== null} onClick={() => void setEnabled(event, true)} className="h-9 rounded-full px-3">{savingTemplateId === event.id ? "Turning on…" : "Turn on"}</Button>}
+ {loading ? <BookingListSkeleton /> : listEvents.length === 0 ? <div className="rounded-2xl border border-dashed border-neutral-300 bg-white px-6 py-12 text-center"><CalendarDays className="mx-auto mb-3 h-8 w-8 text-neutral-400" /><h2 className="font-medium text-neutral-900">No booking events yet</h2><p className="mt-1 text-sm text-neutral-500">Create an event to share your availability.</p></div> : listEvents.map((event, i) => <article key={event.id} className={clsx(!event.enabled && "opacity-65", `relative flex flex-wrap items-center gap-4 rounded-md bg-white px-5 py-5 max-md:gap-3 max-md:rounded-none max-md:border-b max-md:border-neutral-100 max-md:px-0 max-md:py-4 max-md:last:border-b-0`, i === 0 && "rounded-t-3xl")}>
+ <div className="flex min-w-0 flex-1 items-start gap-4"><span className={`mt-1 flex h-5 w-5 shrink-0 items-center justify-center rounded-md border ${event.enabled ? "border-blue-600 bg-blue-600 text-white" : "border-neutral-300"}`}>{event.enabled && <Check className="h-3.5 w-3.5" />}</span><div className="min-w-0"><button type="button" onClick={() => startEdit(event)} className="text-left text-lg font-semibold text-neutral-900 hover:text-blue-700 max-md:text-base">{event.name}</button>{event.description && <p className="mt-1 line-clamp-2 whitespace-pre-wrap text-sm text-neutral-600">{event.description}</p>}<p className="mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-neutral-500"><span className="inline-flex items-center gap-1"><Clock3 className="h-3.5 w-3.5" />{durationLabel(event.durationMinutes)}</span><span>·</span><span className="inline-flex items-center gap-1"><MapPin className="h-3.5 w-3.5" />{event.location || "No location set"}</span></p><p className="mt-2 text-sm text-neutral-500">{availabilityLabel(event)}</p></div></div>
+ <div className="ml-auto flex items-center gap-2 max-md:ml-9 max-md:w-full">{event.enabled ? <><Button type="button" variant="outline" onClick={() => void copyLink(event)} className="h-9 rounded-full px-3"><Copy className="h-4 w-4" />Copy link</Button>{username && <Link href={`/c/${username}/${event.slug}`} target="_blank" aria-label={`Open booking page for ${event.name}`} className="rounded-full p-2 text-neutral-600 hover:bg-neutral-100"><ExternalLink className="h-4 w-4" /></Link>}</> : <Button type="button" variant="outline" disabled={event.isTemplate && savingTemplateId !== null} onClick={() => void setEnabled(event, true)} className="h-9 rounded-full px-3">{savingTemplateId === event.id ? "Turning on…" : "Turn on"}</Button>}
{!event.isTemplate && <div className="relative"><button type="button" aria-label={`More options for ${event.name}`} aria-expanded={menuId === event.id} onClick={() => setMenuId(menuId === event.id ? null : event.id)} className="rounded-full p-2 text-neutral-600 hover:bg-neutral-100"><MoreHorizontal className="h-5 w-5" /></button>{menuId === event.id && <div className="absolute right-0 top-10 z-10 w-36 rounded-xl border border-neutral-200 bg-white p-1 shadow-lg"><button type="button" onClick={() => startEdit(event)} className="block w-full rounded-lg px-3 py-2 text-left text-sm hover:bg-neutral-100">Edit</button><button type="button" onClick={() => void setEnabled(event, !event.enabled)} className="block w-full rounded-lg px-3 py-2 text-left text-sm hover:bg-neutral-100">Turn {event.enabled ? "off" : "on"}</button><button type="button" onClick={() => void remove(event)} className="block w-full rounded-lg px-3 py-2 text-left text-sm text-red-600 hover:bg-red-50">Delete</button></div>}</div>}</div>
</article>)}
</section>
diff --git a/src/app/(calendar)/calendar/page.tsx b/src/app/(calendar)/calendar/page.tsx
index 91e85e0..9fa8209 100644
--- a/src/app/(calendar)/calendar/page.tsx
+++ b/src/app/(calendar)/calendar/page.tsx
@@ -5,7 +5,9 @@ import Link from "next/link";
import type { PointerEvent as ReactPointerEvent } from "react";
import { createPortal } from "react-dom";
import toast, { Toaster } from "react-hot-toast";
-import { AlignLeft, CalendarPlus2, ChevronDown, ChevronLeft, ChevronRight, Clock3, MapPin, Palette, Plus, Repeat2, Trash2, UsersRound, X } from "lucide-react";
+import { AlignLeft, CalendarPlus2, Check, ChevronDown, ChevronLeft, ChevronRight, Clock3, MapPin, MoreVertical, Palette, Plus, Repeat2, Trash2, UsersRound, X } from "lucide-react";
+import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
+import { mobilePrimaryActionClass } from "@/components/page-header-utils";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Textarea } from "@/components/ui/textarea";
@@ -62,7 +64,8 @@ export default function CalendarPage() {
const [editing, setEditing] = useState<CalendarEvent | null>(null);
const [pendingAction, setPendingAction] = useState<"save" | string | null>(null);
const { selectedMailbox } = useSelectedMailbox();
- const { minimal } = useSidebar();
+ const { minimal: sidebarMinimal, mobile } = useSidebar();
+ const minimal = sidebarMinimal || mobile;
const now = new Date(currentTime);
const todayTime = startOfDay(now).getTime();
@@ -345,17 +348,17 @@ export default function CalendarPage() {
}
return (
- <div className={clsx("flex h-full min-h-0 flex-col bg-[#f6f8fc] pl-3 lg:flex-row transition-[gap] duration-200 ease-in-out motion-reduce:transition-none", minimal ? "gap-0" : "gap-3")}>
+ <div className={clsx("flex h-full min-h-0 flex-col bg-[#f6f8fc] pl-3 max-md:pl-0 lg:flex-row transition-[gap] duration-200 ease-in-out motion-reduce:transition-none", minimal ? "gap-0" : "gap-3")}>
<Toaster position="bottom-right" />
{loading && <RouteLoadingBar />}
{headerTarget && createPortal(
- <div className="flex min-w-0 flex-1 items-center justify-between gap-3">
+ <div className="flex min-w-0 flex-1 items-center justify-between gap-3 ">
<div className="flex shrink-0 items-center gap-2">
<div ref={monthPickerRef} className="relative shrink-0">
<button type="button" onClick={() => {
setPickerMonth(startOfMonth(visibleDate));
setMonthPickerOpen((open) => !open);
- }} className="flex items-center gap-2 whitespace-nowrap text-lg font-semibold text-neutral-900" aria-haspopup="dialog" aria-expanded={monthPickerOpen}>
+ }} className="flex items-center gap-2 whitespace-nowrap text-lg font-semibold text-neutral-900 max-md:text-base max-md:font-medium" aria-haspopup="dialog" aria-expanded={monthPickerOpen}>
{formatUserDate(visibleDate, { month: "long", year: "numeric" })}
<ChevronDown className="h-5 w-5 text-neutral-500" />
</button>
@@ -399,15 +402,27 @@ export default function CalendarPage() {
<div className="flex shrink-0 items-center gap-1.5">
<button type="button" aria-label={`Previous ${view}`} onClick={() => setVisibleDate(addDays(visibleDate, view === "week" ? -7 : -1))} className="flex h-10 w-10 items-center justify-center rounded-full text-neutral-600 hover:bg-white"><ChevronLeft className="h-6 w-6" /></button>
<button type="button" aria-label={`Next ${view}`} onClick={() => setVisibleDate(addDays(visibleDate, view === "week" ? 7 : 1))} className="flex h-10 w-10 items-center justify-center rounded-full text-neutral-600 hover:bg-white"><ChevronRight className="h-6 w-6" /></button>
- <button type="button" onClick={() => setVisibleDate(new Date())} className="h-10 rounded-full bg-white px-4 text-sm font-medium text-neutral-700 hover:bg-neutral-50">Today</button>
- <div className="relative">
+ <button type="button" onClick={() => setVisibleDate(new Date())} className="h-10 rounded-full max-md:hidden bg-white px-4 text-sm font-medium text-neutral-700 hover:bg-neutral-50">Today</button>
+ <DropdownMenu.Root>
+ <DropdownMenu.Trigger asChild>
+ <button type="button" aria-label="Calendar options" className="flex h-10 w-10 items-center justify-center rounded-full text-neutral-600 hover:bg-white md:hidden"><MoreVertical className="h-5 w-5" /></button>
+ </DropdownMenu.Trigger>
+ <DropdownMenu.Portal>
+ <DropdownMenu.Content align="end" sideOffset={4} className="z-[130] min-w-40 rounded-xl border border-neutral-200 bg-white p-1 text-sm shadow-xl md:hidden">
+ <DropdownMenu.Item onSelect={() => setVisibleDate(new Date())} className="cursor-pointer rounded-lg px-3 py-2 text-neutral-700 outline-none data-[highlighted]:bg-neutral-100">Today</DropdownMenu.Item>
+ <DropdownMenu.Separator className="my-1 h-px bg-neutral-100" />
+ {(["week", "day"] as const).map((option) => <DropdownMenu.Item key={option} onSelect={() => setView(option)} className="flex cursor-pointer items-center justify-between gap-3 rounded-lg px-3 py-2 text-neutral-700 outline-none data-[highlighted]:bg-neutral-100">{option === "week" ? "Week" : "Day"}{view === option && <Check className="h-4 w-4 text-blue-600" />}</DropdownMenu.Item>)}
+ </DropdownMenu.Content>
+ </DropdownMenu.Portal>
+ </DropdownMenu.Root>
+ <div className="relative max-md:hidden">
<select value={view} onChange={(event) => setView(event.target.value as CalendarView)} aria-label="Calendar view" className="h-10 appearance-none rounded-full border-0 bg-white pl-4 pr-10 text-sm font-medium text-neutral-700 hover:bg-neutral-50">
<option value="week">Week</option>
<option value="day">Day</option>
</select>
<ChevronDown className="pointer-events-none absolute right-3 top-1/2 h-5 w-5 -translate-y-1/2 text-neutral-600" />
</div>
- <Button disabled={pendingAction !== null} onClick={() => openNewEvent()} className="ml-1 h-10 rounded-full bg-blue-600 px-4 text-white hover:bg-blue-500"><Plus className="h-5 w-5" />New event</Button>
+ <Button disabled={pendingAction !== null} onClick={() => openNewEvent()} className={clsx("ml-1 max-md:ml-0 h-10 rounded-full bg-blue-600 px-4 text-white hover:bg-blue-500", mobilePrimaryActionClass)}><Plus className="h-5 w-5" />New event</Button>
</div>
</div>,
headerTarget,
diff --git a/src/app/(calendar)/layout.tsx b/src/app/(calendar)/layout.tsx
index 4e7872f..ae69298 100644
--- a/src/app/(calendar)/layout.tsx
+++ b/src/app/(calendar)/layout.tsx
@@ -2,8 +2,8 @@
import { useEffect } from "react";
import Link from "next/link";
-import { usePathname } from "next/navigation";
-import { Sparkles } from "lucide-react";
+import { usePathname, useRouter } from "next/navigation";
+import { ChevronDown, Sparkles } from "lucide-react";
import { AgentPanel } from "@/components/agent/agent-panel";
import { AssistantOpenContext } from "@/components/agent/assistant-open-state";
import { AuthGuard } from "@/components/auth/auth-guard";
@@ -13,6 +13,8 @@ import { LicenseIndicator } from "@/components/license-indicator";
import { MailSearchProvider } from "@/components/mail-search/mail-search-context";
import { MailboxProvider } from "@/components/mailbox-provider";
import { MailboxSelector } from "@/components/mailbox-selector";
+import { SidebarAside, MobileMenuButton, MobileBrandIcon } from "@/components/sidebar-aside";
+import { DashboardNav } from "@/components/dashboard-nav";
import { SidebarHeader } from "@/components/sidebar-header";
import { SidebarProvider } from "@/components/sidebar-state";
import { ShortcutsProvider } from "@/components/shortcuts";
@@ -23,6 +25,7 @@ import { useAssistantAvailability } from "../(dashboard)/use-assistant-availabil
export default function CalendarLayout({ children }: { children: React.ReactNode }) {
const pathname = usePathname();
+ const router = useRouter();
const { assistantOpen, setAssistantOpen, assistantFullSize, setAssistantFullSize } = useDashboardState();
const assistantEnabled = useAssistantAvailability();
const assistantVisible = assistantEnabled === true && assistantOpen;
@@ -36,20 +39,25 @@ export default function CalendarLayout({ children }: { children: React.ReactNode
return (
<AuthGuard>
- <SidebarProvider>
+ <SidebarProvider mobileOverlay>
<MailboxProvider>
<ComposeProvider>
<MailSearchProvider>
<ShortcutsProvider>
<div className="grid h-dvh grid-cols-[minmax(0,1fr)] overflow-hidden bg-[#f6f8fc]">
+ <SidebarAside className="md:hidden"><div className="h-full overflow-y-auto overscroll-contain px-3 py-4"><DashboardNav /></div></SidebarAside>
<div className="flex min-h-0 min-w-0 flex-col">
- <header className="flex h-16 w-full shrink-0 items-center gap-3 pr-4 text-sm">
- <div className="shrink-0 px-3 [&>div]:mb-0" style={{ width: "calc(var(--sidebar-width) + 1.5rem)" }}><SidebarHeader href="/inbox" /></div>
- <nav aria-label="Calendar sections" className="flex shrink-0 items-center rounded-full bg-white p-1">
+ <header className="flex h-16 w-full shrink-0 items-center gap-3 pr-4 text-sm max-md:h-auto max-md:flex-wrap max-md:gap-y-2 max-md:pb-2">
+ <MobileMenuButton className="ml-2" />
+ <MobileBrandIcon />
+ <div className="hidden shrink-0 px-3 md:block [&>div]:mb-0" style={{ width: "calc(var(--sidebar-width) + 1.5rem)" }}><SidebarHeader href="/inbox" /></div>
+ <div className="relative shrink-0 md:hidden"><select aria-label="Calendar section" value={pathname === "/booking" ? "/booking" : "/calendar"} onChange={(event) => router.push(event.target.value)} className="h-10 appearance-none rounded-full border-0 bg-white pl-4 pr-10 text-sm font-medium text-neutral-700"><option value="/booking">Bookings</option><option value="/calendar">Calendar</option></select><ChevronDown className="pointer-events-none absolute right-3 top-1/2 h-5 w-5 -translate-y-1/2 text-neutral-600" /></div>
+ <span className="flex-1 md:hidden" />
+ <nav aria-label="Calendar sections" className="flex shrink-0 max-md:hidden items-center rounded-full bg-white p-1">
<Link href="/booking" aria-current={pathname === "/booking" ? "page" : undefined} className={clsx("rounded-full px-4 py-2 text-sm font-medium transition-colors", pathname === "/booking" ? "bg-blue-600 text-white" : "text-neutral-600 hover:bg-neutral-100")}>Bookings</Link>
<Link href="/calendar" aria-current={pathname === "/calendar" ? "page" : undefined} className={clsx("rounded-full px-4 py-2 text-sm font-medium transition-colors", pathname === "/calendar" ? "bg-blue-600 text-white" : "text-neutral-600 hover:bg-neutral-100")}>Calendar</Link>
</nav>
- <div id="calendar-header-slot" className="flex min-w-0 flex-1 items-center" />
+ <div id="calendar-header-slot" className="flex min-w-0 flex-1 items-center max-md:order-last max-md:basis-full max-md:pl-3 max-md:empty:hidden" />
<LicenseIndicator />
{assistantEnabled && <Button type="button" variant="ghost" size="sm" className={assistantOpen ? "bg-blue-50 text-blue-700" : "text-neutral-600"} onClick={() => { setAssistantOpen((current) => !current); setAssistantFullSize(false); }} aria-label={assistantOpen ? "Close email assistant" : "Open email assistant"} aria-expanded={assistantOpen} aria-controls="email-assistant-panel"><Sparkles className="h-5 w-5" /></Button>}
<MailboxSelector />
@@ -60,7 +68,7 @@ export default function CalendarLayout({ children }: { children: React.ReactNode
<div key={pathname} className="page-transition-enter h-full min-h-0">{children}</div>
</main>
</AssistantOpenContext.Provider>
- <aside className={clsx(assistantFullSize ? "pl-0" : "pl-4", "min-h-0 min-w-0 shrink-0 overflow-hidden pb-2 pr-2 transition-[width] duration-300 ease-in-out motion-reduce:transition-none", assistantVisible ? "" : "opacity-0")} style={{ width: assistantVisible ? assistantFullSize ? "100%" : "min(390px, 100%)" : "0px" }} aria-hidden={!assistantVisible} inert={!assistantVisible}>
+ <aside className={clsx(assistantFullSize ? "pl-0" : "pl-4", "min-h-0 min-w-0 shrink-0 overflow-hidden pb-2 pr-2 max-md:p-0 transition-[width] duration-300 ease-in-out motion-reduce:transition-none", assistantVisible ? "" : "opacity-0")} style={{ width: assistantVisible ? assistantFullSize ? "100%" : "min(390px, 100%)" : "0px" }} aria-hidden={!assistantVisible} inert={!assistantVisible}>
{assistantEnabled && <AgentPanel open={assistantVisible} fullSize={assistantFullSize} onToggleFullSize={() => setAssistantFullSize((current) => !current)} onClose={() => { setAssistantOpen(false); setAssistantFullSize(false); }} />}
</aside>
</div>
diff --git a/src/app/(calendar)/upcoming-sidebar.tsx b/src/app/(calendar)/upcoming-sidebar.tsx
index edae60e..01542f4 100644
--- a/src/app/(calendar)/upcoming-sidebar.tsx
+++ b/src/app/(calendar)/upcoming-sidebar.tsx
@@ -12,7 +12,8 @@ import { addDays, expandCalendarEvents, formatEventRange, groupUpcomingEvents, s
import type { UpcomingSidebarProps } from "./upcoming-sidebar-types";
export function UpcomingSidebar({ events, onSelect }: UpcomingSidebarProps) {
- const { minimal } = useSidebar();
+ const { minimal: sidebarMinimal, mobile } = useSidebar();
+ const minimal = sidebarMinimal || mobile;
const router = useRouter();
const [loadedEvents, setLoadedEvents] = useState<CalendarEvent[]>([]);
const [loadError, setLoadError] = useState(false);
diff --git a/src/app/(dashboard)/layout.tsx b/src/app/(dashboard)/layout.tsx
index e3a87ad..0c57f50 100644
--- a/src/app/(dashboard)/layout.tsx
+++ b/src/app/(dashboard)/layout.tsx
@@ -15,6 +15,7 @@ import { Button } from "@/components/ui/button";
import { LicenseIndicator } from "@/components/license-indicator";
import { DashboardNav } from "@/components/dashboard-nav";
import { SidebarProvider } from "@/components/sidebar-state";
+import { SidebarAside, MobileMenuButton, MobileBrandIcon } from "@/components/sidebar-aside";
import { SidebarResizeBoundary } from "@/components/sidebar-resize-boundary";
import { ShortcutsProvider } from "@/components/shortcuts";
import clsx from "clsx";
@@ -39,20 +40,22 @@ export default function DashboardLayout({
return (
<AuthGuard>
- <SidebarProvider>
+ <SidebarProvider mobileOverlay>
<MailboxProvider>
<ComposeProvider>
<MailSearchProvider>
<ShortcutsProvider>
- <div className="grid h-dvh grid-cols-[72px_minmax(0,1fr)] overflow-hidden bg-[#f6f8fc] transition-[grid-template-columns] md:grid-cols-[var(--sidebar-width)_minmax(0,1fr)]" style={{ transitionDuration: "var(--sidebar-transition-duration)" }}>
- <aside className="relative z-30 w-[var(--sidebar-width)] min-h-0 min-w-0 bg-[#f6f8fc]">
+ <div className="grid h-dvh grid-cols-[minmax(0,1fr)] overflow-hidden bg-[#f6f8fc] transition-[grid-template-columns] md:grid-cols-[var(--sidebar-width)_minmax(0,1fr)]" style={{ transitionDuration: "var(--sidebar-transition-duration)" }}>
+ <SidebarAside>
<div className="h-full overflow-y-auto overscroll-contain px-3 py-4 scrollbar-gutter-stable">
<DashboardNav />
</div>
<SidebarResizeBoundary />
- </aside>
+ </SidebarAside>
<div className="flex min-h-0 min-w-0 flex-col">
<header className="flex h-16 w-full shrink-0 items-center gap-3 pr-4 text-sm">
+ <MobileMenuButton className="ml-2" />
+ <MobileBrandIcon />
<MailSearchInput />
{/* <Link
href="/settings/account"
@@ -71,7 +74,7 @@ export default function DashboardLayout({
{children}
</main>
</AssistantOpenContext.Provider>
- <aside className={clsx(assistantFullSize ? "pl-0" : "pl-4", `min-h-0 min-w-0 shrink-0 overflow-hidden transition-[width] duration-300 ease-in-out motion-reduce:transition-none pr-2 pb-2`, assistantVisible ? "" : "opacity-0")} style={{ width: assistantVisible ? assistantFullSize ? "100%" : "min(390px, 100%)" : "0px" }} aria-hidden={!assistantVisible} inert={!assistantVisible}>
+ <aside className={clsx(assistantFullSize ? "pl-0" : "pl-4", `min-h-0 min-w-0 shrink-0 overflow-hidden transition-[width] duration-300 ease-in-out motion-reduce:transition-none pr-2 pb-2 max-md:p-0`, assistantVisible ? "" : "opacity-0")} style={{ width: assistantVisible ? assistantFullSize ? "100%" : "min(390px, 100%)" : "0px" }} aria-hidden={!assistantVisible} inert={!assistantVisible}>
{assistantEnabled && <AgentPanel open={assistantVisible} fullSize={assistantFullSize} onToggleFullSize={() => setAssistantFullSize((current) => !current)} onClose={() => { setAssistantOpen(false); setAssistantFullSize(false); }} />}
</aside>
</div>
diff --git a/src/app/(settings)/layout.tsx b/src/app/(settings)/layout.tsx
index 90babd2..5bec7f3 100644
--- a/src/app/(settings)/layout.tsx
+++ b/src/app/(settings)/layout.tsx
@@ -13,6 +13,7 @@ import { LicenseIndicator } from "@/components/license-indicator";
import { DashboardNav } from "@/components/dashboard-nav";
import { SidebarProvider } from "@/components/sidebar-state";
import { ShortcutsProvider } from "@/components/shortcuts";
+import { SidebarAside, MobileMenuButton, MobileBrandIcon } from "@/components/sidebar-aside";
export default function DashboardLayout({
children,
@@ -21,28 +22,30 @@ export default function DashboardLayout({
}) {
return (
<AuthGuard>
- <SidebarProvider>
+ <SidebarProvider mobileOverlay>
<MailboxProvider>
<ComposeProvider>
<MailSearchProvider>
<ShortcutsProvider>
- <div className="grid h-[100dvh] grid-cols-[72px_minmax(0,1fr)] md:grid-cols-[var(--sidebar-width)_minmax(0,1fr)] overflow-hidden bg-[#f6f8fc] transition-[grid-template-columns]" style={{ transitionDuration: "var(--sidebar-transition-duration)" }}>
- <aside className="z-30 w-[var(--sidebar-width)] min-h-0 bg-[#f6f8fc] overflow-y-auto overscroll-contain px-3 py-4 [scrollbar-gutter:stable]">
+ <div className="grid h-[100dvh] grid-cols-[minmax(0,1fr)] md:grid-cols-[var(--sidebar-width)_minmax(0,1fr)] overflow-hidden bg-[#f6f8fc] transition-[grid-template-columns]" style={{ transitionDuration: "var(--sidebar-transition-duration)" }}>
+ <SidebarAside className="overflow-y-auto overscroll-contain px-3 py-4 [scrollbar-gutter:stable]">
<DashboardNav />
- </aside>
+ </SidebarAside>
<div className="flex min-h-0 min-w-0 flex-col">
<header className="flex h-16 w-full shrink-0 items-center gap-4 pr-4 text-sm">
+ <MobileMenuButton className="ml-2" />
+ <MobileBrandIcon />
<MailSearchInput />
- <Link
+ {/* <Link
href="/settings/account"
className="flex h-10 w-10 items-center justify-center rounded-full text-neutral-600 hover:bg-neutral-200"
>
<HelpCircle className="h-5 w-5" />
- </Link>
+ </Link> */}
<LicenseIndicator />
<MailboxSelector />
</header>
- <main className="min-h-0 flex-1 overflow-y-auto overscroll-contain scrollbar-gutter-stable">
+ <main className="page-flush min-h-0 flex-1 overflow-y-auto max-md:rounded-t-3xl max-md:bg-white overscroll-contain scrollbar-gutter-stable">
{children}
</main>
</div>
diff --git a/src/app/(settings)/settings/export/page.tsx b/src/app/(settings)/settings/export/page.tsx
index b9503d2..6cbc248 100644
--- a/src/app/(settings)/settings/export/page.tsx
+++ b/src/app/(settings)/settings/export/page.tsx
@@ -26,7 +26,7 @@ export default function SettingsExportPage() {
return (
<div className="space-y-6">
{/* <div>
- <h1 className="text-3xl font-medium text-neutral-900">Export</h1>
+ <h1 className="text-2xl md:text-3xl font-medium text-neutral-900">Export</h1>
<p className="mt-1 text-sm text-neutral-500">
Download mail from the currently selected mailbox.
</p>
diff --git a/src/app/(settings)/settings/import/page.tsx b/src/app/(settings)/settings/import/page.tsx
index 34d0d8f..98dbd2c 100644
--- a/src/app/(settings)/settings/import/page.tsx
+++ b/src/app/(settings)/settings/import/page.tsx
@@ -185,7 +185,7 @@ export default function SettingsImportPage() {
return (
<div className="space-y-6">
{/* <div>
- <h1 className="text-3xl font-medium text-neutral-900">Import</h1>
+ <h1 className="text-2xl md:text-3xl font-medium text-neutral-900">Import</h1>
<p className="mt-1 text-sm text-neutral-500">
Move mail from selected source sections into the matching sections of
the current mailbox.
diff --git a/src/app/(settings)/settings/layout.tsx b/src/app/(settings)/settings/layout.tsx
index 95b40d1..c90663a 100644
--- a/src/app/(settings)/settings/layout.tsx
+++ b/src/app/(settings)/settings/layout.tsx
@@ -4,7 +4,7 @@ import { SettingsNav } from "@/components/settings/settings-nav";
export default function SettingsLayout({ children }: { children: ReactNode }) {
return (
<div className="flex flex-col-reverse justify-end gap-4 min-h-[calc(100dvh-4rem)] bg-inherit md:flex-row md:justify-start">
- <div className="min-w-0 flex-1 pt-4">
+ <div className="min-w-0 flex-1 pt-4 max-md:px-6 max-md:pb-36">
<div className="mx-auto w-full max-w-3xl">{children}</div>
</div>
<SettingsNav />
diff --git a/src/app/(settings)/settings/rules/page.tsx b/src/app/(settings)/settings/rules/page.tsx
index 4cbcee5..9cef992 100644
--- a/src/app/(settings)/settings/rules/page.tsx
+++ b/src/app/(settings)/settings/rules/page.tsx
@@ -5,7 +5,7 @@ export default function SettingsRulesPage() {
return (
<div className="space-y-8">
{/* <div>
- <h1 className="text-3xl font-medium text-neutral-900">Rules</h1>
+ <h1 className="text-2xl md:text-3xl font-medium text-neutral-900">Rules</h1>
<p className="mt-1 text-sm text-neutral-500">
Rules for the selected inbox.
</p>
diff --git a/src/app/book/[userId]/[eventId]/page.tsx b/src/app/book/[userId]/[eventId]/page.tsx
index 74c23af..98f178a 100644
--- a/src/app/book/[userId]/[eventId]/page.tsx
+++ b/src/app/book/[userId]/[eventId]/page.tsx
@@ -101,13 +101,13 @@ export default function PublicBookingEventPage() {
} finally { setSubmitting(false); }
}
- return <main className="page-transition-enter min-h-dvh bg-[#f6f8fc] p-4 text-neutral-900 sm:px-6 lg:h-dvh lg:overflow-hidden lg:pb-0">
+ return <main className="page-transition-enter min-h-dvh bg-[#f6f8fc] p-4 text-neutral-900 max-sm:px-0 max-sm:pb-0 sm:px-6 lg:h-dvh lg:overflow-hidden lg:pb-0">
<div className="mx-auto max-w-[1500px] lg:flex lg:h-full lg:min-h-0 lg:flex-col">
{loading && <RouteLoadingBar />}
- {selectedSlot && !done ? <button type="button" onClick={() => { setSelectedSlot(null); setError(""); writeBookingPageSelection(selectedDate, null, timeZone, true); }} className="mb-5 inline-flex items-center gap-2 self-start text-sm text-neutral-600 hover:text-blue-700"><ArrowLeft className="h-4 w-4" />Back to calendar</button> : <Link href={username ? `/c/${username}` : `/book/${userId}`} className="mb-5 inline-flex items-center gap-2 self-start text-sm text-neutral-600 hover:text-blue-700"><ArrowLeft className="h-4 w-4" />All meetings</Link>}
+ {selectedSlot && !done ? <button type="button" onClick={() => { setSelectedSlot(null); setError(""); writeBookingPageSelection(selectedDate, null, timeZone, true); }} className="mb-5 inline-flex items-center gap-2 self-start text-sm text-neutral-600 hover:text-blue-700 max-sm:ml-4"><ArrowLeft className="h-4 w-4" />Back to calendar</button> : <Link href={username ? `/c/${username}` : `/book/${userId}`} className="mb-5 inline-flex items-center gap-2 self-start text-sm text-neutral-600 hover:text-blue-700 max-sm:ml-4"><ArrowLeft className="h-4 w-4" />All meetings</Link>}
{loading ? <BookingDetailSkeleton /> : !event ? <p className="rounded-2xl bg-white p-8 text-sm text-neutral-600 shadow-sm">{error}</p> :
<div className={`page-transition-enter grid overflow-hidden rounded-t-3xl bg-white shadow-xl shadow-neutral-200/50 lg:min-h-0 lg:flex-1 ${selectedSlot || done ? "lg:grid-cols-[minmax(260px,1fr)_minmax(420px,2fr)]" : "lg:grid-cols-[minmax(240px,.95fr)_minmax(380px,1.65fr)_minmax(240px,.95fr)]"}`}>
- <aside className="min-w-0 border-b border-neutral-200 p-7 sm:p-9 lg:min-h-0 lg:overflow-y-auto lg:border-b-0 flex flex-col border-r">
+ <aside className="min-w-0 border-b border-neutral-200 p-7 max-sm:p-5 sm:p-9 lg:min-h-0 lg:overflow-y-auto lg:border-b-0 flex flex-col border-r">
<h1 className="text-xl font-semibold tracking-tight">{event.name}</h1>
{event.description && <p className="mt-2 whitespace-pre-wrap text-sm leading-6 text-neutral-600">{event.description}</p>}
@@ -121,8 +121,8 @@ export default function PublicBookingEventPage() {
</div>
- <span className="flex-1" />
- <div className="flex min-w-0 items-center gap-3">
+ <span className="flex-1 max-sm:hidden" />
+ <div className="flex min-w-0 items-center gap-3 max-sm:order-first max-sm:mb-5">
<img src={branding.iconUrl} width={24} height={24} alt={branding.appName || "Mailflare"} />
@@ -130,7 +130,7 @@ export default function PublicBookingEventPage() {
</div>
</aside>
{done ? <section className="flex min-h-0 flex-col items-center justify-center px-8 py-20 text-center"><div className="mb-5 flex h-14 w-14 items-center justify-center rounded-full bg-green-100 text-green-700"><Check className="h-7 w-7" /></div><h2 className="text-2xl font-semibold">Meeting booked</h2><p className="mt-3 text-sm text-neutral-500">Your meeting is scheduled for {selectedSlot && new Intl.DateTimeFormat(undefined, { dateStyle: "full", timeStyle: "short", timeZone }).format(new Date(selectedSlot.startsAt))}.</p></section> : selectedSlot ?
- <form onSubmit={(formEvent) => { formEvent.preventDefault(); void book(); }} className="page-transition-enter min-h-0 space-y-6 overflow-y-auto p-7 sm:p-10">
+ <form onSubmit={(formEvent) => { formEvent.preventDefault(); void book(); }} className="page-transition-enter min-h-0 space-y-6 overflow-y-auto p-7 max-sm:p-5 sm:p-10">
<h2 className="text-2xl font-medium">Enter Details</h2>
<label className="block text-sm font-medium text-neutral-700">Name <span aria-hidden="true">*</span><Input required value={name} onChange={(input) => setName(input.target.value)} maxLength={120} autoComplete="name" className="mt-2" /></label>
<label className="block text-sm font-medium text-neutral-700">Email <span aria-hidden="true">*</span><Input required type="email" value={email} onChange={(input) => setEmail(input.target.value)} maxLength={254} autoComplete="email" className="mt-2" /></label>
@@ -140,22 +140,22 @@ export default function PublicBookingEventPage() {
<Button type="submit" disabled={submitting || !name.trim() || !email.trim()} className="h-11 rounded-full bg-blue-600 px-7 text-sm font-medium hover:bg-blue-700">{submitting ? "Booking…" : "Schedule Event"}</Button>
</form> : <>
<section className="page-transition-enter min-w-0 border-b border-neutral-200 lg:min-h-0 lg:overflow-y-auto">
- <div className="mx-auto mt-8 mb-2 flex max-w-[440px] items-center justify-between gap-3 px-5"><h3 className="text-lg font-semibold flex-1">{formatCalendarDate(`${visibleMonth}-01`, { month: "long", year: "numeric" })}</h3>
+ <div className="mx-auto md:mt-8 my-2 flex max-w-[440px] items-center justify-between gap-3 px-5"><h3 className="text-lg font-semibold flex-1">{formatCalendarDate(`${visibleMonth}-01`, { month: "long", year: "numeric" })}</h3>
<button type="button" aria-label="Previous month" disabled={!firstMonth || moveMonth(visibleMonth, -1) < firstMonth} onClick={() => setMonth(moveMonth(visibleMonth, -1))} className="flex h-9 w-9 items-center justify-center rounded-md border border-neutral-200 text-blue-600 hover:bg-blue-50 disabled:cursor-not-allowed disabled:opacity-30"><ChevronLeft className="h-5 w-5" /></button>
<button type="button" aria-label="Next month" disabled={!lastMonth || moveMonth(visibleMonth, 1) > lastMonth} onClick={() => setMonth(moveMonth(visibleMonth, 1))} className="flex h-9 w-9 items-center justify-center rounded-md border border-neutral-200 text-blue-600 hover:bg-blue-50 disabled:cursor-not-allowed disabled:opacity-30"><ChevronRight className="h-5 w-5" /></button>
</div>
- <div className="mx-auto mt-6 grid max-w-[440px] grid-cols-7 text-center text-sm text-neutral-400"><span>Mo</span><span>Tu</span><span>We</span><span>Th</span><span>Fr</span><span>Sa</span><span>Su</span></div>
- <div className="mx-auto mt-2 mb-6 grid max-w-[440px] grid-cols-7">{calendarDays(visibleMonth).map((date, index) => <div key={date || `blank-${index}`} className="aspect-square min-w-0">{date && <button type="button" disabled={!slotsByDate.has(date) && date !== todayDate} onClick={() => { setSelectedDate(date); setError(""); writeBookingPageSelection(date, null, timeZone); }} aria-label={`${formatCalendarDate(date, { weekday: "long", month: "long", day: "numeric", year: "numeric" })}${date === todayDate ? ", today" : ""}${slotsByDate.has(date) ? `, ${slotsByDate.get(date)?.length} available times` : ", no available times"}`} aria-current={date === todayDate ? "date" : undefined} aria-pressed={selectedDate === date} className={`flex h-full w-full items-center justify-center rounded-lg text-base ${selectedDate === date ? "bg-blue-600 text-white" : slotsByDate.has(date) || date === todayDate ? "text-blue-700 hover:bg-blue-50" : "cursor-not-allowed text-neutral-400"}`}><span className={`relative flex h-10 w-10 items-center justify-center rounded-full ${selectedDate === date ? "font-semibold" : slotsByDate.has(date) ? "bg-blue-50 font-medium" : ""} ${date === todayDate && selectedDate !== date ? "ring-2 ring-blue-300 ring-offset-2" : ""}`}>{Number(date.slice(-2))}{date === todayDate && selectedDate === date && <span aria-hidden="true" className="absolute bottom-1 h-1 w-1 rounded-full bg-white" />}</span></button>}</div>)}
+ <div className="mx-auto mt-6 grid max-w-[440px] grid-cols-7 max-sm:px-5 text-center text-sm text-neutral-400"><span>Mo</span><span>Tu</span><span>We</span><span>Th</span><span>Fr</span><span>Sa</span><span>Su</span></div>
+ <div className="mx-auto mt-2 mb-6 grid max-w-[440px] grid-cols-7 max-sm:px-5">{calendarDays(visibleMonth).map((date, index) => <div key={date || `blank-${index}`} className="aspect-square min-w-0">{date && <button type="button" disabled={!slotsByDate.has(date) && date !== todayDate} onClick={() => { setSelectedDate(date); setError(""); writeBookingPageSelection(date, null, timeZone); }} aria-label={`${formatCalendarDate(date, { weekday: "long", month: "long", day: "numeric", year: "numeric" })}${date === todayDate ? ", today" : ""}${slotsByDate.has(date) ? `, ${slotsByDate.get(date)?.length} available times` : ", no available times"}`} aria-current={date === todayDate ? "date" : undefined} aria-pressed={selectedDate === date} className={`flex h-full w-full items-center justify-center rounded-lg text-base ${selectedDate === date ? "bg-blue-600 text-white" : slotsByDate.has(date) || date === todayDate ? "text-blue-700 hover:bg-blue-50" : "cursor-not-allowed text-neutral-400"}`}><span className={`relative flex h-10 w-10 items-center justify-center rounded-full ${selectedDate === date ? "font-semibold" : slotsByDate.has(date) ? "bg-blue-50 font-medium" : ""} ${date === todayDate && selectedDate !== date ? "ring-2 ring-blue-300 ring-offset-2" : ""}`}>{Number(date.slice(-2))}{date === todayDate && selectedDate === date && <span aria-hidden="true" className="absolute bottom-1 h-1 w-1 rounded-full bg-white" />}</span></button>}</div>)}
</div>
- <div className="flex min-w-0 items-center gap-2 w-full pl-3 pr-2 text-sm text-neutral-600 focus-within:border-blue-600 max-w-[440px] my-4 mx-auto">
+ <div className="flex min-w-0 items-center gap-2 w-full pl-3 pr-2 max-sm:px-5 text-sm text-neutral-600 focus-within:border-blue-600 max-w-[440px] my-4 mx-auto">
<Globe2 aria-hidden="true" className="h-4 w-4 shrink-0" />
- <label htmlFor="booking-time-zone" className="flex-1 min-w-0">Time zone</label>
- <select id="booking-time-zone" value={timeZone} onChange={(input) => { const nextToday = localDateForSlot({ startsAt: new Date().toISOString(), endsAt: "", localDate: "", time: "" }, input.target.value); setTimeZone(input.target.value); setSelectedDate(nextToday); setMonth(nextToday.slice(0, 7)); writeBookingPageSelection(nextToday, null, input.target.value); }} className="h-9 border-0 bg-transparent px-1 text-sm text-neutral-700 shadow-none outline-none text-right">{timeZones.map((zone) => <option key={zone} value={zone}>{zone.replaceAll("_", " ")}</option>)}</select>
+ <label htmlFor="booking-time-zone" className="shrink-0 whitespace-nowrap">Time zone</label>
+ <select id="booking-time-zone" value={timeZone} onChange={(input) => { const nextToday = localDateForSlot({ startsAt: new Date().toISOString(), endsAt: "", localDate: "", time: "" }, input.target.value); setTimeZone(input.target.value); setSelectedDate(nextToday); setMonth(nextToday.slice(0, 7)); writeBookingPageSelection(nextToday, null, input.target.value); }} className="ml-auto h-9 min-w-0 max-w-full flex-1 truncate border-0 bg-transparent px-1 text-sm text-neutral-700 shadow-none outline-none text-right">{timeZones.map((zone) => <option key={zone} value={zone}>{zone.replaceAll("_", " ")}</option>)}</select>
</div>
{slots.length === 0 && <p className="mt-6 text-sm text-neutral-500">No times are available in the next 60 days.</p>}
</section>
- {selectedDate && <section key={selectedDate} className="page-transition-enter flex min-h-0 flex-col p-7 sm:p-9 lg:overflow-hidden"><h3 className="mb-6 shrink-0 text-lg font-semibold">{formatCalendarDate(selectedDate, { weekday: "long", month: "short", day: "numeric" })}</h3><div className="min-h-0 max-h-[50dvh] flex-1 space-y-3 overflow-y-auto pr-1 lg:max-h-none">{(slotsByDate.get(selectedDate) ?? []).length === 0 ? <p className="text-sm text-neutral-500">No times are available on this date. Choose another highlighted date.</p> : (slotsByDate.get(selectedDate) ?? []).map((slot) => <button type="button" key={slot.startsAt} onClick={() => { setSelectedSlot(slot); setError(""); writeBookingPageSelection(selectedDate, slot.startsAt, timeZone); }} className="w-full rounded-md border border-neutral-300 bg-white px-4 py-3 text-center text-sm font-medium text-blue-700 hover:border-blue-500 hover:bg-blue-50">{new Intl.DateTimeFormat(undefined, { hour: "numeric", minute: "2-digit", hour12: true, timeZone }).format(new Date(slot.startsAt))}</button>)}</div></section>}
+ {selectedDate && <section key={selectedDate} className="page-transition-enter flex min-h-0 flex-col p-7 max-sm:p-5 sm:p-9 lg:overflow-hidden"><h3 className="mb-6 shrink-0 text-lg font-semibold">{formatCalendarDate(selectedDate, { weekday: "long", month: "short", day: "numeric" })}</h3><div className="min-h-0 max-h-[50dvh] flex-1 space-y-3 overflow-y-auto pr-1 lg:max-h-none">{(slotsByDate.get(selectedDate) ?? []).length === 0 ? <p className="text-sm text-neutral-500">No times are available on this date. Choose another highlighted date.</p> : (slotsByDate.get(selectedDate) ?? []).map((slot) => <button type="button" key={slot.startsAt} onClick={() => { setSelectedSlot(slot); setError(""); writeBookingPageSelection(selectedDate, slot.startsAt, timeZone); }} className="w-full rounded-md border border-neutral-300 bg-white px-4 py-3 text-center text-sm font-medium text-blue-700 hover:border-blue-500 hover:bg-blue-50">{new Intl.DateTimeFormat(undefined, { hour: "numeric", minute: "2-digit", hour12: true, timeZone }).format(new Date(slot.startsAt))}</button>)}</div></section>}
</>}
</div>}
</div>
diff --git a/src/app/book/[userId]/page.tsx b/src/app/book/[userId]/page.tsx
index 3e5fb59..97a6d31 100644
--- a/src/app/book/[userId]/page.tsx
+++ b/src/app/book/[userId]/page.tsx
@@ -30,7 +30,7 @@ export default function PublicBookingListPage() {
return <main className="page-transition-enter flex min-h-dvh flex-col bg-[#f6f8fc] p-4 lg:pt-12 text-neutral-900">
{loading && <RouteLoadingBar />}
<div className="mx-auto flex w-full max-w-2xl flex-1 flex-col">
- <div className="mb-7"><h1 className="text-3xl font-semibold">Book a meeting{name ? ` with ${name}` : ""}</h1><p className="mt-2 text-sm text-neutral-500">Choose a meeting to see available times.</p></div>
+ <div className="mb-7"><h1 className="text-2xl md:text-3xl font-semibold">Book a meeting{name ? ` with ${name}` : ""}</h1><p className="mt-2 text-sm text-neutral-500">Choose a meeting to see available times.</p></div>
{loading ? <BookingListSkeleton /> : error ? <p className="rounded-2xl border border-neutral-200 bg-white p-6 text-sm text-neutral-600 shadow-sm">{error}</p> : events.length === 0 ? <p className="rounded-2xl border border-neutral-200 bg-white p-6 text-sm text-neutral-600">No meetings are available to book right now.</p> : <div className="page-transition-enter space-y-3">{events.map((event) => <Link key={event.id} href={username ? `/c/${username}/${event.slug}` : `/book/${userId}/${event.id}`} className="group flex items-center gap-4 rounded-2xl bg-white p-5 transition-colors"><div className="min-w-0 flex-1"><h2 className="font-semibold group-hover:text-blue-700">{event.name}</h2>{event.description && <p className="mt-1 line-clamp-2 whitespace-pre-wrap text-sm text-neutral-600">{event.description}</p>}<p className="mt-2 flex flex-wrap gap-x-4 gap-y-1 text-sm text-neutral-500"><span className="inline-flex items-center gap-1"><Clock3 className="h-4 w-4" />{event.durationMinutes} minutes</span>{event.location && <span className="inline-flex items-center gap-1"><MapPin className="h-4 w-4" />{event.location}</span>}</p></div><ArrowRight className="h-5 w-5 text-neutral-400 group-hover:text-blue-700" /></Link>)}</div>}
<div className="mt-auto flex min-w-0 items-center gap-3 pt-10 text-neutral-700">
<img src={branding.iconUrl} width={24} height={24} alt={branding.appName || "Mailflare"} />
diff --git a/src/app/globals.css b/src/app/globals.css
index a415c53..5a3447f 100644
--- a/src/app/globals.css
+++ b/src/app/globals.css
@@ -470,3 +470,10 @@ button {
border-radius: 0.75rem;
padding: 1rem;
}
+
+/* On phones the settings/admin body is already white and padded, so white cards drop their own side padding to line up with the page header. */
+@media (max-width: 767px) {
+ .page-flush :is(.bg-white.p-6, .bg-white.p-5) {
+ padding-inline: 0;
+ }
+}
diff --git a/src/app/page.tsx b/src/app/page.tsx
index d8a8ad8..d36c6de 100644
--- a/src/app/page.tsx
+++ b/src/app/page.tsx
@@ -65,7 +65,7 @@ export default async function HomePage() {
<HomeHeroActions />
</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="relative min-h-[520px] overflow-hidden rounded-[2rem] border border-neutral-100 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">
diff --git a/src/components/accounts/account-settings-nav.tsx b/src/components/accounts/account-settings-nav.tsx
index 528a785..ef76120 100644
--- a/src/components/accounts/account-settings-nav.tsx
+++ b/src/components/accounts/account-settings-nav.tsx
@@ -3,6 +3,7 @@
import Link from "next/link";
import { useParams, usePathname } from "next/navigation";
import { cn } from "@/lib/utils";
+import { SectionNavSheet } from "../section-nav-sheet";
import {
accountSettingsNavItems,
getAccountSettingsHref,
@@ -12,9 +13,10 @@ import {
export function AccountSettingsNav() {
const { id } = useParams<{ id: string }>();
const pathname = usePathname();
+ const currentLabel = accountSettingsNavItems.find((item) => isActiveAccountSettingsPath(pathname, getAccountSettingsHref(id, item.segment)))?.label ?? "Account settings";
return (
- <aside className="w-full shrink-0 lg:w-48">
+ <SectionNavSheet title="Account settings menu" label={currentLabel} className="w-full shrink-0 px-4 py-4 md:w-48 md:px-0 md:py-0">
<div className="sticky top-6 space-y-3">
<h2 className="px-4 text-xs font-semibold uppercase tracking-wide text-neutral-500">
Account settings
@@ -39,6 +41,6 @@ export function AccountSettingsNav() {
})}
</nav>
</div>
- </aside>
+ </SectionNavSheet>
);
}
diff --git a/src/components/admin-page-titles.ts b/src/components/admin-page-titles.ts
new file mode 100644
index 0000000..f461c1f
--- /dev/null
+++ b/src/components/admin-page-titles.ts
@@ -0,0 +1,18 @@
+// Titles shown in the phone top bar, keyed by exact path. Detail pages are absent on purpose:
+// they keep their own in-page heading.
+export const adminPageTitles: Record<string, string> = {
+ "/admin": "Admin settings",
+ "/mailboxes": "Mailboxes",
+ "/domains": "Domains",
+ "/routing": "Routing",
+ "/webhooks": "Webhooks",
+ "/api-keys": "Admin API keys",
+ "/general": "General",
+ "/agent": "Agent",
+ "/accounts": "Accounts",
+ "/activity": "Activity",
+ "/backups": "Backups",
+ "/branding": "Branding",
+ "/licenses": "Licenses",
+ "/ai-usage": "AI usage",
+};
diff --git a/src/components/agent/agent-panel.tsx b/src/components/agent/agent-panel.tsx
index 7b4d7d5..ef55b4f 100644
--- a/src/components/agent/agent-panel.tsx
+++ b/src/components/agent/agent-panel.tsx
@@ -342,7 +342,7 @@ export function AgentPanel({ open, fullSize, onClose, onToggleFullSize }: AgentP
const draftActions = uniqueAgentDraftActions(messages);
const activeTool = busy ? activeAgentTool(messages) : null;
- return <section id="email-assistant-panel" className="flex h-full w-full min-w-0 flex-col overflow-hidden rounded-3xl border border-neutral-200/70 bg-white text-neutral-900 shadow-xl shadow-neutral-300/30" aria-label="Email assistant">
+ return <section id="email-assistant-panel" className="flex h-full w-full min-w-0 flex-col overflow-hidden rounded-3xl border border-neutral-200/70 bg-white text-neutral-900 shadow-xl shadow-neutral-300/30 max-md:rounded-b-none max-md:border-0 max-md:shadow-none" aria-label="Email assistant">
<header className="flex h-14 shrink-0 items-center justify-between gap-2 border-b border-neutral-100 pl-4 pr-2">
<div className="flex min-w-0 items-center gap-2.5">{view === "settings" ? <button type="button" className="-ml-2 rounded-full p-2 text-neutral-600 hover:bg-neutral-100 hover:text-neutral-900" onClick={() => setView("chat")} aria-label="Back to assistant" title="Back to assistant"><ArrowLeft size={18} /></button> : <Sparkles className="h-5 w-5 shrink-0 fill-blue-400/20 text-blue-600/70" aria-hidden="true" />}<div className="min-w-0"><strong className="block truncate text-sm font-semibold">{view === "settings" ? "Settings" : "Assistant"}</strong></div></div>
<div className="flex shrink-0 items-center gap-0.5"><details ref={menuRef} className="relative"><summary className={`list-none cursor-pointer rounded-full p-2 hover:bg-neutral-100 [&::-webkit-details-marker]:hidden ${view === "settings" ? "text-blue-700" : "text-neutral-600 hover:text-neutral-900"}`} aria-label="Assistant conversations and settings"><Settings2 size={18} /></summary><div className="absolute -right-16 top-full z-30 mt-2 flex w-72 flex-col overflow-hidden rounded-2xl border border-neutral-200 bg-white py-2 text-sm shadow-xl"><button type="button" className="flex items-center gap-2 px-4 py-2 text-left text-neutral-800 hover:bg-neutral-50" onClick={() => { abort.current?.abort(); abort.current = null; runningRef.current = false; queueGenerationRef.current += 1; queuedMessagesRef.current = []; setQueuedMessages([]); setBusy(false); selectedConversationRef.current = null; stickToBottomRef.current = true; if (mailboxId) saveAgentConversationId(mailboxId, null); setConversationId(null); setMessages([]); setLoadingConversation(false); setInput(""); setView("chat"); menuRef.current!.open = false; }}><Plus size={16} /> New chat</button><div className="mx-3 my-2 border-t border-neutral-100" />{conversations.length ? <><p className="px-4 pb-1 text-xs font-medium text-neutral-500">Previous chats</p><div className="max-h-64 overflow-y-auto">{conversations.map((item) => <div key={item.id} className={`group flex items-center hover:bg-neutral-50 ${conversationId === item.id ? "bg-blue-50 text-blue-700" : "text-neutral-700"}`}><button type="button" className="min-w-0 flex-1 truncate py-2 pl-4 pr-2 text-left" onClick={() => void selectConversation(item.id)}>{item.title}</button><button type="button" className="mr-2 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-neutral-500 opacity-0 transition-opacity hover:bg-red-50 hover:text-red-600 focus-visible:opacity-100 group-hover:opacity-100 group-focus-within:opacity-100 [@media(hover:none)]:opacity-100" aria-label={`Delete ${item.title}`} title="Delete chat" disabled={deletingConversationId !== null} onClick={() => void deleteConversation(item.id)}><Trash2 size={15} /></button></div>)}</div></> : <p className="px-4 py-3 text-neutral-500">No previous chats</p>}<div className="mx-3 my-2 border-t border-neutral-100" /><button type="button" className="flex items-center gap-2 px-4 py-2 text-left text-neutral-800 hover:bg-neutral-50" onClick={() => { setView((current) => current === "settings" ? "chat" : "settings"); menuRef.current!.open = false; }}><Settings2 size={16} /> {view === "settings" ? "Back to chat" : "Settings"}</button></div></details><button type="button" className="rounded-full p-2 text-neutral-600 hover:bg-neutral-100 hover:text-neutral-900" onClick={onToggleFullSize} aria-label={fullSize ? "Exit full size assistant" : "Expand assistant to full size"} aria-pressed={fullSize} title={fullSize ? "Exit full size" : "Full size"}>{fullSize ? <Minimize2 size={18} /> : <Maximize2 size={18} />}</button><button type="button" className="rounded-full p-2 text-neutral-600 hover:bg-neutral-100 hover:text-neutral-900" onClick={onClose} aria-label="Close assistant"><X size={18} /></button></div>
diff --git a/src/components/components-nav.tsx b/src/components/components-nav.tsx
index 67fc7d3..79d4c55 100644
--- a/src/components/components-nav.tsx
+++ b/src/components/components-nav.tsx
@@ -15,7 +15,13 @@ import {
} from "./components-nav-utils";
import type { NavLink } from "./components-nav-types";
-export function NavItem({ link }: { link: NavLink }) {
+type Props = {
+ link: NavLink,
+ iconClassName?: string,
+ labelClassName?: string,
+ wrap?: boolean
+}
+export function NavItem({ link, iconClassName, labelClassName, wrap }: Props) {
const pathname = usePathname();
const router = useRouter();
const { openComposer } = useCompose();
@@ -46,25 +52,26 @@ export function NavItem({ link }: { link: NavLink }) {
active ? "bg-blue-100 text-blue-900" : "hover:bg-stone-200/60",
dragOver && "bg-blue-50 text-blue-900 ring-1 ring-blue-200",
link.primary &&
- "mb-3 h-12 w-fit rounded-2xl bg-blue-100 px-5 text-blue-950 shadow-sm hover:bg-blue-200",
+ "mb-3 h-12 w-fit rounded-2xl bg-blue-100 px-5 text-blue-950 shadow-sm hover:bg-blue-200",
link.primary && minimal && "h-11 w-11 rounded-2xl px-0",
+ wrap && !minimal && "my-0.5 h-auto min-h-9 items-start py-2",
);
const dropProps = link.onMessageDrop
? {
- onDragOver: (event: DragEvent) => {
- event.preventDefault();
- event.dataTransfer.dropEffect = "move";
- setDragOver(true);
- },
- onDragLeave: () => setDragOver(false),
- onDrop: (event: DragEvent) => {
- const payload = getMessageDragData(event.dataTransfer);
- setDragOver(false);
- if (!payload) return;
- event.preventDefault();
- link.onMessageDrop?.(payload.messageIds);
- },
- }
+ onDragOver: (event: DragEvent) => {
+ event.preventDefault();
+ event.dataTransfer.dropEffect = "move";
+ setDragOver(true);
+ },
+ onDragLeave: () => setDragOver(false),
+ onDrop: (event: DragEvent) => {
+ const payload = getMessageDragData(event.dataTransfer);
+ setDragOver(false);
+ if (!payload) return;
+ event.preventDefault();
+ link.onMessageDrop?.(payload.messageIds);
+ },
+ }
: {};
if (link.href === "/compose") {
@@ -77,8 +84,9 @@ export function NavItem({ link }: { link: NavLink }) {
{...dropProps}
>
<Icon
- size={19}
+ size={19}
style={{ color: link.iconColor }}
+ className={iconClassName}
/>
{!minimal && <span className={cn("flex-1", typeof link.count === "number" && link.count > 0 && "font-semibold")}>{link.label}</span>}
{!minimal && typeof link.count === "number" && link.count > 0 && (
@@ -130,30 +138,31 @@ export function NavItem({ link }: { link: NavLink }) {
}
const navLink = (
- <Link
- href={link.href}
- onClick={navigate}
- aria-label={minimal ? link.label : undefined}
- className={cn(!minimal && "-ml-3 pl-6", classes)}
- {...dropProps}
- >
- <Icon
- // className={minimal ? "h-4 w-4" : "h-5 w-5"}
- style={{ color: link.iconColor }}
- size={16}
- />
- {!minimal && <span className={cn("flex-1", typeof link.count === "number" && link.count > 0 && "font-semibold")}>{link.label}</span>}
- {!minimal && typeof link.count === "number" && link.count > 0 && (
- <span className="ml-auto mr-3 rounded-full px-2 py-0.5 text-sm font-semibold text-neutral-700">
- {link.count > 99 ? "99+" : link.count}
- </span>
- )}
- {minimal && typeof link.count === "number" && link.count > 0 && (
- <span className="absolute -right-1 -top-1 min-w-4 rounded-full bg-blue-600 px-1 text-center text-[10px] font-semibold leading-4 text-white">
- {link.count > 99 ? "99+" : link.count}
- </span>
- )}
- </Link>
+ <Link
+ href={link.href}
+ onClick={navigate}
+ aria-label={minimal ? link.label : undefined}
+ className={cn(!minimal && "-ml-3 pl-6", classes)}
+ {...dropProps}
+ >
+ <Icon
+ // className={minimal ? "h-4 w-4" : "h-5 w-5"}
+ style={{ color: link.iconColor }}
+ size={16}
+ className={cn(wrap && !minimal && "mt-0.5 shrink-0", iconClassName)}
+ />
+ {!minimal && <span className={cn("flex-1", wrap && "min-w-0 break-words leading-5", labelClassName, typeof link.count === "number" && link.count > 0 && "font-semibold")}>{link.label}</span>}
+ {!minimal && typeof link.count === "number" && link.count > 0 && (
+ <span className={cn("ml-auto mr-3 rounded-full px-2 py-0.5 text-sm font-semibold text-neutral-700", wrap && "shrink-0 py-0 leading-5")}>
+ {link.count > 99 ? "99+" : link.count}
+ </span>
+ )}
+ {minimal && typeof link.count === "number" && link.count > 0 && (
+ <span className="absolute -right-1 -top-1 min-w-4 rounded-full bg-blue-600 px-1 text-center text-[10px] font-semibold leading-4 text-white">
+ {link.count > 99 ? "99+" : link.count}
+ </span>
+ )}
+ </Link>
);
return (
diff --git a/src/components/dashboard-nav.tsx b/src/components/dashboard-nav.tsx
index 7fdb01c..7a1fa32 100644
--- a/src/components/dashboard-nav.tsx
+++ b/src/components/dashboard-nav.tsx
@@ -260,6 +260,7 @@ export function DashboardNav({ className }: { className?: string }) {
{folders.map((folder) => (
<NavItem
key={folder.id}
+ wrap
link={{
href: `/folders/${folder.id}`,
label: folder.name,
diff --git a/src/components/mail-search/mail-search-input.tsx b/src/components/mail-search/mail-search-input.tsx
index 39d5be9..08772c1 100644
--- a/src/components/mail-search/mail-search-input.tsx
+++ b/src/components/mail-search/mail-search-input.tsx
@@ -1,5 +1,7 @@
"use client";
+import { useEffect, useRef, useState } from "react";
+import clsx from "clsx";
import { Search, X } from "lucide-react";
import { Input } from "@/components/ui/input";
import { useMailSearch } from "./mail-search-context";
@@ -9,11 +11,29 @@ export function MailSearchInput() {
const { input: query, setQuery } = useMailSearch();
const { openCommandPalette, shortcutsEnabled, shortcutsPreferenceLoading } = useShortcuts();
const showShortcutHints = shortcutsEnabled && !shortcutsPreferenceLoading;
+ // On phones the field is an icon until tapped, then covers the header at full width.
+ const [expanded, setExpanded] = useState(false);
+ const inputRef = useRef<HTMLInputElement>(null);
+
+ useEffect(() => {
+ if (expanded) inputRef.current?.focus();
+ }, [expanded]);
return (
- <div className="flex h-12 flex-1 items-center gap-2.5 rounded-full bg-[#eaf1fb] px-4 text-neutral-600 focus-within:ring-2 focus-within:ring-blue-500/30 transition-all">
+ <>
+ <button
+ type="button"
+ onClick={() => setExpanded(true)}
+ aria-label="Search mail"
+ className={clsx("ml-auto flex h-10 w-10 shrink-0 items-center justify-center rounded-full hover:bg-neutral-200 md:hidden", query ? "bg-blue-100 text-blue-700" : "text-neutral-600", expanded && "hidden")}
+ >
+ <Search className="h-5 w-5" />
+ </button>
+ <div className={clsx("h-12 flex-1 items-center gap-2.5 rounded-full bg-[#eaf1fb] px-4 text-neutral-600 focus-within:ring-2 focus-within:ring-blue-500/30 transition-all md:flex", expanded ? "flex max-md:fixed max-md:inset-x-2 max-md:top-2 max-md:z-[60] max-md:shadow-md" : "max-md:hidden")}>
<Search className="h-5 w-5 shrink-0" />
<Input
+ ref={inputRef}
+ onBlur={() => setExpanded(false)}
value={query}
onChange={(event) => setQuery(event.target.value)}
placeholder={showShortcutHints ? "Search mail (press / to focus)" : "Search mail"}
@@ -22,6 +42,7 @@ export function MailSearchInput() {
{query ? (
<button
type="button"
+ onMouseDown={(event) => event.preventDefault()}
onClick={() => setQuery("")}
className="rounded-full p-1 text-neutral-500 hover:bg-blue-100 hover:text-neutral-800"
aria-label="Clear search"
@@ -39,5 +60,6 @@ export function MailSearchInput() {
</button>
) : null}
</div>
+ </>
);
}
diff --git a/src/components/messages/bulk-message-toolbar.tsx b/src/components/messages/bulk-message-toolbar.tsx
index f7486e6..dbfbcaf 100644
--- a/src/components/messages/bulk-message-toolbar.tsx
+++ b/src/components/messages/bulk-message-toolbar.tsx
@@ -1,12 +1,15 @@
"use client";
-import { Archive, Mail, MailOpen, ShieldAlert, Trash2, X } from "lucide-react";
+import { Archive, Mail, MailOpen, MoreVertical, ShieldAlert, Trash2, X } from "lucide-react";
+import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
import { Button } from "@/components/ui/button";
import { Select } from "@/components/ui/select";
import { Tooltip } from "@/components/ui/tooltip";
import type { BulkMessageAction } from "@/app/api/messages/bulk/types";
import type { BulkMessageToolbarProps } from "./types";
+const menuItemClass = "flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-neutral-700 outline-none data-[disabled]:opacity-50 data-[highlighted]:bg-neutral-100";
+
export function BulkMessageToolbar({
selectedCount,
hasUnreadSelection,
@@ -22,12 +25,13 @@ export function BulkMessageToolbar({
{selectedCount} selected
</span>
)}
- <Tooltip label="Archive">
+ <span className="flex-1 md:hidden" />
+ <Tooltip label="Archive" className="max-md:hidden">
<Button variant="ghost" size="sm" onClick={() => onAction("archive")} disabled={pending} aria-label="Archive">
<Archive className="h-4 w-4" />
</Button>
</Tooltip>
- <Tooltip label="Report spam">
+ <Tooltip label="Report spam" className="max-md:hidden">
<Button variant="ghost" size="sm" onClick={() => onAction("spam")} disabled={pending} aria-label="Report spam">
<ShieldAlert className="h-4 w-4" />
</Button>
@@ -48,8 +52,8 @@ export function BulkMessageToolbar({
{hasUnreadSelection ? <MailOpen className="h-4 w-4" /> : <Mail className="h-4 w-4" />}
</Button>
</Tooltip>
- <span className="flex-1" />
- <Tooltip label="Move selected messages">
+ <span className="flex-1 max-md:hidden" />
+ <Tooltip label="Move selected messages" className="max-md:hidden">
<Select
className="bg-white text-xs font-medium py-2 text-neutral-700 outline-none"
disabled={pending}
@@ -67,11 +71,26 @@ export function BulkMessageToolbar({
<option value="trash">Trash</option>
</Select>
</Tooltip>
- <Tooltip label="Clear selection">
+ <Tooltip label="Clear selection" className="max-md:hidden">
<Button variant="ghost" size="sm" onClick={onClearSelection} disabled={pending} aria-label="Clear selection">
<X className="h-4 w-4" />
</Button>
</Tooltip>
+ <DropdownMenu.Root>
+ <DropdownMenu.Trigger asChild>
+ <Button variant="ghost" size="sm" className="md:hidden" disabled={pending} aria-label="More actions">
+ <MoreVertical className="h-4 w-4" />
+ </Button>
+ </DropdownMenu.Trigger>
+ <DropdownMenu.Portal>
+ <DropdownMenu.Content align="end" sideOffset={4} className="z-[130] min-w-44 rounded-xl border border-neutral-200 bg-white p-1 shadow-xl md:hidden">
+ <DropdownMenu.Item className={menuItemClass} onSelect={() => onAction("archive")}><Archive className="h-4 w-4" />Archive</DropdownMenu.Item>
+ <DropdownMenu.Item className={menuItemClass} onSelect={() => onAction("spam")}><ShieldAlert className="h-4 w-4" />Report spam</DropdownMenu.Item>
+ <DropdownMenu.Separator className="my-1 h-px bg-neutral-100" />
+ <DropdownMenu.Item className={menuItemClass} onSelect={onClearSelection}><X className="h-4 w-4" />Clear selection</DropdownMenu.Item>
+ </DropdownMenu.Content>
+ </DropdownMenu.Portal>
+ </DropdownMenu.Root>
</div>
);
}
diff --git a/src/components/messages/message-folder-page.tsx b/src/components/messages/message-folder-page.tsx
index 7cfbeb3..ab36c65 100644
--- a/src/components/messages/message-folder-page.tsx
+++ b/src/components/messages/message-folder-page.tsx
@@ -3,7 +3,7 @@
import Link from "next/link";
import { useEffect, useMemo, useState } from "react";
import type { MouseEvent } from "react";
-import { ChevronLeft, ChevronRight, ListFilter } from "lucide-react";
+import { Archive, ChevronLeft, ChevronRight, ListFilter, Mail, MailOpen } from "lucide-react";
import { Button } from "@/components/ui/button";
import { Checkbox } from "@/components/ui/checkbox";
import { Tooltip } from "@/components/ui/tooltip";
@@ -17,12 +17,13 @@ import type { BulkMessageAction } from "@/app/api/messages/bulk/types";
import type { Message } from "@/hooks/types";
import { setMessageDragData } from "@/lib/messages/drag-utils";
import { BulkMessageToolbar } from "./bulk-message-toolbar";
+import { SwipeableRow } from "./swipeable-row";
import { MessageListRowActions } from "./message-list-row-actions";
import { dispatchMessageCountsDelta, toggleMessageStar } from "./message-list-row-actions-utils";
import { MessageNavigationProgress, useMessageNavigation } from "./message-navigation";
import { rememberOpenedUnreadMessage } from "./message-detail-navigation-utils";
import { useConversationView } from "./use-conversation-view";
-import type { MessageFolderPageProps, MessageListRowProps } from "./types";
+import type { MessageFolderPageProps, MessageListRowProps, RowMessageAction } from "./types";
import {
formatMessageListTimestamp,
getPageRange,
@@ -64,6 +65,32 @@ function MessageListRow({
const href = `${config.hrefPrefix}/${message.id}`;
const navigation = useMessageNavigation(href, rowMessage);
+ async function runRowAction(action: RowMessageAction) {
+ const previousRead = read;
+ const previousThreadUnread = threadUnread;
+ const unreadDelta = action === "read" ? -1 : action === "unread" ? 1 : 0;
+ if (action === "read") setRead(true);
+ if (action === "unread") setRead(false);
+ // Grouped rows derive their unread styling from the thread count, so it must change with the row.
+ if (message.threadMessageIds) {
+ if (action === "read") setThreadUnread(0);
+ if (action === "unread") setThreadUnread(message.threadMessageIds.length);
+ }
+ if (unreadDelta) dispatchMessageCountsDelta({ inboxUnreadDelta: unreadDelta });
+ try {
+ await onMessageAction(message.id, action);
+ } catch (error) {
+ if (action === "read" || action === "unread") {
+ setRead(previousRead);
+ setThreadUnread(previousThreadUnread);
+ if (unreadDelta) dispatchMessageCountsDelta({ inboxUnreadDelta: -unreadDelta });
+ }
+ throw error;
+ }
+ }
+
+ const swipeable = compact && (config.folder === "inbox" || config.folder === "snoozed") && message.direction === "inbound";
+
function onMessageNavigate(event: MouseEvent<HTMLAnchorElement>) {
if (!read && !event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey) {
rememberOpenedUnreadMessage(message.id);
@@ -81,7 +108,7 @@ function MessageListRow({
}
if (compact && config.folder !== "drafts") {
- return (
+ const compactRow = (
<div
className={`group grid grid-cols-[20px_minmax(0,1fr)] gap-3 border-l-2 px-4 py-3 transition-colors ${active
? "border-l-blue-600 bg-blue-50"
@@ -104,7 +131,7 @@ function MessageListRow({
/>
<Link href={href} onClick={onMessageNavigate} className="min-w-0">
<span className="flex items-baseline justify-between gap-3">
- <span className={clsx(unread && "font-semibold",getMessagePartyClassName(message, config.folder))}>
+ <span className={clsx(unread && "font-semibold",getMessagePartyClassName(rowMessage, config.folder))}>
{party}
{(message.threadCount ?? 1) > 1 && (
@@ -127,6 +154,25 @@ function MessageListRow({
</Link>
</div>
);
+ if (!swipeable) return compactRow;
+ return (
+ <SwipeableRow
+ startAction={{
+ label: read ? "Mark unread" : "Mark read",
+ icon: read ? Mail : MailOpen,
+ className: "bg-blue-600",
+ onTrigger: () => void runRowAction(read ? "unread" : "read").catch(() => undefined),
+ }}
+ endAction={{
+ label: "Archive",
+ icon: Archive,
+ className: "bg-emerald-600",
+ onTrigger: () => void runRowAction("archive").catch(() => undefined),
+ }}
+ >
+ {compactRow}
+ </SwipeableRow>
+ );
}
const className =
@@ -215,22 +261,7 @@ function MessageListRow({
{(config.folder === "inbox" || config.folder === "snoozed") && message.direction === "inbound" && (
<MessageListRowActions
message={rowMessage}
- onAction={async (action) => {
- const previousRead = read;
- const unreadDelta = action === "read" ? -1 : action === "unread" ? 1 : 0;
- if (action === "read") setRead(true);
- if (action === "unread") setRead(false);
- if (unreadDelta) dispatchMessageCountsDelta({ inboxUnreadDelta: unreadDelta });
- try {
- await onMessageAction(message.id, action);
- } catch (error) {
- if (action === "read" || action === "unread") {
- setRead(previousRead);
- if (unreadDelta) dispatchMessageCountsDelta({ inboxUnreadDelta: -unreadDelta });
- }
- throw error;
- }
- }}
+ onAction={runRowAction}
/>
)}
</div>
diff --git a/src/components/messages/swipeable-row.tsx b/src/components/messages/swipeable-row.tsx
new file mode 100644
index 0000000..8029027
--- /dev/null
+++ b/src/components/messages/swipeable-row.tsx
@@ -0,0 +1,107 @@
+"use client";
+
+import clsx from "clsx";
+import { useRef, useState, type PointerEvent, type ReactNode } from "react";
+import type { LucideIcon } from "lucide-react";
+
+type SwipeAction = {
+ label: string;
+ icon: LucideIcon;
+ className: string;
+ onTrigger: () => void;
+};
+
+type SwipeableRowProps = {
+ children: ReactNode;
+ // Revealed when dragging left to right.
+ startAction: SwipeAction;
+ // Revealed when dragging right to left.
+ endAction: SwipeAction;
+ disabled?: boolean;
+};
+
+const COMMIT_DISTANCE = 88;
+const INTENT_DISTANCE = 10;
+
+// Touch-only swipe gestures; vertical scrolling stays with the browser via touch-action: pan-y.
+export function SwipeableRow({ children, startAction, endAction, disabled }: SwipeableRowProps) {
+ const [offset, setOffset] = useState(0);
+ const [dragging, setDragging] = useState(false);
+ const gesture = useRef<{ x: number; y: number; active: boolean; id: number } | null>(null);
+ const swiped = useRef(false);
+
+ function onPointerDown(event: PointerEvent<HTMLDivElement>) {
+ if (disabled || event.pointerType === "mouse") return;
+ gesture.current = { x: event.clientX, y: event.clientY, active: false, id: event.pointerId };
+ swiped.current = false;
+ }
+
+ function onPointerMove(event: PointerEvent<HTMLDivElement>) {
+ const current = gesture.current;
+ if (!current || current.id !== event.pointerId) return;
+ const dx = event.clientX - current.x;
+ const dy = event.clientY - current.y;
+ if (!current.active) {
+ if (Math.abs(dy) > INTENT_DISTANCE && Math.abs(dy) > Math.abs(dx)) {
+ gesture.current = null;
+ return;
+ }
+ if (Math.abs(dx) < INTENT_DISTANCE) return;
+ current.active = true;
+ setDragging(true);
+ event.currentTarget.setPointerCapture(event.pointerId);
+ }
+ setOffset(dx);
+ }
+
+ function finish(event: PointerEvent<HTMLDivElement>) {
+ const current = gesture.current;
+ if (!current || current.id !== event.pointerId) return;
+ gesture.current = null;
+ if (!current.active) return;
+ swiped.current = true;
+ setDragging(false);
+ const dx = event.clientX - current.x;
+ setOffset(0);
+ if (event.type !== "pointercancel") {
+ if (dx >= COMMIT_DISTANCE) startAction.onTrigger();
+ else if (dx <= -COMMIT_DISTANCE) endAction.onTrigger();
+ }
+ }
+
+ const action = offset > 0 ? startAction : offset < 0 ? endAction : null;
+ const Icon = action?.icon;
+ const armed = Math.abs(offset) >= COMMIT_DISTANCE;
+
+ return (
+ <div className="relative overflow-hidden">
+ {action && Icon && (
+ <div
+ aria-hidden="true"
+ className={clsx("absolute inset-0 flex items-center px-6 text-white", offset > 0 ? "justify-start" : "justify-end", action.className)}
+ >
+ <span className={clsx("flex items-center gap-2 text-sm font-medium transition-transform", armed && "scale-110")}>
+ <Icon className="h-5 w-5" />
+ {action.label}
+ </span>
+ </div>
+ )}
+ <div
+ onPointerDown={onPointerDown}
+ onPointerMove={onPointerMove}
+ onPointerUp={finish}
+ onPointerCancel={finish}
+ onClickCapture={(event) => {
+ if (!swiped.current) return;
+ swiped.current = false;
+ event.preventDefault();
+ event.stopPropagation();
+ }}
+ className={clsx("relative bg-white", !dragging && "transition-transform duration-200 ease-out motion-reduce:transition-none")}
+ style={{ transform: offset ? `translateX(${offset}px)` : undefined, touchAction: "pan-y" }}
+ >
+ {children}
+ </div>
+ </div>
+ );
+}
diff --git a/src/components/page-header-utils.ts b/src/components/page-header-utils.ts
new file mode 100644
index 0000000..dc03852
--- /dev/null
+++ b/src/components/page-header-utils.ts
@@ -0,0 +1,7 @@
+// A page's primary "New ..." button floats at the bottom of the screen on phones, within thumb reach.
+export const mobilePrimaryActionClass =
+ "max-md:fixed max-md:inset-x-4 max-md:bottom-4 max-md:z-40 max-md:h-12 max-md:rounded-full max-md:shadow-lg";
+
+// Same, lifted above the settings section pill.
+export const mobilePrimaryActionAboveNavClass =
+ "max-md:fixed max-md:inset-x-4 max-md:bottom-20 max-md:z-40 max-md:h-12 max-md:rounded-full max-md:shadow-lg";
diff --git a/src/components/section-nav-sheet.tsx b/src/components/section-nav-sheet.tsx
new file mode 100644
index 0000000..5c7164c
--- /dev/null
+++ b/src/components/section-nav-sheet.tsx
@@ -0,0 +1,72 @@
+"use client";
+
+import clsx from "clsx";
+import { ChevronUp } from "lucide-react";
+import { usePathname } from "next/navigation";
+import { useEffect, useState, type ReactNode } from "react";
+import { useIsMobile } from "./sidebar-mobile-utils";
+
+type SectionNavSheetProps = {
+ label: string;
+ title: string;
+ children: ReactNode;
+ className?: string;
+};
+
+// Inline column from md up; on phones a bottom sheet opened from a floating pill showing the current section.
+export function SectionNavSheet({ label, title, children, className }: SectionNavSheetProps) {
+ const mobile = useIsMobile();
+ const pathname = usePathname();
+ const [open, setOpen] = useState(false);
+ const hidden = mobile && !open;
+
+ useEffect(() => {
+ setOpen(false);
+ }, [pathname, mobile]);
+
+ useEffect(() => {
+ if (!open) return;
+ const onKeyDown = (event: KeyboardEvent) => {
+ if (event.key === "Escape") setOpen(false);
+ };
+ window.addEventListener("keydown", onKeyDown);
+ return () => window.removeEventListener("keydown", onKeyDown);
+ }, [open]);
+
+ return (
+ <>
+ <button
+ type="button"
+ onClick={() => setOpen(true)}
+ aria-haspopup="dialog"
+ aria-expanded={open}
+ className="fixed bottom-4 left-1/2 z-40 flex -translate-x-1/2 items-center gap-2 rounded-full bg-neutral-900 px-4 py-2.5 text-sm font-medium text-white shadow-lg md:hidden"
+ >
+ <span className="max-w-[60vw] truncate">{label}</span>
+ <ChevronUp size={16} aria-hidden="true" />
+ </button>
+ <div
+ onClick={() => setOpen(false)}
+ aria-hidden="true"
+ className={clsx("fixed inset-0 z-[100] bg-black/40 transition-opacity duration-200 ease-out motion-reduce:transition-none md:hidden", open ? "opacity-100" : "pointer-events-none opacity-0")}
+ />
+ <aside
+ role={mobile ? "dialog" : undefined}
+ aria-label={title}
+ aria-hidden={hidden}
+ inert={hidden}
+ className={clsx(
+ "fixed inset-x-0 bottom-0 z-[110] max-h-[85dvh] overflow-y-auto overscroll-contain rounded-t-3xl bg-white pb-[env(safe-area-inset-bottom)] shadow-2xl transition-transform duration-300 ease-out motion-reduce:transition-none",
+ "md:static md:z-auto md:max-h-none md:translate-y-0 md:overflow-visible md:rounded-none md:bg-transparent md:pb-0 md:shadow-none",
+ open ? "translate-y-0" : "translate-y-full",
+ className,
+ )}
+ >
+ <div className="flex justify-center pt-3 md:hidden" onClick={() => setOpen(false)}>
+ <span className="h-1.5 w-10 rounded-full bg-neutral-300" />
+ </div>
+ {children}
+ </aside>
+ </>
+ );
+}
diff --git a/src/components/settings/account-settings.tsx b/src/components/settings/account-settings.tsx
index a3d7a94..da99868 100644
--- a/src/components/settings/account-settings.tsx
+++ b/src/components/settings/account-settings.tsx
@@ -45,7 +45,7 @@ export function AccountSettings() {
return (
<div className="space-y-8 py-4">
{/* <div>
- <h1 className="text-3xl font-medium text-neutral-900">Account</h1>
+ <h1 className="text-2xl md:text-3xl font-medium text-neutral-900">Account</h1>
<p className="mt-1 text-sm text-neutral-500">Manage your account details and sign-in password.</p>
</div> */}
diff --git a/src/components/settings/api-keys-settings.tsx b/src/components/settings/api-keys-settings.tsx
index 2b8b2f7..b9c7a66 100644
--- a/src/components/settings/api-keys-settings.tsx
+++ b/src/components/settings/api-keys-settings.tsx
@@ -1,5 +1,6 @@
"use client";
+import { mobilePrimaryActionAboveNavClass } from "@/components/page-header-utils";
import { useEffect, useState } from "react";
import { Copy, KeyRound, Plus, Trash2 } from "lucide-react";
import { useSelectedMailbox } from "@/components/mailbox-provider";
@@ -72,9 +73,9 @@ export function ApiKeysSettings() {
return <div className="space-y-6">
<div className="flex items-center justify-between gap-4">
- <h1 className="text-3xl font-medium">API keys</h1>
+ <h1 className="text-2xl md:text-3xl font-medium">API keys</h1>
<Dialog open={createOpen} onOpenChange={(open) => { if (busy) return; setCreateOpen(open); setError(null); if (open && mailboxIds.length === 0) setMailboxIds([selectedMailbox?.id ?? mailboxes[0]?.id].filter((id): id is string => !!id)); if (!open) { setNewKey(null); setCopied(false); } }}>
- <DialogTrigger asChild><Button type="button"><Plus className="h-4 w-4" />New API key</Button></DialogTrigger>
+ <DialogTrigger asChild><Button type="button" className={mobilePrimaryActionAboveNavClass}><Plus className="h-4 w-4" />New API key</Button></DialogTrigger>
<DialogContent className="max-h-[calc(100vh-4rem)] overflow-y-auto">
<DialogHeader><DialogTitle>{newKey ? "API key created" : "Create API key"}</DialogTitle><DialogDescription>{newKey ? "Copy this key now. It will only be shown once." : "Name your key and choose the access it needs."}</DialogDescription></DialogHeader>
{!newKey && <form onSubmit={(event) => void create(event)} className="space-y-4">
diff --git a/src/components/settings/current-mailbox-form.tsx b/src/components/settings/current-mailbox-form.tsx
index 501ecdb..c6eebfd 100644
--- a/src/components/settings/current-mailbox-form.tsx
+++ b/src/components/settings/current-mailbox-form.tsx
@@ -63,7 +63,7 @@ export function CurrentMailboxForm() {
if (!selectedMailbox) {
return (
<div className="space-y-6">
- <h1 className="text-3xl font-medium text-neutral-900">Settings</h1>
+ <h1 className="text-2xl md:text-3xl font-medium text-neutral-900">Settings</h1>
<Card className="rounded-3xl border-0 bg-white p-6">
<CardContent className="p-6 text-sm text-neutral-500">
Select a mailbox to view its settings.
@@ -79,7 +79,7 @@ export function CurrentMailboxForm() {
return (
<div className="space-y-8">
<div>
- <h1 className="text-3xl font-medium text-neutral-900">Settings</h1>
+ <h1 className="text-2xl md:text-3xl font-medium text-neutral-900">Settings</h1>
<p className="mt-1 text-sm text-neutral-500">{address}</p>
</div>
diff --git a/src/components/settings/settings-nav.tsx b/src/components/settings/settings-nav.tsx
index 26756b2..472d310 100644
--- a/src/components/settings/settings-nav.tsx
+++ b/src/components/settings/settings-nav.tsx
@@ -3,13 +3,15 @@
import Link from "next/link";
import { usePathname } from "next/navigation";
import { cn } from "@/lib/utils";
+import { SectionNavSheet } from "../section-nav-sheet";
import { isActiveSettingsPath, settingsNavSections } from "./settings-nav-utils";
export function SettingsNav() {
const pathname = usePathname();
+ const currentLabel = settingsNavSections.flatMap((section) => section.items).find((item) => isActiveSettingsPath(pathname, item.href))?.label ?? "Settings";
return (
- <aside className="w-full border-b border-blue-100/70 px-4 py-4 md:min-h-full md:w-64 md:border-b-0 md:border-r md:py-10">
+ <SectionNavSheet title="Settings menu" label={currentLabel} className="w-full px-4 py-4 md:min-h-full md:w-64 md:border-r md:border-blue-100/70 md:py-10">
<div className="sticky top-6 space-y-7">
{settingsNavSections.map((section) => (
<div key={section.label} className="space-y-3">
@@ -38,6 +40,6 @@ export function SettingsNav() {
</div>
))}
</div>
- </aside>
+ </SectionNavSheet>
);
}
diff --git a/src/components/sidebar-aside.tsx b/src/components/sidebar-aside.tsx
new file mode 100644
index 0000000..b8451ba
--- /dev/null
+++ b/src/components/sidebar-aside.tsx
@@ -0,0 +1,61 @@
+"use client";
+
+import clsx from "clsx";
+import { Menu } from "lucide-react";
+import type { ReactNode } from "react";
+import { useBranding } from "./branding-provider";
+import { useSidebar } from "./sidebar-state";
+
+export function SidebarAside({ children, className }: { children: ReactNode; className?: string }) {
+ const { mobile, mobileOpen, toggle } = useSidebar();
+ const hidden = mobile && !mobileOpen;
+
+ return (
+ <>
+ <div
+ onClick={toggle}
+ aria-hidden="true"
+ className={clsx("fixed inset-0 z-[100] bg-black/40 transition-opacity duration-200 ease-out motion-reduce:transition-none md:hidden", mobileOpen ? "opacity-100" : "pointer-events-none opacity-0")}
+ />
+ <aside
+ aria-hidden={hidden}
+ inert={hidden}
+ className={clsx(
+ "fixed inset-y-0 left-0 z-[110] w-[min(85vw,300px)] min-h-0 min-w-0 bg-[#f6f8fc] transition-transform duration-200 ease-out motion-reduce:transition-none",
+ "md:relative md:z-30 md:w-[var(--sidebar-width)] md:translate-x-0 md:shadow-none",
+ mobileOpen ? "translate-x-0 shadow-xl" : "-translate-x-full",
+ className,
+ )}
+ >
+ {children}
+ </aside>
+ </>
+ );
+}
+
+export function MobileMenuButton({ className }: { className?: string }) {
+ const { mobile, mobileOpen, toggle } = useSidebar();
+ if (!mobile) return null;
+ return (
+ <button type="button" onClick={toggle} aria-label="Open menu" aria-expanded={mobileOpen} className={clsx("flex h-10 w-10 shrink-0 items-center justify-center rounded-full text-neutral-600 hover:bg-neutral-200 md:hidden", className)}>
+ <Menu size={20} />
+ </button>
+ );
+}
+
+export function MobileBrandIcon() {
+ const branding = useBranding();
+ return <img src={branding.iconUrl} height={24} width={24} alt="" className="shrink-0 md:hidden" />;
+}
+
+// Phone top bar for pages without a header of their own: menu button, brand icon, then the page title.
+export function MobileTopBar({ title }: { title?: string }) {
+ const branding = useBranding();
+ return (
+ <div className="flex h-16 shrink-0 items-center gap-2 pl-2 md:hidden">
+ <MobileMenuButton />
+ <MobileBrandIcon />
+ {title && <h2 className="min-w-0 max-w-[40vw] truncate text-base font-medium text-neutral-900">{title}</h2>}
+ </div>
+ );
+}
diff --git a/src/components/sidebar-state-types.d.ts b/src/components/sidebar-state-types.d.ts
index 10e435c..5c1dda2 100644
--- a/src/components/sidebar-state-types.d.ts
+++ b/src/components/sidebar-state-types.d.ts
@@ -7,11 +7,14 @@ export type SidebarState = {
toggle(): void;
setWidth(width: number): void;
setForcedMinimal(minimal: boolean): void;
+ mobile: boolean;
+ mobileOpen: boolean;
};
export type SidebarProviderProps = {
children: ReactNode;
expandedWidth?: number;
+ mobileOverlay?: boolean;
};
export type SidebarHeaderProps = {
diff --git a/src/components/sidebar-state.tsx b/src/components/sidebar-state.tsx
index eece926..a96976f 100644
--- a/src/components/sidebar-state.tsx
+++ b/src/components/sidebar-state.tsx
@@ -7,9 +7,9 @@ import { isMobileViewport, useIsMobile } from "./sidebar-mobile-utils";
import { readInitialSidebarMinimal, saveInitialSidebarMinimal, syncInitialSidebarWidth } from "./sidebar-state-utils";
import type { SidebarProviderProps, SidebarState } from "./sidebar-state-types";
-const SidebarContext = createContext<SidebarState>({ minimal: false, width: 260, userId: null, toggle: () => undefined, setWidth: () => undefined, setForcedMinimal: () => undefined });
+const SidebarContext = createContext<SidebarState>({ minimal: false, width: 260, userId: null, toggle: () => undefined, setWidth: () => undefined, setForcedMinimal: () => undefined, mobile: false, mobileOpen: false });
-export function SidebarProvider({ children, expandedWidth = 260 }: SidebarProviderProps) {
+export function SidebarProvider({ children, expandedWidth = 260, mobileOverlay = false }: SidebarProviderProps) {
const [minimal, setMinimal] = useState(false);
const [forcedMinimal, setForcedMinimal] = useState(false);
const [width, setWidth] = useState(expandedWidth);
@@ -18,6 +18,13 @@ export function SidebarProvider({ children, expandedWidth = 260 }: SidebarProvid
const [storageKey, setStorageKey] = useState<string | null>(null);
const pathname = usePathname();
const mobile = useIsMobile();
+ const [mobileOpen, setMobileOpen] = useState(false);
+ // Overlay layouts have no minified rail on phones: the menu is either fully shown over the page or hidden.
+ const overlay = mobileOverlay && mobile;
+
+ useEffect(() => {
+ setMobileOpen(false);
+ }, [pathname, mobile]);
// Collapse on first load and after every navigation on phones, so the overlay never sticks open.
useEffect(() => {
@@ -72,6 +79,10 @@ export function SidebarProvider({ children, expandedWidth = 260 }: SidebarProvid
}, []);
function toggle() {
+ if (overlay) {
+ setMobileOpen((current) => !current);
+ return;
+ }
if (forcedMinimal) {
setForcedMinimal(false);
setMinimal(false);
@@ -92,7 +103,7 @@ export function SidebarProvider({ children, expandedWidth = 260 }: SidebarProvid
}
return (
- <SidebarContext.Provider value={{ minimal: minimal || forcedMinimal, width, userId, toggle, setWidth, setForcedMinimal }}>
+ <SidebarContext.Provider value={{ minimal: !overlay && (minimal || forcedMinimal), width, userId, toggle, setWidth, setForcedMinimal, mobile: overlay, mobileOpen }}>
<div className="h-full" style={{ "--sidebar-width": widthReady ? `${minimal || forcedMinimal ? 72 : width}px` : `var(--persisted-sidebar-width, ${expandedWidth}px)`, "--sidebar-transition-duration": widthReady ? "200ms" : "0ms" } as React.CSSProperties}>
{children}
</div>
diff --git a/src/lib/agent/provider-models.ts b/src/lib/agent/provider-models.ts
index 98bb93a..fad9a4a 100644
--- a/src/lib/agent/provider-models.ts
+++ b/src/lib/agent/provider-models.ts
@@ -1,4 +1,4 @@
-import type { AgentModelOption, AgentProviderPreset } from "./provider-types";
+import type { AgentModelOption, AgentModelRates, AgentProviderPreset } from "./provider-types";
import { getAgentProviderConfig, resolveAgentBaseUrl } from "./provider";
export const CLOUDFLARE_TOOL_MODELS: AgentModelOption[] = [
@@ -7,13 +7,38 @@ export const CLOUDFLARE_TOOL_MODELS: AgentModelOption[] = [
{ id: "@cf/qwen/qwen3-30b-a3b-fp8", name: "Qwen3 30B" },
];
+function perMillion(value: unknown, perToken: boolean): number | null {
+ const price = typeof value === "string" ? Number(value) : value;
+ if (typeof price !== "number" || !Number.isFinite(price) || price < 0) return null;
+ return Number((perToken ? price * 1_000_000 : price).toPrecision(10));
+}
+
+// Workers AI lists prices as [{ unit: "per M input tokens", price, currency: "USD" }, ...] under properties.
+function cloudflareRates(properties: unknown): AgentModelRates | undefined {
+ if (!Array.isArray(properties)) return undefined;
+ const entry = properties.find((item) => item && typeof item === "object" && item.property_id === "price");
+ const prices: { unit?: unknown; price?: unknown; currency?: unknown }[] = Array.isArray(entry?.value) ? entry.value : [];
+ const find = (kind: "input" | "output") => prices.find((item) => item?.currency === "USD" && /per m/i.test(String(item.unit)) && String(item.unit).toLowerCase().includes(kind));
+ const input = perMillion(find("input")?.price, false);
+ const output = perMillion(find("output")?.price, false);
+ return input === null || output === null ? undefined : { input, output };
+}
+
+// OpenRouter publishes pricing.prompt / pricing.completion as USD per token (strings). Other providers omit pricing.
+function openRouterRates(pricing: unknown): AgentModelRates | undefined {
+ if (!pricing || typeof pricing !== "object") return undefined;
+ const input = perMillion((pricing as { prompt?: unknown }).prompt, true);
+ const output = perMillion((pricing as { completion?: unknown }).completion, true);
+ return input === null || output === null ? undefined : { input, output };
+}
+
export async function listCloudflareAgentModels(env: CloudflareEnv): Promise<{ models: AgentModelOption[]; source: "catalog" | "suggested" }> {
if (!env.CF_ACCOUNT_ID || !env.CF_TOKEN) return { models: CLOUDFLARE_TOOL_MODELS, source: "suggested" };
try {
const response = await fetch(`https://api.cloudflare.com/client/v4/accounts/${encodeURIComponent(env.CF_ACCOUNT_ID)}/ai/models/search?task=Text%20Generation`, { headers: { Authorization: `Bearer ${env.CF_TOKEN}` }, signal: AbortSignal.timeout(10_000), redirect: "error" });
if (!response.ok) throw new Error("Catalog unavailable");
- const json = await response.json() as { result?: { name?: unknown; description?: unknown; task?: unknown }[] };
- const models = (json.result ?? []).filter((item) => typeof item.name === "string" && item.name.startsWith("@cf/") && (item.task === "Text Generation" || item.task === "text-generation" || !item.task)).map((item) => ({ id: item.name as string, name: item.name as string })).slice(0, 200);
+ const json = await response.json() as { result?: { name?: unknown; description?: unknown; task?: unknown; properties?: unknown }[] };
+ const models = (json.result ?? []).filter((item) => typeof item.name === "string" && item.name.startsWith("@cf/") && (item.task === "Text Generation" || item.task === "text-generation" || !item.task)).map((item) => ({ id: item.name as string, name: item.name as string, rates: cloudflareRates(item.properties) })).slice(0, 200);
return models.length ? { models, source: "catalog" } : { models: CLOUDFLARE_TOOL_MODELS, source: "suggested" };
} catch { return { models: CLOUDFLARE_TOOL_MODELS, source: "suggested" }; }
}
@@ -25,8 +50,8 @@ export async function listCompatibleAgentModels(env: CloudflareEnv, input: { pre
if (!key) throw new Error("Enter an API key to load models");
const response = await fetch(`${baseUrl}/models`, { headers: { Authorization: `Bearer ${key}`, Accept: "application/json" }, signal: AbortSignal.timeout(10_000), redirect: "error" });
if (!response.ok) throw new Error(`Model list request failed (${response.status})`);
- const json = await response.json() as { data?: { id?: unknown; name?: unknown }[] };
- const models = (json.data ?? []).filter((item) => typeof item.id === "string" && item.id.length <= 200).map((item) => ({ id: item.id as string, name: typeof item.name === "string" ? item.name : item.id as string })).slice(0, 2_000).sort((a, b) => a.name.localeCompare(b.name));
+ const json = await response.json() as { data?: { id?: unknown; name?: unknown; pricing?: unknown }[] };
+ const models = (json.data ?? []).filter((item) => typeof item.id === "string" && item.id.length <= 200).map((item) => ({ id: item.id as string, name: typeof item.name === "string" ? item.name : item.id as string, rates: input.preset === "openrouter" ? openRouterRates(item.pricing) : undefined })).slice(0, 2_000).sort((a, b) => a.name.localeCompare(b.name));
if (!models.length) throw new Error("Provider returned no models");
return { models, source: "catalog" as const };
}
diff --git a/src/lib/agent/provider-types.d.ts b/src/lib/agent/provider-types.d.ts
index e52b232..e2dbc09 100644
--- a/src/lib/agent/provider-types.d.ts
+++ b/src/lib/agent/provider-types.d.ts
@@ -18,4 +18,5 @@ export type AgentProviderPublicConfig = Omit<AgentProviderConfig, "apiKey"> & {
configured: boolean;
};
-export type AgentModelOption = { id: string; name: string };
+// rates are USD per 1M tokens, present only when the provider's own model catalog publishes pricing.
+export type AgentModelOption = { id: string; name: string; rates?: AgentModelRates };