Accounts sign-in looks like the church's site; Events sends its logo and colours

- @crosscode/ui: Shell with the church's colour wash, logo (or its initial)
  and name, footer; Card edged in the church's colour; Heading with an
  icon tile. Icons on every sign-in step.
- contracts 1.9.0: churchLookSchema (logo, accent colour) in import.begin;
  church.branding request. Accounts fills (move) or replaces (button) the
  church profile's name, logo and colours.
- Events 3.1.0: src/accounts/look.ts (logo as a full address), sent with a
  move; Settings -> Sign-in "Use this site's logo and colours".
Tests: Accounts 55, contracts 218, Events 774, test:accounts 16.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-19 21:50:02 +02:00
co-authored by Claude Opus 5.5
parent cc18b7b514
commit 70c471666b
20 changed files with 482 additions and 40 deletions
@@ -1,5 +1,6 @@
"use client";
import { KeyRound } from "lucide-react";
import React, { useState } from "react";
import { Button, Card, Field, Heading, Notice, Shell } from "@crosscode/ui";
import { useBranding } from "@/components/BrandingProvider";
@@ -13,7 +14,7 @@ export function Forgot({ uid }: { uid: string | null }) {
return (
<Shell branding={branding}>
<Card>
<Heading sub="We'll email you a link to choose a new one.">Forgot your password?</Heading>
<Heading icon={<KeyRound className="h-5 w-5" />} sub="We'll email you a link to choose a new one.">Forgot your password?</Heading>
{sent ? (
<Notice tone="success">If there&apos;s an account with that email address, a link is on its way. It works for an hour. You can close this page: the link brings you back.</Notice>
) : (
@@ -1,5 +1,6 @@
"use client";
import { KeyRound } from "lucide-react";
import React, { useState } from "react";
import { Button, Card, Field, Heading, Notice, Shell } from "@crosscode/ui";
import { useBranding } from "@/components/BrandingProvider";
@@ -12,7 +13,7 @@ export function Reset({ token }: { token: string | null }) {
return (
<Shell branding={branding}>
<Card>
<Heading sub="At least 8 characters.">Choose a new password</Heading>
<Heading icon={<KeyRound className="h-5 w-5" />} sub="At least 8 characters.">Choose a new password</Heading>
{error && <Notice tone="error">{error}</Notice>}
<form onSubmit={async (e) => {
e.preventDefault();
@@ -1,5 +1,6 @@
"use client";
import { LogOut } from "lucide-react";
import { Card, Heading, Shell } from "@crosscode/ui";
import { useBranding } from "@/components/BrandingProvider";
import { selfSignIn } from "@/lib/api";
@@ -9,7 +10,7 @@ export default function SignedOutPage() {
return (
<Shell branding={branding}>
<Card>
<Heading sub={`You've been signed out of all of ${branding.name}'s sites.`}>You&apos;re signed out</Heading>
<Heading icon={<LogOut className="h-5 w-5" />} sub={`You've been signed out of all of ${branding.name}'s sites.`}>You&apos;re signed out</Heading>
<a href={selfSignIn("/account")} className="text-brand underline">Sign in again</a>
</Card>
</Shell>
@@ -1,5 +1,6 @@
"use client";
import { AlertTriangle, FileText, KeyRound, LogIn, Mail, Megaphone, ShieldCheck, UserPlus } from "lucide-react";
import React, { useState } from "react";
import QRCode from "qrcode";
import { Button, Card, Checkbox, Field, Heading, Notice, Shell } from "@crosscode/ui";
@@ -88,7 +89,7 @@ export function SignIn({ uid }: { uid: string }) {
if (!state) {
return frame(error ? (
<>
<Heading>We couldn&apos;t continue</Heading>
<Heading icon={<AlertTriangle className="h-5 w-5" />}>We couldn&apos;t continue</Heading>
<Notice tone="error">{error.message}</Notice>
</>
) : <p className="text-gray-600">Loading…</p>);
@@ -121,7 +122,7 @@ function PasswordStep({ state, busy, err, onSubmit, onSignUp }: { state: State;
const branding = useBranding();
return (
<form onSubmit={(e) => { e.preventDefault(); const f = new FormData(e.currentTarget); onSubmit({ email: f.get("email"), password: f.get("password"), remember: f.get("remember") === "on" }); }}>
<Heading sub={`to continue to ${state.product}`}>Sign in to {branding.name}</Heading>
<Heading icon={<LogIn className="h-5 w-5" />} sub={`to continue to ${state.product}`}>Sign in to {branding.name}</Heading>
{err}
<Field label="Email address" name="email" type="email" autoComplete="username" required defaultValue={state.loginHint ?? ""} />
<Field label="Password" name="password" type="password" autoComplete="current-password" required />
@@ -144,7 +145,7 @@ function SignUpStep({ busy, err, fieldError, onSubmit, onBack }: { busy: boolean
const f = new FormData(e.currentTarget);
onSubmit({ name: f.get("name"), email: f.get("email"), phone: f.get("phone") || undefined, password: f.get("password"), acceptNotice: f.get("acceptNotice") === "on", newsEmail: f.get("newsEmail") === "on", newsWhatsApp: f.get("newsWhatsApp") === "on", remember: true });
}}>
<Heading sub={`One account for all of ${branding.name}'s sites and apps.`}>Create your account</Heading>
<Heading icon={<UserPlus className="h-5 w-5" />} sub={`One account for all of ${branding.name}'s sites and apps.`}>Create your account</Heading>
{err}
<Field label="Your name" name="name" autoComplete="name" required error={fieldError("name")} />
<Field label="Email address" name="email" type="email" autoComplete="email" required error={fieldError("email")} />
@@ -162,7 +163,7 @@ function SignUpStep({ busy, err, fieldError, onSubmit, onBack }: { busy: boolean
function CodeStep({ title, sub, busy, err, onSubmit, onResend }: { title: string; sub: React.ReactNode; busy: boolean; err: React.ReactNode; onSubmit: (code: string) => void; onResend?: () => void }) {
return (
<form onSubmit={(e) => { e.preventDefault(); onSubmit(String(new FormData(e.currentTarget).get("code") ?? "")); }}>
<Heading sub={sub}>{title}</Heading>
<Heading icon={<Mail className="h-5 w-5" />} sub={sub}>{title}</Heading>
{err}
<Field label="Code" name="code" inputMode="numeric" autoComplete="one-time-code" pattern="[0-9 ]{6,7}" required autoFocus />
<Button type="submit" busy={busy} className="w-full">Continue</Button>
@@ -212,7 +213,7 @@ function SetupStep({ uid, state, busy, err, setError, onConfirm }: { uid: string
};
return (
<>
<Heading sub={why}>Set up two-step sign-in</Heading>
<Heading icon={<ShieldCheck className="h-5 w-5" />} sub={why}>Set up two-step sign-in</Heading>
{err}
<div className="space-y-2">
{(state.methods ?? []).map((m) => (
@@ -243,7 +244,7 @@ function RecoveryCodes({ codes, onDone }: { codes: string[]; onDone: () => void
const text = codes.join("\n");
return (
<>
<Heading sub="If you lose your phone, one of these lets you sign in. Each works once. Keep them somewhere safe: we can't show them again.">Save your recovery codes</Heading>
<Heading icon={<KeyRound className="h-5 w-5" />} sub="If you lose your phone, one of these lets you sign in. Each works once. Keep them somewhere safe: we can't show them again.">Save your recovery codes</Heading>
<pre className="mb-4 rounded-lg bg-gray-50 p-4 text-center font-mono text-sm leading-7">{text}</pre>
<div className="mb-4 flex gap-2">
<Button type="button" variant="secondary" onClick={() => navigator.clipboard?.writeText(text)}>Copy</Button>
@@ -257,7 +258,7 @@ function RecoveryCodes({ codes, onDone }: { codes: string[]; onDone: () => void
function NoticeStep({ state, busy, err, onAccept }: { state: State; busy: boolean; err: React.ReactNode; onAccept: () => void }) {
return (
<>
<Heading sub={state.updated ? "Our privacy notice has changed. Please read it before you carry on." : "Please read our privacy notice before you carry on."}>{state.notice!.title}</Heading>
<Heading icon={<FileText className="h-5 w-5" />} sub={state.updated ? "Our privacy notice has changed. Please read it before you carry on." : "Please read our privacy notice before you carry on."}>{state.notice!.title}</Heading>
{err}
<div className="mb-4 max-h-80 overflow-y-auto whitespace-pre-line rounded-lg border bg-gray-50 p-4 text-sm text-gray-700">{state.notice!.body}</div>
<Button type="button" busy={busy} className="w-full" onClick={onAccept}>I&apos;ve read it</Button>
@@ -269,7 +270,7 @@ function NewsStep({ busy, err, onSubmit }: { busy: boolean; err: React.ReactNode
const branding = useBranding();
return (
<form onSubmit={(e) => { e.preventDefault(); const f = new FormData(e.currentTarget); onSubmit({ email: f.get("email") === "on", whatsapp: f.get("whatsapp") === "on" }); }}>
<Heading sub="You can change this at any time on your account page.">Would you like news from {branding.name}?</Heading>
<Heading icon={<Megaphone className="h-5 w-5" />} sub="You can change this at any time on your account page.">Would you like news from {branding.name}?</Heading>
{err}
<Checkbox name="email" label="Yes, by email" />
<Checkbox name="whatsapp" label="Yes, on WhatsApp" hint="If your mobile number is on your account." />