"use client";
import React from 'react';
import Image from 'next/image';
import Link from 'next/link';
import { useCartStore } from '@/lib/cart-store';
import { formatCurrency } from '@/lib/utils';
import { Minus, Plus, Trash2, Wrench } from 'lucide-react';
export function CartItems() {
const { items, removeItem, updateQuantity, toggleInstall } = useCartStore();
if (items.length === 0) {
return (
Twój koszyk jest pusty
Nie dodałeś jeszcze żadnych produktów do koszyka.
Przejdź do sklepu
);
}
return (
{items.map((item) => {
const itemPrice = item.withInstall ? item.priceWithInstall : item.price;
const totalGross = itemPrice * item.quantity;
return (
{/* Usuń pozycję */}
{/* Obraz */}
{/* Treść */}
{item.brand}
{item.name}
{/* Wariant mocowy */}
{(item.label || item.power) && (
Wariant: {item.label || `${item.power} kW`}
)}
{/* Opcja Montażu i Cena jednostkowa */}
{/* Ilość i Cena */}
{item.quantity}
{formatCurrency(totalGross)}
);
})}
);
}