'use client'; import React, { useState } from 'react'; import { Sparkles, GlassWater, Dices, X } from 'lucide-react'; import { useI18n } from '@/i18n/I18nContext'; import Link from 'next/link'; interface Bottle { id: string; name: string; distillery?: string; status: 'sealed' | 'open' | 'sampled' | 'empty'; } interface DramOfTheDayProps { bottles: Bottle[]; } export default function DramOfTheDay({ bottles }: DramOfTheDayProps) { const { t } = useI18n(); const [suggestion, setSuggestion] = useState(null); const [isRolling, setIsRolling] = useState(false); const suggestDram = () => { setIsRolling(true); const openBottles = bottles.filter(b => b.status === 'open' || b.status === 'sampled'); if (openBottles.length === 0) { alert(t('home.dramOfDay.noOpenBottles')); setIsRolling(false); return; } // Simulate a "roll" for 800ms setTimeout(() => { const randomBottle = openBottles[Math.floor(Math.random() * openBottles.length)]; setSuggestion(randomBottle); setIsRolling(false); }, 800); }; return (
{suggestion && (

{t('home.dramOfDay.title')}

{suggestion.name}

{suggestion.distillery && (

{suggestion.distillery}

)}
setSuggestion(null)} className="block w-full py-4 bg-orange-600 text-white rounded-2xl font-bold uppercase tracking-widest text-xs hover:bg-orange-700 transition-all shadow-xl shadow-orange-950/20" > {t('home.dramOfDay.viewBottle')}
)}
); }