feat(catalog): toggle stile catalogo classico/moderno

Aggiunge un checkbox nelle impostazioni utente per scegliere lo stile del
catalogo (classico vs moderno) + flag globale catalog.classic.style in
ui-config.json come default per tutti. Override per-utente in localStorage.
This commit is contained in:
medievalshell
2026-05-29 23:36:06 +02:00
parent 643e558aa8
commit dc0a8f965e
6 changed files with 28 additions and 4 deletions
+1
View File
@@ -1,4 +1,5 @@
export * from './useCatalog';
export * from './useCatalogClassicStyle';
export * from './useCatalogFavorites';
export * from './useCatalogPlaceMultipleItems';
export * from './useCatalogSkipPurchaseConfirmation';
@@ -0,0 +1,14 @@
import { useBetween } from 'use-between';
import { GetConfigurationValue, LocalStorageKeys } from '../../api';
import { useLocalStorage } from '../useLocalStorage';
// Per-user toggle for the catalog visual style.
// - true => classic (old) catalog look
// - false => modern (rebuilt) catalog look
// The default for users who never touched the toggle comes from the global
// `catalog.classic.style` flag in ui-config.json, so an admin can flip the
// default for everyone (true = classic for all, false = modern for all)
// while still letting each user override it from the settings panel.
const useCatalogClassicStyleState = () => useLocalStorage<boolean>(LocalStorageKeys.CATALOG_CLASSIC_STYLE, GetConfigurationValue<boolean>('catalog.classic.style', false));
export const useCatalogClassicStyle = () => useBetween(useCatalogClassicStyleState);