mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-19 15:06:20 +00:00
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:
@@ -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);
|
||||
Reference in New Issue
Block a user