From e3af71c5848ddde6ab6bf1b2c9084d7092035dd5 Mon Sep 17 00:00:00 2001 From: robin Date: Thu, 18 Dec 2025 12:08:24 +0100 Subject: [PATCH] feat: complete bottle-to-session integration flow --- src/app/bottles/[id]/page.tsx | 16 ++++++++++++++-- src/components/BottleGrid.tsx | 23 +++++++++++++++++++---- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/app/bottles/[id]/page.tsx b/src/app/bottles/[id]/page.tsx index 0ac0770..235c94e 100644 --- a/src/app/bottles/[id]/page.tsx +++ b/src/app/bottles/[id]/page.tsx @@ -2,7 +2,7 @@ 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 { 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'; @@ -48,13 +48,25 @@ export default async function BottlePage({
{/* Back Button */} Zurück zur Sammlung + {sessionId && ( +
+
+ +
+
+

Session Aktiv!

+

Jede Tasting Note, die du jetzt speicherst, wird automatisch deiner Session zugeordnet. 🥃

+
+
+ )} + {/* Hero Section */}
diff --git a/src/components/BottleGrid.tsx b/src/components/BottleGrid.tsx index e313572..41f9272 100644 --- a/src/components/BottleGrid.tsx +++ b/src/components/BottleGrid.tsx @@ -2,8 +2,9 @@ import React, { useState, useMemo } from 'react'; import Link from 'next/link'; -import { Search, Filter, X, Calendar, Clock, Package, Lock, Unlock, Ghost, FlaskConical, AlertCircle, Trash2, AlertTriangle } from 'lucide-react'; +import { Search, Filter, X, Calendar, Clock, Package, Lock, Unlock, Ghost, FlaskConical, AlertCircle, Trash2, AlertTriangle, PlusCircle } from 'lucide-react'; import { getStorageUrl } from '@/lib/supabase'; +import { useSearchParams } from 'next/navigation'; interface Bottle { id: string; @@ -22,9 +23,10 @@ interface Bottle { interface BottleCardProps { bottle: Bottle; + sessionId?: string | null; } -function BottleCard({ bottle }: BottleCardProps) { +function BottleCard({ bottle, sessionId }: BottleCardProps) { const statusConfig = { open: { icon: Unlock, color: 'bg-amber-500/80 border-amber-400/50', label: 'Offen' }, sampled: { icon: FlaskConical, color: 'bg-purple-500/80 border-purple-400/50', label: 'Sample' }, @@ -36,7 +38,10 @@ function BottleCard({ bottle }: BottleCardProps) { const statusStyle = statusConfig[bottle.status as keyof typeof statusConfig] || statusConfig.sealed; return ( - +
+ {sessionId && ( +
+ + ZU SESSION HINZUFÜGEN +
+ )} + {bottle.last_tasted && (
@@ -101,6 +113,9 @@ interface BottleGridProps { } export default function BottleGrid({ bottles }: BottleGridProps) { + const searchParams = useSearchParams(); + const sessionId = searchParams.get('session_id'); + const [searchQuery, setSearchQuery] = useState(''); const [selectedCategory, setSelectedCategory] = useState(null); const [selectedDistillery, setSelectedDistillery] = useState(null); @@ -269,7 +284,7 @@ export default function BottleGrid({ bottles }: BottleGridProps) { {filteredBottles.length > 0 ? (
{filteredBottles.map((bottle) => ( - + ))}
) : (