Initial frontend import

This commit is contained in:
TerryM
2026-05-16 00:18:22 +08:00
commit 9c54ffec76
99 changed files with 14992 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
/** Split display name into title + parenthetical subtitle (matches design cards). */
export function categoryCardLines(
name: string,
description?: string,
): { line1: string; line2?: string } {
const i = name.indexOf("");
if (i > 0 && name.includes("")) {
return { line1: name.slice(0, i).trim(), line2: name.slice(i).trim() };
}
const j = name.indexOf("(");
if (j > 0 && name.includes(")")) {
return { line1: name.slice(0, j).trim(), line2: name.slice(j).trim() };
}
if (description?.trim()) {
return { line1: name, line2: description.trim() };
}
return { line1: name };
}

7
src/utils/format.ts Normal file
View File

@@ -0,0 +1,7 @@
export function formatDateYmd(iso: string) {
const d = new Date(iso);
const y = d.getFullYear();
const m = String(d.getMonth() + 1).padStart(2, "0");
const day = String(d.getDate()).padStart(2, "0");
return `${y}-${m}-${day}`;
}