fix: linting cleanup, TS errors, mobile cookie banner and hero max-width
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
|
||||
import { useState, useEffect, useMemo } from 'react';
|
||||
import Link from 'next/link';
|
||||
import Image from 'next/image';
|
||||
import { ArrowRight, ArrowLeft, Check, Thermometer, Home, Zap, ShoppingCart, Phone, RotateCcw } from 'lucide-react';
|
||||
|
||||
import { ArrowRight, ArrowLeft, Check, Home, Zap, ShoppingCart, Phone } from 'lucide-react';
|
||||
import { Product } from '@/content/products';
|
||||
import { companyDetails } from '@/content/company';
|
||||
import { ProductCard } from '@/components/shop/ProductCard';
|
||||
@@ -20,9 +20,10 @@ function useSessionState<T>(key: string, initialValue: T) {
|
||||
try {
|
||||
const item = window.sessionStorage.getItem(key);
|
||||
if (item) {
|
||||
setState(JSON.parse(item));
|
||||
const timer = setTimeout(() => setState(JSON.parse(item)), 0);
|
||||
return () => clearTimeout(timer);
|
||||
}
|
||||
} catch (error) {}
|
||||
} catch {}
|
||||
}, [key]);
|
||||
|
||||
const setValue = (value: T | ((val: T) => T)) => {
|
||||
@@ -32,7 +33,7 @@ function useSessionState<T>(key: string, initialValue: T) {
|
||||
if (typeof window !== 'undefined') {
|
||||
window.sessionStorage.setItem(key, JSON.stringify(valueToStore));
|
||||
}
|
||||
} catch (error) {}
|
||||
} catch {}
|
||||
};
|
||||
|
||||
return [state, setValue] as const;
|
||||
@@ -203,35 +204,6 @@ export function KalkulatorClient({ products }: Props) {
|
||||
return pages;
|
||||
};
|
||||
|
||||
const handleFinish = () => {
|
||||
setStep(4);
|
||||
setPage(1);
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
};
|
||||
|
||||
const handleReset = () => {
|
||||
setStep(0);
|
||||
setPage(1);
|
||||
Object.keys(window.sessionStorage).forEach(key => {
|
||||
if (key.startsWith('calc_')) window.sessionStorage.removeItem(key);
|
||||
});
|
||||
setDeviceType('klimatyzacja');
|
||||
setBuilding('apartment');
|
||||
setPomieszczenia([{ nazwa: 'Pokój 1', m2: 20 }]);
|
||||
setFloor('middle');
|
||||
setSun('south');
|
||||
setPipes('medium');
|
||||
setInstallMethod('korytko');
|
||||
setOutdoorUnitLocation('balcony');
|
||||
setHasSocket('yes');
|
||||
setBudget(8000);
|
||||
setPreferredBrand('');
|
||||
setEnergyClass('');
|
||||
setMaxNoise(null);
|
||||
setMaxNoiseOut(null);
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
};
|
||||
|
||||
const handleNext = () => {
|
||||
setStep(s => s + 1);
|
||||
setPage(1);
|
||||
@@ -621,7 +593,7 @@ export function KalkulatorClient({ products }: Props) {
|
||||
{ value: 'facade', label: 'Elewacja / balkon francuski', sub: 'Wymaga użycia podnośnika koszowego (ok. 600 zł/h) i pompki skroplin (+ ok. 400 zł)' },
|
||||
{ value: 'roof', label: 'Dach budynku', sub: 'Wymaga odpowiedniego stelaża lub konstrukcji dachowej' },
|
||||
].map(o => (
|
||||
<button key={o.value} onClick={() => setOutdoorUnitLocation(o.value as any)}
|
||||
<button key={o.value} onClick={() => setOutdoorUnitLocation(o.value as 'balcony' | 'facade' | 'roof')}
|
||||
className={`p-4 rounded-xl border-2 text-left transition-all ${outdoorUnitLocation === o.value ? 'border-accent bg-accent/5' : 'border-border hover:border-accent'}`}>
|
||||
<p className="text-sm font-bold text-primary">{o.label}</p>
|
||||
<p className="text-xs text-text-muted">{o.sub}</p>
|
||||
@@ -643,7 +615,7 @@ export function KalkulatorClient({ products }: Props) {
|
||||
{ value: 'no', label: 'Nie', sub: 'Instalator musi dociągnąć prąd z wewnątrz (+ ok. 200 zł)' },
|
||||
{ value: 'dont_know', label: 'Nie wiem / Do ustalenia', sub: 'Do ustalenia w trakcie wizji lokalnej' },
|
||||
].map(o => (
|
||||
<button key={o.value} onClick={() => setHasSocket(o.value as any)}
|
||||
<button key={o.value} onClick={() => setHasSocket(o.value as 'yes' | 'no' | 'dont_know')}
|
||||
className={`p-4 rounded-xl border-2 text-left transition-all ${hasSocket === o.value ? 'border-accent bg-accent/5' : 'border-border hover:border-accent'}`}>
|
||||
<p className="text-sm font-bold text-primary">{o.label}</p>
|
||||
<p className="text-xs text-text-muted">{o.sub}</p>
|
||||
|
||||
Reference in New Issue
Block a user