Refactor app by modularizing components and extracting utilities.
The changes split large features into smaller, reusable components like `AdminPanel`, `LoginPage`, `TopBar`, `PasswordModal`, and `ChipModal`. Utility functions such as `cycleTag` and `chipStorage` were extracted for better organization. This improves the code's readability, maintainability, and scalability.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
function chipStorageKey(gameId, entryId) {
|
||||
return `chip:${gameId}:${entryId}`;
|
||||
}
|
||||
|
||||
export function getChipLS(gameId, entryId) {
|
||||
try {
|
||||
return localStorage.getItem(chipStorageKey(gameId, entryId));
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export function setChipLS(gameId, entryId, chip) {
|
||||
try {
|
||||
localStorage.setItem(chipStorageKey(gameId, entryId), chip);
|
||||
} catch {}
|
||||
}
|
||||
|
||||
export function clearChipLS(gameId, entryId) {
|
||||
try {
|
||||
localStorage.removeItem(chipStorageKey(gameId, entryId));
|
||||
} catch {}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Backend erlaubt: null | "i" | "m" | "s"
|
||||
* Rotation:
|
||||
* null -> i -> m -> s (Popup) -> null
|
||||
*/
|
||||
export function cycleTag(tag) {
|
||||
if (!tag) return "i";
|
||||
if (tag === "i") return "m";
|
||||
if (tag === "m") return "s";
|
||||
return null;
|
||||
}
|
||||
Reference in New Issue
Block a user