'use client'; import React from 'react'; import Link from 'next/link'; import { ChevronLeft, Calendar, Award, Droplets, MapPin, Tag, ExternalLink, Package, Info, Loader2, WifiOff } from 'lucide-react'; import { getStorageUrl } from '@/lib/supabase'; import TastingNoteForm from '@/components/TastingNoteForm'; import TastingList from '@/components/TastingList'; import DeleteBottleButton from '@/components/DeleteBottleButton'; import EditBottleForm from '@/components/EditBottleForm'; import { useBottleData } from '@/hooks/useBottleData'; import { useI18n } from '@/i18n/I18nContext'; interface BottleDetailsProps { bottleId: string; sessionId?: string; userId?: string; } export default function BottleDetails({ bottleId, sessionId, userId }: BottleDetailsProps) { const { t } = useI18n(); const { bottle, tastings, loading, error, isOffline } = useBottleData(bottleId); if (loading) { return (

{t('common.loading')}

); } if (!bottle && !loading) { return (

Flasche nicht verfügbar

Inhalte konnten nicht geladen werden. Bitte stelle eine Internetverbindung her, um diese Flasche zum ersten Mal zu laden.

Zurück zum Vault
); } if (!bottle) return null; // Should not happen due to check above return (
{/* Back Button */} Zurück zur Sammlung {isOffline && (

Offline-Modus: Daten aus dem Cache

)} {/* Hero Section */}
{bottle.name}

{bottle.name}

{bottle.distillery}

{bottle.whiskybase_id && ( )}
Kategorie
{bottle.category || '-'}
Alkoholgehalt
{bottle.abv}% Vol.
Alter
{bottle.age ? `${bottle.age} J.` : '-'}
{bottle.distilled_at && (
Destilliert
{bottle.distilled_at}
)} {bottle.bottled_at && (
Abgefüllt
{bottle.bottled_at}
)} {bottle.batch_info && (
Batch / Code
{bottle.batch_info}
)}
Letzter Dram
{tastings && tastings.length > 0 ? new Date(tastings[0].created_at).toLocaleDateString('de-DE') : 'Noch nie'}
{isOffline ? (
Bearbeiten & Löschen nur online möglich
) : ( <> )}

{/* Tasting Notes Section */}

Tasting Notes

Hier findest du deine bisherigen Eindrücke.

{/* Form */}

Dram bewerten

{/* List */}
); }