import SinglePage from "@/components/SinglePage";
import { getAwards, getClients, getExhibitions, getProjects } from "@/lib/data";

export const dynamic = "force-dynamic";

export default async function Page() {
  let projects: Awaited<ReturnType<typeof getProjects>> = [];
  let awards: Awaited<ReturnType<typeof getAwards>> = [];
  let exhibitions: Awaited<ReturnType<typeof getExhibitions>> = [];
  let clients: Awaited<ReturnType<typeof getClients>> = [];

  try {
    [projects, awards, exhibitions, clients] = await Promise.all([
      getProjects(),
      getAwards(),
      getExhibitions(),
      getClients(),
    ]);
  } catch {
    // The database is unavailable – render with empty collections rather than a 500.
  }

  return (
    <SinglePage
      projects={projects}
      awards={awards}
      exhibitions={exhibitions}
      clients={clients}
    />
  );
}
