refactor: relocate constants in screen stores

This commit is contained in:
2026-01-31 00:52:56 +01:00
parent 742e6363a4
commit 630b399088
13 changed files with 74 additions and 90 deletions

View File

@@ -1,5 +1,14 @@
import gsap from "gsap";
export const ACHIEVEMENTS_LINE_HEIGHT = 14;
export const ACHIEVEMENTS_HEADER_Y = 20;
export const ACHIEVEMENTS_LIST_START_Y = ACHIEVEMENTS_HEADER_Y + 55;
export const ACHIEVEMENTS_BOTTOM_START_Y = 10;
export const ACHIEVEMENTS_TOP_SCREEN_COUNT = Math.floor(
(LOGICAL_HEIGHT - ACHIEVEMENTS_LIST_START_Y) / ACHIEVEMENTS_LINE_HEIGHT,
);
export const ACHIEVEMENTS_X = 55;
export const useAchievementsScreen = defineStore("achievementsScreen", {
state: () => ({
fadeToBlack: {

View File

@@ -1,6 +1,21 @@
import { z } from "zod/mini";
import type * as THREE from "three";
export const LOGICAL_WIDTH = 256;
export const LOGICAL_HEIGHT = 192;
export const SCREEN_SCALE = 2;
export const SCREEN_WIDTH = LOGICAL_WIDTH * SCREEN_SCALE;
export const SCREEN_HEIGHT = LOGICAL_HEIGHT * SCREEN_SCALE;
export const APP_COLORS = [
["#61829a", "#ba4900", "#fb0018", "#fb8afb"],
["#fb9200", "#f3e300", "#aafb00", "#00fb00"],
["#00a238", "#49db8a", "#30baf3", "#0059f3"],
["#000092", "#8a00d3", "#d300eb", "#fb0092"],
];
const STORAGE_ID = "app_settings";
const settingsSchema = z.object({

View File

@@ -1,25 +1,32 @@
export type SettingsButton =
| "options"
| "optionsLanguage"
| "options2048"
| "optionsStartUp"
| "clock"
| "clockAchievements"
| "clockTime"
| "clockDate"
| "user"
| "userBirthday"
| "userUserName"
| "userSnake"
| "userColor"
| "touchScreen";
export const SETTINGS_MENUS = [
"options",
"clock",
"user",
"touchScreen",
] as const;
export const SETTINGS_SUB_MENUS = [
"optionsLanguage",
"options2048",
"optionsStartUp",
"clockAchievements",
"clockTime",
"clockDate",
"userBirthday",
"userUserName",
"userSnake",
"userColor",
] as const;
export type SettingsMenu = (typeof SETTINGS_MENUS)[number];
export type SettingsSubMenu = (typeof SETTINGS_SUB_MENUS)[number];
export const useSettingsStore = defineStore("settings", {
state: () => ({
currentMenu: null as SettingsMenu | null,
currentSubMenu: null as SettingsSubMenu | null,
menuExpanded: false,
selectedButton: "options" as SettingsButton,
selectedButton: "options" as SettingsMenu | SettingsSubMenu,
}),
actions: {