import { useState, useEffect } from 'react'; import { getConfig, updateConfig, ApiError } from '../../../lib/api'; import { notify } from '../../../lib/confirm'; import type { SiteConfig, ContactLink } from '../../../lib/types'; const CONTACT_KINDS: { value: string; label: string; placeholder: string }[] = [ { value: 'email', label: 'Email', placeholder: 'you@example.com' }, { value: 'mastodon', label: 'Mastodon', placeholder: 'https://mastodon.social/@you' }, { value: 'bluesky', label: 'Bluesky', placeholder: 'https://bsky.app/profile/you.bsky.social' }, { value: 'github', label: 'GitHub', placeholder: 'https://github.com/you' }, { value: 'instagram', label: 'Instagram', placeholder: 'https://instagram.com/you' }, { value: 'url', label: 'Other link', placeholder: 'https://…' }, ]; export default function Settings() { const [config, setConfig] = useState>({}); useEffect(() => { getConfig() .then(setConfig) .catch(() => showAlert('Failed to load settings from server.', 'error')); }, []); function showAlert(msg: string, type: 'success' | 'error') { notify(msg, type); } function update(key: K, value: SiteConfig[K]) { setConfig(prev => ({ ...prev, [key]: value })); } const contactLinks: ContactLink[] = config.contact_links ?? []; function updateContactLink(index: number, patch: Partial) { const next = contactLinks.map((row, i) => (i === index ? { ...row, ...patch } : row)); update('contact_links', next); } function addContactLink() { update('contact_links', [...contactLinks, { kind: 'email', label: 'Email', value: '' }]); } function removeContactLink(index: number) { update('contact_links', contactLinks.filter((_, i) => i !== index)); } function moveContactLink(index: number, dir: -1 | 1) { const target = index + dir; if (target < 0 || target >= contactLinks.length) return; const next = [...contactLinks]; [next[index], next[target]] = [next[target], next[index]]; update('contact_links', next); } async function handleSubmit(e: React.SyntheticEvent) { e.preventDefault(); try { await updateConfig(config); showAlert('Settings saved. Refresh to see changes.', 'success'); } catch (e) { showAlert(e instanceof ApiError ? `Error: ${e.message}` : 'Failed to save settings.', 'error'); } } return (

Identity

update('title', v)} /> update('subtitle', v)} /> update('welcome_title', v)} /> update('welcome_subtitle', v)} />
update('favicon', v)} hint="Icon shown in browser tabs." />

Appearance

Salon trio tuned for the gallery aesthetic. Breakcore swaps that for early-2000s web rot — hot magenta on CRT violet, acid green, scanline noise. Cybersigil is the moody cut — near-black ground, ice-cyan barbed sigil linework, bruised-magenta on contact, lingering chromatic glitch.