-
+
+ {i18n('icu:DonateFlow__make-a-one-time-donation')}
+
+
{presetAmountOptions.map(value => (
-
+
))}
-
-
-
setPresetAmount(undefined)}
placeholder="Enter Custom Amount"
value={customAmount}
/>
- {currency.toUpperCase()}
- {error &&
Error: {error}
}
-
+
+
+
+
+ );
+}
+
+type HelpFooterProps = {
+ i18n: LocalizerType;
+ showOneTimeOnlyNotice?: boolean;
+};
+
+function HelpFooter({
+ i18n,
+ showOneTimeOnlyNotice,
+}: HelpFooterProps): JSX.Element {
+ const contactSupportLink = (parts: Array
) => (
+
+ {parts}
+
+ );
+
+ return (
+
+ {showOneTimeOnlyNotice && (
+
+ {i18n('icu:DonateFlow__desktop-one-time-only-notice')}
+
+ )}
+
);
}
diff --git a/ts/components/PreferencesDonations.tsx b/ts/components/PreferencesDonations.tsx
index d52da8daf6..b489c0613f 100644
--- a/ts/components/PreferencesDonations.tsx
+++ b/ts/components/PreferencesDonations.tsx
@@ -8,7 +8,7 @@ import type { MutableRefObject, ReactNode } from 'react';
import { ListBox, ListBoxItem } from 'react-aria-components';
import { getDateTimeFormatter } from '../util/formatTimestamp';
-import type { LocalizerType } from '../types/Util';
+import type { LocalizerType, ThemeType } from '../types/Util';
import { PreferencesContent } from './Preferences';
import { SettingsPage } from '../types/Nav';
import { PreferencesDonateFlow } from './PreferencesDonateFlow';
@@ -18,8 +18,6 @@ import type {
OneTimeDonationHumanAmounts,
} from '../types/Donations';
import type { AvatarColorType } from '../types/Colors';
-import type { AvatarDataType } from '../types/Avatar';
-import { AvatarPreview } from './AvatarPreview';
import { Button, ButtonSize, ButtonVariant } from './Button';
import { Modal } from './Modal';
import { Spinner } from './Spinner';
@@ -32,6 +30,8 @@ import { openLinkInWebBrowser } from '../util/openLinkInWebBrowser';
import { DonationPrivacyInformationModal } from './DonationPrivacyInformationModal';
import type { SubmitDonationType } from '../state/ducks/donations';
import { getHumanDonationAmount } from '../util/currency';
+import { Avatar, AvatarSize } from './Avatar';
+import type { BadgeType } from '../badges/types';
const log = createLogger('PreferencesDonations');
@@ -44,13 +44,14 @@ export type PropsDataType = {
isStaging: boolean;
page: SettingsPage;
workflow: DonationWorkflow | undefined;
- userAvatarData: ReadonlyArray;
- color?: AvatarColorType;
- firstName?: string;
+ badge: BadgeType | undefined;
+ color: AvatarColorType | undefined;
+ firstName: string | undefined;
profileAvatarUrl?: string;
donationAmountsConfig: OneTimeDonationHumanAmounts | undefined;
validCurrencies: ReadonlyArray;
donationReceipts: ReadonlyArray;
+ theme: ThemeType;
saveAttachmentToDisk: (options: {
data: Uint8Array;
name: string;
@@ -76,8 +77,9 @@ type DonationPage =
| SettingsPage.DonationsDonateFlow
| SettingsPage.DonationsReceiptList;
-type PreferencesHomeProps = PropsType & {
+type PreferencesHomeProps = Omit & {
navigateToPage: (newPage: SettingsPage) => void;
+ renderDonationHero: () => JSX.Element;
};
function isDonationPage(page: SettingsPage): page is DonationPage {
@@ -88,20 +90,19 @@ function isDonationPage(page: SettingsPage): page is DonationPage {
);
}
-function DonationsHome({
- i18n,
- userAvatarData,
+type DonationHeroProps = Pick<
+ PropsDataType,
+ 'badge' | 'color' | 'firstName' | 'i18n' | 'profileAvatarUrl' | 'theme'
+>;
+
+function DonationHero({
+ badge,
color,
firstName,
+ i18n,
profileAvatarUrl,
- navigateToPage,
- setPage,
- isStaging,
- donationReceipts,
-}: PreferencesHomeProps): JSX.Element {
- const avatarData = userAvatarData[0];
- const avatarBuffer = avatarData?.buffer;
- const hasReceipts = donationReceipts.length > 0;
+ theme,
+}: DonationHeroProps): JSX.Element {
const [showPrivacyModal, setShowPrivacyModal] = useState(false);
const ReadMoreButtonWithModal = useCallback(
@@ -122,18 +123,25 @@ function DonationsHome({
);
return (
-
-
-
+ {showPrivacyModal && (
+ setShowPrivacyModal(false)}
+ />
+ )}
+
+
@@ -148,9 +156,26 @@ function DonationsHome({
id="icu:PreferencesDonations__description"
/>
+ >
+ );
+}
+
+function DonationsHome({
+ i18n,
+ renderDonationHero,
+ navigateToPage,
+ setPage,
+ isStaging,
+ donationReceipts,
+}: PreferencesHomeProps): JSX.Element {
+ const hasReceipts = donationReceipts.length > 0;
+
+ return (
+
+ {renderDonationHero()}
{isStaging && (