import Image from "next/image"; import CountChart from "./CountChart"; import { getSupabaseClient } from "@/lib/supabase"; const CountChartContainer = async () => { const supabase = await getSupabaseClient(); const { count: boysCount } = await supabase .from("Student") .select("*", { count: "exact", head: true }) .eq("sex", "MALE"); const { count: girlsCount } = await supabase .from("Student") .select("*", { count: "exact", head: true }) .eq("sex", "FEMALE"); const boys = boysCount || 0; const girls = girlsCount || 0; return (
{/* TITLE */}

Students

{/* CHART */} {/* BOTTOM */}

{boys}

Boys ({Math.round((boys / (boys + girls)) * 100)}%)

{girls}

Girls ({Math.round((girls / (boys + girls)) * 100)}%)

); }; export default CountChartContainer;