feat: implement buddies and tasting sessions features

This commit is contained in:
2025-12-18 10:56:41 +01:00
parent 314967b31b
commit d07af05b66
9 changed files with 771 additions and 14 deletions

View File

@@ -9,7 +9,14 @@ import StatusSwitcher from '@/components/StatusSwitcher';
import TastingList from '@/components/TastingList';
import DeleteBottleButton from '@/components/DeleteBottleButton';
export default async function BottlePage({ params }: { params: { id: string } }) {
export default async function BottlePage({
params,
searchParams
}: {
params: { id: string },
searchParams: { session_id?: string }
}) {
const sessionId = searchParams.session_id;
const supabase = createServerComponentClient({ cookies });
const { data: bottle } = await supabase
@@ -24,7 +31,15 @@ export default async function BottlePage({ params }: { params: { id: string } })
const { data: tastings } = await supabase
.from('tastings')
.select('*')
.select(`
*,
tasting_tags (
buddies (
id,
name
)
)
`)
.eq('bottle_id', params.id)
.order('created_at', { ascending: false });
@@ -127,9 +142,9 @@ export default async function BottlePage({ params }: { params: { id: string } })
{/* Form */}
<div className="lg:col-span-1 border border-zinc-200 dark:border-zinc-800 rounded-3xl p-6 bg-white dark:bg-zinc-900/50 md:sticky md:top-24">
<h3 className="text-lg font-bold mb-6 flex items-center gap-2 text-amber-600">
<Droplets size={20} /> Neu Verkosten
<Droplets size={20} /> {sessionId ? 'Session-Notiz' : 'Neu Verkosten'}
</h3>
<TastingNoteForm bottleId={bottle.id} />
<TastingNoteForm bottleId={bottle.id} sessionId={sessionId} />
</div>
{/* List */}