diff --git a/apps/website/src/@types/resources.d.ts b/apps/website/src/@types/resources.d.ts index 1e9f6d277..8693613a9 100644 --- a/apps/website/src/@types/resources.d.ts +++ b/apps/website/src/@types/resources.d.ts @@ -551,6 +551,7 @@ interface Resources { "userId": "Discord user ID", "amount": "Amount", "currency": "Currency", + "currencyDecimals": "Currency decimals", "date": "Date", "note": "Note", "anonymous": "Anonymous", @@ -572,7 +573,7 @@ interface Resources { }, "status": { "statusUnavailable": "Status unavailable", - "child": "Child {{index}}", + "child": "Child #{{index}}", "serverInformation": { "title": "Server information", "hostname": "Name", diff --git a/apps/website/src/app/admin/donations/Donation.tsx b/apps/website/src/app/admin/donations/Donation.tsx index b8e5057d8..a9f4f3082 100644 --- a/apps/website/src/app/admin/donations/Donation.tsx +++ b/apps/website/src/app/admin/donations/Donation.tsx @@ -1,6 +1,7 @@ import Link from "next/link"; import { useTranslation } from "react-i18next"; +import { CurrencyUtils } from "@mc/common/currencyUtils"; import { Card, CardContent, CardHeader } from "@mc/ui/card"; import type { RouterOutputs } from "~/trpc/react"; @@ -11,12 +12,10 @@ export function Donation( donation: RouterOutputs["donor"]["geAllDonations"][number], ) { const { i18n } = useTranslation(); - + const { amount, currency, currencyDecimals } = donation; const dateFormatter = Intl.DateTimeFormat(i18n.language, { dateStyle: "short", }); - const currencyFormatter = (currency: string) => - Intl.NumberFormat(i18n.language, { currency, style: "currency" }); return ( @@ -27,7 +26,12 @@ export function Donation(
{dateFormatter.format(donation.date)}
- {currencyFormatter(donation.currency).format(donation.amount)} + {CurrencyUtils.format( + i18n.language, + amount, + currency, + currencyDecimals, + )}
diff --git a/apps/website/src/app/admin/donations/DonationForm.tsx b/apps/website/src/app/admin/donations/DonationForm.tsx index 48b8e8485..523649441 100644 --- a/apps/website/src/app/admin/donations/DonationForm.tsx +++ b/apps/website/src/app/admin/donations/DonationForm.tsx @@ -59,9 +59,12 @@ export function DonationForm< min={0} required type="number" - value={value.amount} + value={Number(value.amount)} onChange={(e) => - onChange({ ...value, amount: e.target.valueAsNumber }) + onChange({ + ...value, + amount: BigInt(e.target.value.replaceAll(/[^0-9]+/g, "")), + }) } /> @@ -75,6 +78,22 @@ export function DonationForm< /> +
+ +