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, PlusCircle } from 'lucide-react'; import { getStorageUrl } from '@/lib/supabase'; import TastingNoteForm from '@/components/TastingNoteForm'; import StatusSwitcher from '@/components/StatusSwitcher'; import TastingList from '@/components/TastingList'; import DeleteBottleButton from '@/components/DeleteBottleButton'; import EditBottleForm from '@/components/EditBottleForm'; import { validateSession } from '@/services/validate-session'; export default async function BottlePage({ params, searchParams }: { params: { id: string }, searchParams: { session_id?: string } }) { let sessionId = searchParams.session_id; // Validate Session Age (12 hour limit) if (sessionId) { const isValid = await validateSession(sessionId); if (!isValid) { sessionId = undefined; } } 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(` *, tasting_sessions ( id, name ), tasting_tags ( buddies ( id, name ) ) `) .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 */}

Dram bewerten

{/* List */}
); }