diff --git a/shared/locales/de/website-selection.json b/shared/locales/de/website-selection.json index dd90b9e5f..e9476f635 100644 --- a/shared/locales/de/website-selection.json +++ b/shared/locales/de/website-selection.json @@ -42,7 +42,6 @@ "text": "die die Unterstützung am meisten benötigen.”" } ], - "amount": "USD 300,000+", "amount-context": "Spenden erhalten ↗", "scope": "Mehr ", "continue-1": "Auswahlverfahren" diff --git a/shared/locales/en/website-selection.json b/shared/locales/en/website-selection.json index eb9194885..a2e0a7b7b 100644 --- a/shared/locales/en/website-selection.json +++ b/shared/locales/en/website-selection.json @@ -39,7 +39,6 @@ "text": "who need Social Income the most." } ], - "amount": "USD 300,000+", "amount-context": "raised to date ↗", "scope": "visit our ", "continue-1": "Selection Process" diff --git a/shared/locales/fr/website-selection.json b/shared/locales/fr/website-selection.json index cbef6c272..645d90e51 100644 --- a/shared/locales/fr/website-selection.json +++ b/shared/locales/fr/website-selection.json @@ -39,7 +39,6 @@ "text": "sur les personnes qui ont le plus besoin de Social Income." } ], - "amount": "USD 300,000+", "amount-context": "reçus à ce jour ↗", "scope": "Plus de ", "continue-1": "Processus de sélection" diff --git a/shared/locales/it/website-selection.json b/shared/locales/it/website-selection.json index 4e1b65509..af75cd5da 100644 --- a/shared/locales/it/website-selection.json +++ b/shared/locales/it/website-selection.json @@ -39,7 +39,6 @@ "text": "che hanno più bisogno di Social Income." } ], - "amount": "USD 300,000+", "amount-context": "raccolti fino a oggi ↗", "scope": "Più ", "continue-1": "Processo di selezione" diff --git a/website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/(assets)/globe.svg b/website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(assets)/globe.svg similarity index 100% rename from website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/(assets)/globe.svg rename to website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(assets)/globe.svg diff --git a/website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/(assets)/transparency.svg b/website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(assets)/transparency.svg similarity index 100% rename from website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/(assets)/transparency.svg rename to website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(assets)/transparency.svg diff --git a/website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/(components)/draw-card.tsx b/website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(components)/draw-card.tsx similarity index 95% rename from website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/(components)/draw-card.tsx rename to website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(components)/draw-card.tsx index b3427ec85..57a04db55 100644 --- a/website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/(components)/draw-card.tsx +++ b/website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(components)/draw-card.tsx @@ -1,10 +1,10 @@ 'use client'; -import { CompletedDraw } from '@/app/[lang]/[region]/(website)/transparency/recipient-selection/(sections)/state'; import { WebsiteLanguage } from '@/i18n'; import { Card, Collapsible, CollapsibleContent, CollapsibleTrigger, Typography } from '@socialincome/ui'; import { DateTime } from 'luxon'; import Link from 'next/link'; +import { CompletedDraw } from '../(sections)/state'; type DrawCardProps = { lang: WebsiteLanguage; diff --git a/website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/(components)/scroll-to-chevron.tsx b/website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(components)/scroll-to-chevron.tsx similarity index 100% rename from website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/(components)/scroll-to-chevron.tsx rename to website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(components)/scroll-to-chevron.tsx diff --git a/website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/(sections)/faq.tsx b/website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(sections)/faq.tsx similarity index 100% rename from website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/(sections)/faq.tsx rename to website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(sections)/faq.tsx diff --git a/website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/(sections)/hero-section.tsx b/website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(sections)/hero-section.tsx similarity index 94% rename from website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/(sections)/hero-section.tsx rename to website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(sections)/hero-section.tsx index 49c4ffc67..73a901ab2 100644 --- a/website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/(sections)/hero-section.tsx +++ b/website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(sections)/hero-section.tsx @@ -1,10 +1,10 @@ import { DefaultParams } from '@/app/[lang]/[region]'; -import ScrollToChevron from '@/app/[lang]/[region]/(website)/transparency/recipient-selection/(components)/scroll-to-chevron'; import { Translator } from '@socialincome/shared/src/utils/i18n'; import { Typography } from '@socialincome/ui'; import { FontColor } from '@socialincome/ui/src/interfaces/color'; import Image from 'next/image'; import globeRotating from '../(assets)/globe.svg'; +import ScrollToChevron from '../(components)/scroll-to-chevron'; export async function HeroSection({ lang }: DefaultParams) { const translator = await Translator.getInstance({ diff --git a/website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/(sections)/past-rounds.tsx b/website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(sections)/past-rounds.tsx similarity index 89% rename from website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/(sections)/past-rounds.tsx rename to website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(sections)/past-rounds.tsx index a29f3b42d..12009a52b 100644 --- a/website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/(sections)/past-rounds.tsx +++ b/website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(sections)/past-rounds.tsx @@ -1,9 +1,9 @@ import { DefaultParams } from '@/app/[lang]/[region]'; -import { DrawCard } from '@/app/[lang]/[region]/(website)/transparency/recipient-selection/(components)/draw-card'; -import { loadPastDraws } from '@/app/[lang]/[region]/(website)/transparency/recipient-selection/(sections)/state'; import { Translator } from '@socialincome/shared/src/utils/i18n'; import { BaseContainer, Typography } from '@socialincome/ui'; import { FontColor } from '@socialincome/ui/src/interfaces/color'; +import { DrawCard } from '../(components)/draw-card'; +import { loadPastDraws } from './state'; export const revalidate = 3600 * 24; // update once a day diff --git a/website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/(sections)/resources.tsx b/website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(sections)/resources.tsx similarity index 67% rename from website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/(sections)/resources.tsx rename to website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(sections)/resources.tsx index af9d027e5..e9ca92028 100644 --- a/website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/(sections)/resources.tsx +++ b/website/src/app/[lang]/[region]/(website)/transparency/recipient-selection/[currency]/(sections)/resources.tsx @@ -1,17 +1,32 @@ import { DefaultParams } from '@/app/[lang]/[region]'; -import ScrollToChevron from '@/app/[lang]/[region]/(website)/transparency/recipient-selection/(components)/scroll-to-chevron'; +import { firestoreAdmin } from '@/firebase-admin'; +import { WebsiteCurrency } from '@/i18n'; import { Translator } from '@socialincome/shared/src/utils/i18n'; +import { ContributionStatsCalculator } from '@socialincome/shared/src/utils/stats/ContributionStatsCalculator'; import { Button, Typography } from '@socialincome/ui'; import { FontColor } from '@socialincome/ui/src/interfaces/color'; import Image from 'next/image'; import transparency from '../(assets)/transparency.svg'; +import ScrollToChevron from '../(components)/scroll-to-chevron'; -export async function Resources({ lang }: DefaultParams) { +type ResourcePageProps = { + currency: string; +} & DefaultParams; + +const roundAmount = (amount: number) => (amount ? Math.round(amount / 10) * 10 : 0); + +export async function Resources({ lang, currency }: ResourcePageProps) { const translator = await Translator.getInstance({ language: lang, namespaces: ['website-selection'], }); + const contributionCalculator = await ContributionStatsCalculator.build( + firestoreAdmin, + currency.toUpperCase() as WebsiteCurrency, + ); + const totalContributionsAmount = contributionCalculator.totalContributionsAmount(); + return (