Skip to content

Commit

Permalink
Merge branch 'main' into pranav/migrate-evidence-bank-page
Browse files Browse the repository at this point in the history
  • Loading branch information
mkue authored Nov 22, 2023
2 parents 4558589 + 99f90ee commit 8efaee3
Showing 1 changed file with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { TransparencyPageProps } from '@/app/[lang]/[region]/(website)/transparency/finances/[currency]/page';
import { firestoreAdmin } from '@/firebase-admin';
import { PaymentStatsCalculator } from '@socialincome/shared/src/utils/stats/PaymentStatsCalculator';
import { BaseContainer, Card, Typography } from '@socialincome/ui';

export default async function Page({ params }: TransparencyPageProps) {
const paymentCalculator = await PaymentStatsCalculator.build(firestoreAdmin, 'CHF');
const paymentStats = paymentCalculator.allStats();

return (
<BaseContainer className="flex flex-col space-y-2 py-8">
<Typography size="xl" weight="bold">
Total payments amount: {paymentStats.totalPaymentsAmount.toFixed(2)}
</Typography>
<Typography size="xl" weight="bold">
Total payments count: {paymentStats.totalPaymentsCount}
</Typography>
<Typography size="xl" weight="bold">
Payments by month
</Typography>
<div className="mt-4 grid grid-cols-3 gap-4">
{paymentStats.totalPaymentsByMonth.map((monthlyStat, index) => (
<Card key={index} className="p-4">
<Typography size="lg" weight="semibold">
{monthlyStat.month}
</Typography>
<Typography>SLE: {monthlyStat.amountSLE}</Typography>
<Typography>CHF: {Number(monthlyStat.amount).toFixed(2)}</Typography>
<Typography>
Exchange Rate: {(Number(monthlyStat.amount) / Number(monthlyStat.amountSLE)).toFixed(6)}
</Typography>
<Typography>Number of recipients: {monthlyStat.recipientsCount}</Typography>
</Card>
))}
</div>
</BaseContainer>
);
}

0 comments on commit 8efaee3

Please sign in to comment.