'use client'; import type {Machine} from '@/types/domain'; import type {MouseEvent} from 'react'; import {useRef} from 'react'; import {Button, message} from 'antd'; import {ShoppingCartOutlined, EyeOutlined} from '@ant-design/icons'; import {useAppDispatch} from '@/store/hooks'; import {addToCart} from '@/store/cartSlice'; import {useLanguage} from '@/app/context/LanguageContext'; import FloatingItems from './FloatingItems'; import {floatingSnacks} from '@/data/content'; export default function VendingCard({machine, onQuickView}: {machine: Machine; onQuickView?: (machine: Machine) => void}) { const dispatch = useAppDispatch(); const {t, dir} = useLanguage(); const stageRef = useRef(null); const lensRef = useRef(null); const revealRef = useRef(null); const handleMouseMove = (e: MouseEvent) => { const stage = stageRef.current; if (!stage) return; const rect = stage.getBoundingClientRect(); const x = e.clientX - rect.left; const y = e.clientY - rect.top; if (lensRef.current) { lensRef.current.style.transform = `translate(${x}px, ${y}px) translate(-50%, -50%)`; } if (revealRef.current) { revealRef.current.style.clipPath = `circle(95px at ${x}px ${y}px)`; } }; const handleMouseLeave = () => { if (revealRef.current) revealRef.current.style.clipPath = 'circle(0px at 50% 50%)'; }; const handleAddToCart = () => { dispatch( addToCart({ id: machine.id, name: machine.name, priceNumeric: machine.priceNumeric, priceLabel: machine.priceLabel, image: machine.image, }) ); message.success(t.cart.addToast(machine.name)); }; return (
{machine.name} {`${machine.name}
{t.machineActions.hoverHint}
{machine.shortLabel}

{machine.name}

{t.machineActions.gifAlt(machine.name)}

{machine.description}

    {machine.highlights.map((h) => (
  • {h}
  • ))}

{machine.priceLabel}

{/* */}
); }