+ {hasReceipts ? (
+ <>
+
+
+ {i18n('icu:PreferencesDonations--receiptList__info')}
+
+
+
+ {Object.entries(receiptsByYear).map(([year, receipts]) => (
+
+
+ {year}
+
+
+ {receipts.map(receipt => (
+ {
+ setSelectedReceipt(receipt);
+ setShowReceiptModal(true);
+ }}
+ >
+
+
+
+ {dateFormatter.format(new Date(receipt.timestamp))}
+
+
+ {i18n('icu:DonationReceipt__type-value--one-time')}
+
+
+
+ {getCurrencyFormatter(receipt.currencyType).format(
+ receipt.paymentAmount / 100
+ )}
+
+
+ ))}
+
+
+ ))}
+ >
+ ) : (
+
+
+ {i18n('icu:PreferencesDonations--receiptList__empty-title')}
+
+
+ {i18n('icu:PreferencesDonations--receiptList__info')}
+
+
+ )}
+
+ {showReceiptModal && selectedReceipt && (
+
setShowReceiptModal(false)}
+ modalFooter={
+
+ }
+ >
+
+
+
+ {getCurrencyFormatter(selectedReceipt.currencyType).format(
+ selectedReceipt.paymentAmount / 100
+ )}
+
+
+
+
+
+ {i18n('icu:PreferencesDonations__ReceiptModal--type-label')}
+
+
+ {i18n('icu:DonationReceipt__type-value--one-time')}
+
+
+
+
+ {i18n(
+ 'icu:PreferencesDonations__ReceiptModal--date-paid-label'
+ )}
+
+
+ {dateFormatter.format(new Date(selectedReceipt.timestamp))}
+
+
+
+
+
+ )}
+
+ );
+}
+
export function PreferencesDonations({
contentsRef,
i18n,
@@ -43,38 +406,119 @@ export function PreferencesDonations({
clearWorkflow,
setPage,
submitDonation,
-}: PropsType): JSX.Element {
+ userAvatarData,
+ color,
+ firstName,
+ profileAvatarUrl,
+ donationReceipts,
+ saveAttachmentToDisk,
+ generateDonationReceiptBlob,
+ showToast,
+}: PropsType): JSX.Element | null {
+ const PAGE_CONFIG = useMemo<
+ Record