move tabs into own pages
tinyedge/deploy Deployed by TinyEdge

This commit is contained in:
2026-08-07 15:49:43 +02:00
parent cbe1b42f6e
commit 99a9f908f1
13 changed files with 321 additions and 325 deletions
+8
View File
@@ -0,0 +1,8 @@
export function useConfirm() {
function confirm(message: string) {
if (!import.meta.client) return false;
return window.confirm(message);
}
return { confirm };
}
+5 -12
View File
@@ -1,21 +1,14 @@
import { readIdentity, writeIdentity } from '../utils/identity';
export function useIdentity() {
const name = useState<string | null>('identity-name', () => null);
const loaded = useState('identity-loaded', () => false);
if (import.meta.client && !loaded.value) {
const identity = readIdentity(window.localStorage);
name.value = identity?.name ?? null;
loaded.value = true;
}
const name = useCookie<string | null>('stb-identity-name', {
default: () => null,
maxAge: 60 * 60 * 24 * 365,
sameSite: 'lax',
});
function setName(newName: string) {
const trimmed = newName.trim();
if (!trimmed) return;
name.value = trimmed;
if (import.meta.client)
writeIdentity(window.localStorage, { name: trimmed });
}
return { name, setName };