Files
myeasycms-v2/apps/web/app/[locale]/club/[slug]/page.tsx
Zaid Marzguioui ebd0fd4638
Some checks failed
Workflow / ʦ TypeScript (push) Failing after 6m26s
Workflow / ⚫️ Test (push) Has been skipped
feat: complete CMS v2 with Docker, Fischerei, Meetings, Verband modules + UX audit fixes
Major changes:
- Docker Compose: full Supabase stack (11 services) equivalent to supabase CLI
- Fischerei module: 16 DB tables, waters/species/stocking/catch books/competitions
- Sitzungsprotokolle module: meeting protocols, agenda items, task tracking
- Verbandsverwaltung module: federation management, member clubs, contacts, fees
- Per-account module activation via Modules page toggle
- Site Builder: live CMS data in Puck blocks (courses, events, membership registration)
- Public registration APIs: course signup, event registration, membership application
- Document generation: PDF member cards, Excel reports, HTML labels
- Landing page: real Com.BISS content (no filler text)
- UX audit fixes: AccountNotFound component, shared status badges, confirm dialog,
  pagination, duplicate heading removal, emoji→badge replacement, a11y fixes
- QA: healthcheck fix, API auth fix, enum mismatch fix, password required attribute
2026-03-31 16:35:46 +02:00

49 lines
2.1 KiB
TypeScript

import { createClient } from '@supabase/supabase-js';
import { notFound } from 'next/navigation';
import { SiteRenderer } from '@kit/site-builder/components';
import type { SiteData } from '@kit/site-builder/context';
interface Props { params: Promise<{ slug: string }> }
export default async function ClubHomePage({ params }: Props) {
const { slug } = await params;
const supabase = createClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_PUBLIC_KEY!,
);
const { data: account } = await supabase.from('accounts').select('id, name').eq('slug', slug).single();
if (!account) notFound();
const { data: settings } = await supabase.from('site_settings').select('*').eq('account_id', account.id).eq('is_public', true).maybeSingle();
if (!settings) notFound();
const { data: page } = await supabase.from('site_pages').select('*')
.eq('account_id', account.id).eq('is_homepage', true).eq('is_published', true).maybeSingle();
if (!page) notFound();
// Pre-fetch CMS data for Puck components
const [eventsRes, coursesRes, postsRes] = await Promise.all([
supabase.from('events').select('id, name, event_date, event_time, location, fee, status')
.eq('account_id', account.id).order('event_date', { ascending: true }).limit(20),
supabase.from('courses').select('id, name, start_date, end_date, fee, capacity, status')
.eq('account_id', account.id).order('start_date', { ascending: true }).limit(20),
supabase.from('cms_posts').select('id, title, excerpt, cover_image, published_at, slug')
.eq('account_id', account.id).eq('status', 'published').order('published_at', { ascending: false }).limit(20),
]);
const siteData: SiteData = {
accountId: account.id,
events: eventsRes.data ?? [],
courses: (coursesRes.data ?? []).map(c => ({ ...c, enrolled_count: 0 })),
posts: postsRes.data ?? [],
};
return (
<div style={{ '--primary': settings.primary_color, '--secondary': settings.secondary_color, fontFamily: settings.font_family } as React.CSSProperties}>
<SiteRenderer data={(page.puck_data ?? {}) as Record<string, unknown>} siteData={siteData} />
</div>
);
}