export type Shortcut = { famSlug: string; famName: string; userName: string; // '' for parents (no handle in URL) }; const KEY = 'fam_shortcut'; export function recordShortcut(entry: Shortcut) { if (typeof localStorage === 'undefined') return; localStorage.setItem(KEY, JSON.stringify(entry)); } export function readShortcut(): Shortcut | null { if (typeof localStorage === 'undefined') return null; try { const raw = localStorage.getItem(KEY); return raw ? (JSON.parse(raw) as Shortcut) : null; } catch { return null; } } export function shortcutTarget(s: Shortcut): string { return s.userName ? `/${s.famSlug}/${s.userName}` : `/${s.famSlug}`; }