feat: filtr jednostek multisplit, ostatnio oglądane, sklep pompy ciepła, czyszczenie komentarzy, checkbox zgody
- Filtr 'Ilość jednostek wewn.' w sklepie (1–9 jednostek, checkboxy, liczniki) - Komponent RecentlyViewedProducts + Zustand store (recently-viewed-store.ts) - Pompy ciepła dodane do sklepu i nawigacji (Header + MobileMenu) - Logotypy marek zaktualizowane (Daikin, Panasonic + odświeżone istniejące) - Checkbox zgody RODO w /zamowienie powiększony (w-5 h-5) - Usunięcie ~65 zbędnych komentarzy WHAT z 12 plików (build: 0 errors) - Plik analyze_products.ts (pomocniczy skrypt diagnostyczny)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { create } from 'zustand';
|
||||
import { persist } from 'zustand/middleware';
|
||||
import { Product } from '@/content/products';
|
||||
|
||||
interface RecentlyViewedState {
|
||||
items: Product[];
|
||||
addItem: (item: Product) => void;
|
||||
clear: () => void;
|
||||
}
|
||||
|
||||
export const useRecentlyViewedStore = create<RecentlyViewedState>()(
|
||||
persist(
|
||||
(set) => ({
|
||||
items: [],
|
||||
|
||||
addItem: (newItem) => {
|
||||
set((state) => {
|
||||
// Usuń, jeśli już jest na liście (aby przenieść na początek)
|
||||
const filtered = state.items.filter((i) => i.slug !== newItem.slug);
|
||||
// Dodaj na początek, zachowaj tylko ostatnie 4
|
||||
return { items: [newItem, ...filtered].slice(0, 4) };
|
||||
});
|
||||
},
|
||||
|
||||
clear: () => set({ items: [] }),
|
||||
}),
|
||||
{ name: 'thermcool-recently-viewed' }
|
||||
)
|
||||
);
|
||||
Reference in New Issue
Block a user