import { createServerComponentClient } from '@supabase/auth-helpers-nextjs'; import { cookies } from 'next/headers'; import { notFound } from 'next/navigation'; import Link from 'next/link'; import { ChevronLeft, Calendar, Award, Droplets, MapPin, Tag, ExternalLink, Package } from 'lucide-react'; import TastingNoteForm from '@/components/TastingNoteForm'; import StatusSwitcher from '@/components/StatusSwitcher'; export default async function BottlePage({ params }: { params: { id: string } }) { const supabase = createServerComponentClient({ cookies }); const { data: bottle } = await supabase .from('bottles') .select('*') .eq('id', params.id) .single(); if (!bottle) { notFound(); } const { data: tastings } = await supabase .from('tastings') .select('*') .eq('bottle_id', params.id) .order('created_at', { ascending: false }); return (
{/* Back Button */} Zurück zur Sammlung {/* Hero Section */}
{bottle.name}

{bottle.name}

{bottle.distillery}

{bottle.whiskybase_id && ( )}
Kategorie
{bottle.category || '-'}
Alkoholgehalt
{bottle.abv}% Vol.
Alter
{bottle.age ? `${bottle.age} Jahre` : '-'}
Zuletzt verkostet
{tastings && tastings.length > 0 ? new Date(tastings[0].created_at).toLocaleDateString('de-DE') : 'Noch nie'}

{/* Tasting Notes Section */}

Tasting Notes

Hier findest du deine bisherigen Eindrücke.

{/* Form */}

Neu Verkosten

{/* List */}
{!tastings || tastings.length === 0 ? (

Noch keine Tasting Notes vorhanden. Zeit für ein Glas? 🥃

) : ( tastings.map((note) => (
{note.rating}/100
{note.is_sample ? 'Sample' : 'Bottle'}
{new Date(note.created_at).toLocaleTimeString('de-DE', { hour: '2-digit', minute: '2-digit' })}
{new Date(note.created_at).toLocaleDateString('de-DE')}
{note.nose_notes && (
Nose

"{note.nose_notes}"

)} {note.palate_notes && (
Palate

"{note.palate_notes}"

)} {note.finish_notes && (
Finish

"{note.finish_notes}"

)}
)) )}
); }