import { Select } from "@cloudflare/kumo"; import { useLingui } from "@lingui/react/macro"; import { Gear, ShareNetwork, MagnifyingGlass, Shield, Globe, GlobeSimple, Key, Envelope, } from "@phosphor-icons/react"; import { useQuery } from "@tanstack/react-query"; import { Link } from "@tanstack/react-router"; import * as React from "react"; import { fetchManifest } from "../lib/api"; import { SUPPORTED_LOCALES } from "../locales/index.js"; import { useLocale } from "../locales/useLocale.js"; import { CaretNext } from "./ArrowIcons.js"; interface SettingsLinkProps { to: string; icon: React.ReactNode; title: string; description: string; } function SettingsLink({ to, icon, title, description }: SettingsLinkProps) { return (
{icon}
{title}
{description}
); } /** * Settings hub page — links to all settings sub-pages. */ export function Settings() { const { data: manifest } = useQuery({ queryKey: ["manifest"], queryFn: fetchManifest, }); const { t } = useLingui(); const { locale, setLocale } = useLocale(); const showSecuritySettings = manifest?.authMode === "passkey"; return (

{t`Settings`}

{/* Site settings */}
} title={t`General`} description={t`Site identity, logo, favicon, and reading preferences`} /> } title={t`Social Links`} description={t`Social media profile links`} /> } title={t`SEO`} description={t`Search engine optimization and verification`} />
{/* Security & access — only for passkey auth */} {showSecuritySettings && (
} title={t`Security`} description={t`Manage your passkeys and authentication`} /> } title={t`Self-Signup Domains`} description={t`Allow users from specific domains to sign up`} />
)} {/* Always visible for admins */}
} title={t`API Tokens`} description={t`Create personal access tokens for programmatic API access`} /> } title={t`Email`} description={t`View email provider status and send test emails`} />
{/* Language */} {SUPPORTED_LOCALES.length > 1 && (
{t`Language`}
{t`Choose your preferred admin language`}