import { Button } from "@/components/ui/button" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { ArrowLeft, Users, Lock, Globe } from "lucide-react" import Link from "next/link" import { notFound } from "next/navigation" import { getApiUrl } from "@/lib/api-config" import { GroupFeed } from "@/components/groups/group-feed" import { JoinGroupButton } from "@/components/groups/join-group-button" async function getGroup(id: string) { try { const res = await fetch(`${getApiUrl()}/groups/${id}`, { cache: 'no-store' }) if (!res.ok) return null return res.json() } catch (e) { return null } } async function getGroupPosts(id: string) { try { const res = await fetch(`${getApiUrl()}/groups/${id}/posts`, { cache: 'no-store' }) if (!res.ok) return [] return res.json() } catch (e) { return [] } } export default async function GroupDetailPage({ params }: { params: Promise<{ id: string }> }) { const { id } = await params const group = await getGroup(id) const posts = await getGroupPosts(id) if (!group) { notFound() } return (

{group.name} {group.privacy === 'private' ? : }

{group.description}

About
{group.member_count || 0} members
Created {new Date(group.created_at).toLocaleDateString()}
) }