import Link from 'next/link'; import { notFound } from 'next/navigation'; import { ArrowLeft, Users, Server, Package } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Badge } from '@/components/ui/badge'; import { getCustomerById } from '@/lib/actions/customers'; import { listReleases } from '@/lib/actions/releases'; import { getCustomerSteps } from '@/lib/actions/customer-steps'; interface CustomerDetailPageProps { params: Promise<{ id: string; }>; } export default async function CustomerDetailPage({ params }: CustomerDetailPageProps) { const { id } = await params; const customer = await getCustomerById(parseInt(id)); if (!customer) { notFound(); } const releases = await listReleases(); // Get steps for each active release const releasesWithSteps = await Promise.all( releases .filter(r => r.status === 'active') .map(async (release) => { const steps = await getCustomerSteps(release.id, customer.id); const done = steps.filter(s => s.status === 'done').length; const total = steps.length; return { ...release, steps, progress: total > 0 ? Math.round((done / total) * 100) : 0, done, total, }; }) ); return (
{customer.namespace}
{customer.cluster?.name}
{customer.description}
{customer.createdAt ? new Date(customer.createdAt).toLocaleString() : 'N/A'}
No active releases.
) : ({release.done} / {release.total} steps completed