import { getCampaign } from "@/lib/patreon"; import { getGoals, IGoals } from '@/lib/pm' import Image from 'next/image'; import React from 'react'; import Link from 'next/link' export default async function FundingGoal(): Promise { const campaignData = await getCampaign(); const { pledgeSum, patronCount } = campaignData; const goals = await getGoals(pledgeSum); if (!goals || !goals?.featuredFunded?.amountCents || !goals?.featuredUnfunded?.amountCents || !goals?.featuredFunded?.amountCents || !goals?.featuredUnfunded?.completedPercentage || !goals?.featuredFunded?.completedPercentage ) return <> return ( <> {/*

pledgeSum:{JSON.stringify(pledgeSum, null, 2)}

patronCount:{JSON.stringify(patronCount, null, 2)}

featuredFunded:{JSON.stringify(goals.featuredFunded)}

featuredUnfunded:{JSON.stringify(goals.featuredUnfunded)}

*/} {/*
                
                    {JSON.stringify(goals, null, 2)}
                
            
*/}
Funding Goal
CJ_Clippy
{/* the most recently funded goal */}
{/* const { featuredFunded, featuredUnfunded } = goals; if (!featuredFunded?.amountCents || !featuredFunded?.completedPercentage) return <> if (!featuredUnfunded?.amountCents || !featuredUnfunded?.completedPercentage) return <> */}

${(goals.featuredFunded.amountCents * (goals.featuredFunded.completedPercentage * 0.01) / 100)} of {goals.featuredFunded.amountCents / 100} ({goals.featuredFunded.completedPercentage}%)

FUNDED

{goals.featuredFunded.description}

{/* the next unfunded goal */}

${(goals.featuredUnfunded.amountCents * (goals.featuredUnfunded.completedPercentage * 0.01) / 100) | 0} of ${goals.featuredUnfunded.amountCents / 100} ({goals.featuredUnfunded.completedPercentage}%)

{goals.featuredUnfunded.completedPercentage}%

{goals.featuredUnfunded.description}

Thank you, Patrons!

); };