Initial commit

This commit is contained in:
admin
2026-05-26 22:46:00 +02:00
commit 7e2c2ff89c
256 changed files with 51523 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
import { BRAND } from "./brand";
export type SortKey = "newest" | "oldest" | "az" | "za" | "code-az" | "code-za";
export const SORT_OPTIONS: ReadonlyArray<{ value: SortKey; label: string }> = [
{ value: "newest", label: "Newest First" },
{ value: "oldest", label: "Oldest First" },
{ value: "az", label: "Title A → Z" },
{ value: "za", label: "Title Z → A" },
{ value: "code-az", label: "Code A → Z" },
{ value: "code-za", label: "Code Z → A" },
];
export const DEFAULT_SORT: SortKey = "newest";
export const SORT_COOKIE = `${BRAND.storagePrefix}-default-sort`;
const VALID = new Set<SortKey>(["newest", "oldest", "az", "za", "code-az", "code-za"]);
export function isValidSort(v: string | undefined | null): v is SortKey {
return !!v && VALID.has(v as SortKey);
}
export function labelFor(sort: SortKey): string {
return SORT_OPTIONS.find((o) => o.value === sort)?.label ?? sort;
}