add more ux and ui patches with extra login helper
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
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}`;
|
||||
}
|
||||
Reference in New Issue
Block a user