'use client'; import React from 'react'; import { Filament } from '@/src/types/filament'; interface FilamentRowProps { filament: Filament; } export function FilamentRow({ filament }: FilamentRowProps) { const hasRefill = filament.refill > 0; const hasSpool = filament.spulna > 0; // Parse prices from the cena field (format: "3499" or "3499/3999") let refillPrice = 3499; let spoolPrice = 3999; if (filament.cena) { const prices = filament.cena.split('/'); if (prices.length === 1) { refillPrice = parseInt(prices[0]) || 3499; spoolPrice = parseInt(prices[0]) || 3999; } else if (prices.length === 2) { refillPrice = parseInt(prices[0]) || 3499; spoolPrice = parseInt(prices[1]) || 3999; } } const saleActive = filament.sale_active && filament.sale_percentage; const saleRefillPrice = saleActive ? Math.round(refillPrice * (1 - filament.sale_percentage! / 100)) : refillPrice; const saleSpoolPrice = saleActive ? Math.round(spoolPrice * (1 - filament.sale_percentage! / 100)) : spoolPrice; return (