import { prisma } from "@/lib/prisma"; import Link from "next/link"; import { appTitle } from "@/lib/public-env"; export const metadata = { title: `Dollars raised — ${appTitle()}`, description: "Live totals from confirmed Stripe donations in this deployment.", }; export default async function RaisedPage() { const [agg, donorRows] = await Promise.all([ prisma.donation.aggregate({ _sum: { amountUsdCents: true }, _count: true, }), prisma.donation.groupBy({ by: ["userId"], _count: true, }), ]); const raisedUsd = (agg._sum.amountUsdCents ?? 0) / 100; const donationCount = agg._count; const uniqueDonors = donorRows.length; const goalUsd = parseFloat(process.env.PUBLIC_CAMPAIGN_GOAL_USD ?? "250000"); const pct = goalUsd > 0 ? Math.min(100, Math.round((raisedUsd / goalUsd) * 100)) : 0; const formatted = new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(raisedUsd); return (

Transparency

Total dollars raised

Sum of successful donations processed through Stripe for this app ({appTitle()}). Updates as webhooks confirm payments.

Confirmed via Stripe

{formatted}

{donationCount} donation{donationCount === 1 ? "" : "s"} {uniqueDonors} supporter{uniqueDonors === 1 ? "" : "s"}

$0 Goal {new Intl.NumberFormat("en-US", { style: "currency", currency: "USD", maximumFractionDigits: 0 }).format(goalUsd)}{" "} (PUBLIC_CAMPAIGN_GOAL_USD)

{pct}% of demo goal

Note

This total reflects Donation rows created by the Stripe webhook only—only processed charges count. Configure committee reporting separately for compliance.

Donate Back home
); }