Files
CatoandClaude e3dcbda881 feat(helpers): a directory of helpers, lawyers checked and still pseudonymous (#25)
- Helpers list themselves (AI service, legal assistant, licensed lawyer) under
  a name or pseudonym; the same account keeps matters of its own. Directory
  search and filters through searchkit and listkit, with the typo suite.
- A lawyer's admission is submitted privately (evidence sealed per
  credential), checked by a staff reviewer, and published as an SD-JWT signed
  with Ed25519: the place in clear, the legal name only as a salted digest.
  Key at /.well-known/jwks.json; anyone can check at /verify. A lawyer is
  listed only where verified.
- An owner asks a helper about a matter, with or without their personal
  details; the request is previewed exactly as it will be read. Accepted, the
  helper becomes a participant; anonymisation is applied in the store, so no
  route can forget it. A lawyer hands over the checked name with proof.
  Ending it removes access in the same transaction.
- Reviewers are staff/admin accounts, granted by the Grant role workflow.
- Who may do what is lib/professions.ts, the one domain file, so Diplodoctor
  reuses the engine by changing it.
- Fixes: the account menu label template; one site URL instead of three, with
  a dev-only origin so local sign-in works.


Claude-Session: https://claude.ai/code/session_018Lem7GyhyyjKhmwjG8G7Ud

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-21 05:48:41 +02:00

75 lines
2.3 KiB
TypeScript

"use client";
import { AccountMenu } from "@bitbaum/accountkit";
import { useTranslations } from "next-intl";
import { Link } from "@/i18n/navigation";
import { ROUTES } from "@/lib/routes";
/**
* The fleet's one account menu (@bitbaum/accountkit), with Causius's places.
* Sign-in is a link to OrangeCat's one screen; sign-out a server action passed
* in, so this file holds no auth logic of its own.
*/
export function AccountControl({
user,
signInHref,
signOutAction,
fleet,
}: {
user: { name?: string | null; image?: string | null } | null;
/** /<locale>/sign-in?from=… — a plain link, see lib/auth/entry.ts. */
signInHref: string;
signOutAction: () => Promise<void>;
/** The other fleet products this one account opens, from the fleet map. */
fleet: { slug: string; name: string; url: string }[];
}) {
const t = useTranslations("Account");
if (!user) {
return (
<a href={signInHref} className="btn-secondary">
{t("signIn")}
</a>
);
}
return (
<AccountMenu
user={{ name: user.name ?? undefined, image: user.image ?? undefined }}
groups={[
{
id: "places",
items: [
{ id: "matters", label: t("matters"), href: ROUTES.matters },
{ id: "account", label: t("account"), href: ROUTES.account },
{ id: "settings", label: t("settings"), href: ROUTES.settings },
],
},
// The same account opens the rest of the fleet; say so where the
// person looks for their account.
...(fleet.length
? [{ id: "fleet", items: fleet.map((p) => ({ id: p.slug, label: t("openIn", { name: p.name }), href: p.url })) }]
: []),
]}
onSignOut={() => signOutAction()}
renderLink={({ href, children, ...rest }) =>
href.startsWith("https://") ? (
<a href={href} {...rest}>
{children}
</a>
) : (
<Link href={href} {...rest}>
{children}
</Link>
)
}
labels={{
// A template: the menu fills {name} itself, so it is passed unformatted.
trigger: t.raw("trigger") as string,
menu: t("menu"),
signOut: t("signOut"),
signingOut: t("signingOut"),
signOutFailed: t("signOutFailed"),
}}
/>
);
}