/** * GeneralSection — user preferences (default surface) */ const { html } = window; const { useState, useEffect, useCallback } = hooks; export function GeneralSection() { const [surfaces, setSurfaces] = useState([]); const [defaultSurface, setDefaultSurface] = useState(''); const [saving, setSaving] = useState(false); useEffect(() => { (async () => { try { const [s, surfList] = await Promise.all([ sw.api.profile.settings(), sw.api.get('/api/v1/surfaces').catch(() => []), ]); const sObj = s || {}; setDefaultSurface(sObj.default_surface || ''); setSurfaces((surfList || []).filter(s => s.route?.startsWith('/s/'))); } catch (e) { console.warn('[settings/general] Load failed:', e.message); } })(); }, []); const save = useCallback(async () => { setSaving(true); try { await sw.api.profile.updateSettings({ default_surface: defaultSurface, }); sw.emit('toast', { message: 'Settings saved', variant: 'success' }); } catch (e) { sw.emit('toast', { message: e.message, variant: 'error' }); } finally { setSaving(false); } }, [defaultSurface]); return html`

Default Surface

Override the global default set by your administrator. If your chosen surface is uninstalled, the global default is used.
`; }