feat: recent lists
Docker Build / build (push) Has been cancelled
TS Lint / ESLint (push) Has been cancelled
TS Lint / Oxlint (push) Has been cancelled
TS Lint / TypeScript (push) Has been cancelled

This commit is contained in:
2026-07-15 16:34:37 +02:00
parent 5e60b5ad20
commit ea9a50a2f7
9 changed files with 85 additions and 31 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
import { getCookie, setCookie } from "./cookies";
import { getCookie, setCookie } from "@/lib/cookies";
export function getLang() {
const params = new URLSearchParams(document.location.search);
+20
View File
@@ -0,0 +1,20 @@
import { getCookie, setCookie } from "@/lib/cookies";
const COOKIE_NAME = "recent-lists";
const MAX_RECENT_LISTS = 32;
export function getRecentLists(): string[] {
const rawData = getCookie(COOKIE_NAME, "");
if (!rawData) {
return [];
}
return rawData.split(",");
}
export function saveRecentList(list: string): void {
const recentLists = [list]
.concat(getRecentLists())
.filter((v, i, a) => a.indexOf(v) === i)
.slice(0, MAX_RECENT_LISTS);
setCookie(COOKIE_NAME, recentLists.join(","));
}