changes
This commit is contained in:
@@ -125,6 +125,26 @@ export function KalkulatorClient({ products }: Props) {
|
|||||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getShopUrl = () => {
|
||||||
|
const params = new URLSearchParams();
|
||||||
|
if (category) params.set('category', category);
|
||||||
|
if (preferredBrand) params.set('brand', preferredBrand);
|
||||||
|
|
||||||
|
const avgInstallCost = (installCost.min + installCost.max) / 2;
|
||||||
|
const deviceBudget = Math.max(0, budget - avgInstallCost);
|
||||||
|
if (deviceBudget > 0) params.set('priceMax', Math.round(deviceBudget).toString());
|
||||||
|
|
||||||
|
if (category === 'scienne') {
|
||||||
|
if (requiredPowerRounded <= 2.5) params.set('room', 'Do 25 m²');
|
||||||
|
else if (requiredPowerRounded <= 3.5) params.set('room', '25-35 m²');
|
||||||
|
else if (requiredPowerRounded <= 5.0) params.set('room', '35-50 m²');
|
||||||
|
else params.set('room', 'Powyżej 50 m²');
|
||||||
|
} else if (category === 'multisplit') {
|
||||||
|
params.set('units', rooms.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return `/sklep?${params.toString()}`;
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="bg-slate-50 min-h-screen py-12">
|
<main className="bg-slate-50 min-h-screen py-12">
|
||||||
@@ -599,7 +619,7 @@ export function KalkulatorClient({ products }: Props) {
|
|||||||
Dalej <ArrowRight className="size-4" />
|
Dalej <ArrowRight className="size-4" />
|
||||||
</button>
|
</button>
|
||||||
) : (
|
) : (
|
||||||
<Link href="/sklep" className="flex items-center gap-2 px-6 py-2.5 bg-accent text-white rounded-xl text-sm font-bold hover:bg-accent/90 transition-colors">
|
<Link href={getShopUrl()} className="flex items-center gap-2 px-6 py-2.5 bg-accent text-white rounded-xl text-sm font-bold hover:bg-accent/90 transition-colors">
|
||||||
|
|
||||||
Przejdź do sklepu <ArrowRight className="size-4" />
|
Przejdź do sklepu <ArrowRight className="size-4" />
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ export function Footer() {
|
|||||||
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 flex flex-col sm:flex-row justify-between items-center gap-4">
|
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 flex flex-col sm:flex-row justify-between items-center gap-4">
|
||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-2">
|
||||||
<p className="text-xs text-slate-400 text-center sm:text-left">
|
<p className="text-xs text-slate-400 text-center sm:text-left">
|
||||||
© {currentYear} {companyDetails.name}. Wszelkie prawa zastrzeżone. Projekt strony i wdrożenie ThermCool.
|
© {currentYear} {companyDetails.name}. Wszelkie prawa zastrzeżone. Projekt strony i wdrożenie Powered by NetScale.
|
||||||
</p>
|
</p>
|
||||||
<CookieSettingsTrigger />
|
<CookieSettingsTrigger />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -80,6 +80,9 @@ export function ProductsGrid({ products, brands }: ProductsGridProps) {
|
|||||||
const urlSearch = searchParams.get('search') || '';
|
const urlSearch = searchParams.get('search') || '';
|
||||||
const urlBrand = searchParams.get('brand') || '';
|
const urlBrand = searchParams.get('brand') || '';
|
||||||
const urlCategory = searchParams.get('category') || 'all';
|
const urlCategory = searchParams.get('category') || 'all';
|
||||||
|
const urlPriceMax = searchParams.get('priceMax') || '';
|
||||||
|
const urlRoom = searchParams.get('room') || '';
|
||||||
|
const urlUnits = searchParams.get('units') || '';
|
||||||
|
|
||||||
const [category, setCategory] = useState<'all' | 'scienne' | 'multisplit' | 'podlogowe' | 'jednostka-scienna'>(
|
const [category, setCategory] = useState<'all' | 'scienne' | 'multisplit' | 'podlogowe' | 'jednostka-scienna'>(
|
||||||
urlCategory as 'all' | 'scienne' | 'multisplit' | 'podlogowe' | 'jednostka-scienna'
|
urlCategory as 'all' | 'scienne' | 'multisplit' | 'podlogowe' | 'jednostka-scienna'
|
||||||
@@ -87,10 +90,10 @@ export function ProductsGrid({ products, brands }: ProductsGridProps) {
|
|||||||
const [selectedBrands, setSelectedBrands] = useState<string[]>(urlBrand ? [urlBrand] : []);
|
const [selectedBrands, setSelectedBrands] = useState<string[]>(urlBrand ? [urlBrand] : []);
|
||||||
const [searchQuery, setSearchQuery] = useState(urlSearch);
|
const [searchQuery, setSearchQuery] = useState(urlSearch);
|
||||||
const [priceMin, setPriceMin] = useState('');
|
const [priceMin, setPriceMin] = useState('');
|
||||||
const [priceMax, setPriceMax] = useState('');
|
const [priceMax, setPriceMax] = useState(urlPriceMax);
|
||||||
const [selectedRooms, setSelectedRooms] = useState<string[]>([]);
|
const [selectedRooms, setSelectedRooms] = useState<string[]>(urlRoom ? [urlRoom] : []);
|
||||||
const [selectedColors, setSelectedColors] = useState<string[]>([]);
|
const [selectedColors, setSelectedColors] = useState<string[]>([]);
|
||||||
const [selectedUnitCounts, setSelectedUnitCounts] = useState<number[]>([]);
|
const [selectedUnitCounts, setSelectedUnitCounts] = useState<number[]>(urlUnits ? [parseInt(urlUnits)] : []);
|
||||||
|
|
||||||
const [page, setPage] = useState(1);
|
const [page, setPage] = useState(1);
|
||||||
const [mobileSidebarOpen, setMobileSidebarOpen] = useState(false);
|
const [mobileSidebarOpen, setMobileSidebarOpen] = useState(false);
|
||||||
@@ -104,10 +107,13 @@ export function ProductsGrid({ products, brands }: ProductsGridProps) {
|
|||||||
} else {
|
} else {
|
||||||
setCategory('all');
|
setCategory('all');
|
||||||
}
|
}
|
||||||
|
setPriceMax(urlPriceMax);
|
||||||
|
setSelectedRooms(urlRoom ? [urlRoom] : []);
|
||||||
|
setSelectedUnitCounts(urlUnits ? [parseInt(urlUnits)] : []);
|
||||||
setPage(1);
|
setPage(1);
|
||||||
}, 0);
|
}, 0);
|
||||||
return () => clearTimeout(timer);
|
return () => clearTimeout(timer);
|
||||||
}, [urlSearch, urlBrand, urlCategory]);
|
}, [urlSearch, urlBrand, urlCategory, urlPriceMax, urlRoom, urlUnits]);
|
||||||
|
|
||||||
const toggleBrand = (b: string) => {
|
const toggleBrand = (b: string) => {
|
||||||
setSelectedBrands(prev => prev.includes(b) ? prev.filter(x => x !== b) : [...prev, b]);
|
setSelectedBrands(prev => prev.includes(b) ? prev.filter(x => x !== b) : [...prev, b]);
|
||||||
|
|||||||
+8
-8
@@ -1,15 +1,15 @@
|
|||||||
export const companyDetails = {
|
export const companyDetails = {
|
||||||
name: "ThermCool",
|
name: "Klimat-24",
|
||||||
legalName: "OLEH VAINAHII OVAK",
|
legalName: "OLEH VAINAHII OVAK",
|
||||||
shortName: "ThermCool",
|
shortName: "Klimat-24",
|
||||||
nip: "8952262125",
|
nip: "8982288023",
|
||||||
regon: "526442541",
|
regon: "526442541",
|
||||||
phone: "+48 730 994 376",
|
phone: "+48 699 587 035",
|
||||||
phoneRaw: "+48730994376",
|
phoneRaw: "+48699587035",
|
||||||
email: "biuro@thermcool.pl",
|
email: "biuro@klimat-24.pl",
|
||||||
address: {
|
address: {
|
||||||
street: "ul. Litewska 16 lok. 10",
|
street: "ul. Joachima Lelewela 15 lok. 6",
|
||||||
zipCode: "51-354",
|
zipCode: "53-505",
|
||||||
city: "Wrocław",
|
city: "Wrocław",
|
||||||
region: "Dolny Śląsk",
|
region: "Dolny Śląsk",
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user