diff --git a/_locales/en/messages.json b/_locales/en/messages.json index c18c6c6238..fbaedc1eae 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -8958,6 +8958,10 @@ "messageformat": "Thank you for supporting Signal. Your contribution helps fuel the mission of protecting free expression and enabling secure global communication for millions around the world, through open source privacy technology. If you’re a resident of the United States, please retain this receipt for your tax records. Signal Technology Foundation is a tax-exempt nonprofit organization in the United States under section 501c3 of the Internal Revenue Code. Our Federal Tax ID is 82-4506840.", "description": "Footer text shown on donation receipts explaining tax deductibility and Signal's mission" }, + "icu:Donations__OfflineTooltip": { + "messageformat": "You are offline. Please connect to the internet to complete a donation.", + "description": "Tooltip for donation related buttons which are temporarily disabled due to the app being offline." + }, "icu:Donations__Toast__Canceled": { "messageformat": "Donation canceled", "description": "Toast shown when a donation was manually canceled by the user" diff --git a/stylesheets/components/PreferencesDonations.scss b/stylesheets/components/PreferencesDonations.scss index 65d4ba5c1f..b35afd1e6b 100644 --- a/stylesheets/components/PreferencesDonations.scss +++ b/stylesheets/components/PreferencesDonations.scss @@ -417,5 +417,6 @@ padding-block: 5px; padding-inline: 12px; font-weight: 400; + border: 0.5px solid variables.$color-black-alpha-16; border-radius: 6px; } diff --git a/ts/components/Preferences.stories.tsx b/ts/components/Preferences.stories.tsx index cf867683ac..5aa4c799cb 100644 --- a/ts/components/Preferences.stories.tsx +++ b/ts/components/Preferences.stories.tsx @@ -220,6 +220,7 @@ function renderDonationsPane(props: { clearWorkflow={action('clearWorkflow')} initialCurrency="usd" resumeWorkflow={action('resumeWorkflow')} + isOnline isStaging page={props.page} setPage={props.setPage} diff --git a/ts/components/PreferencesDonateFlow.tsx b/ts/components/PreferencesDonateFlow.tsx index ac8b234798..d4281d9639 100644 --- a/ts/components/PreferencesDonateFlow.tsx +++ b/ts/components/PreferencesDonateFlow.tsx @@ -61,6 +61,7 @@ import { } from './preferences/donations/DonateInputCardCvc'; import { I18n } from './I18n'; import { strictAssert } from '../util/assert'; +import { DonationsOfflineTooltip } from './conversation/DonationsOfflineTooltip'; import { DonateInputAmount } from './preferences/donations/DonateInputAmount'; const SUPPORT_URL = 'https://support.signal.org/hc/requests/new?desktop'; @@ -68,6 +69,7 @@ const SUPPORT_URL = 'https://support.signal.org/hc/requests/new?desktop'; export type PropsDataType = { i18n: LocalizerType; initialCurrency: string; + isOnline: boolean; donationAmountsConfig: OneTimeDonationHumanAmounts | undefined; lastError: DonationErrorType | undefined; validCurrencies: ReadonlyArray; @@ -92,6 +94,7 @@ export function PreferencesDonateFlow({ contentsRef, i18n, initialCurrency, + isOnline, donationAmountsConfig, lastError, validCurrencies, @@ -184,6 +187,7 @@ export function PreferencesDonateFlow({ i18n={i18n} initialAmount={amount} initialCurrency={currency} + isOnline={isOnline} donationAmountsConfig={donationAmountsConfig} validCurrencies={validCurrencies} onChangeCurrency={handleAmountPickerCurrencyChanged} @@ -206,6 +210,7 @@ export function PreferencesDonateFlow({ disabled={isCardFormDisabled} i18n={i18n} initialValues={cardFormValues} + isOnline={isOnline} onChange={handleCardFormChanged} onSubmit={handleSubmitDonation} showPrivacyModal={showPrivacyModal} @@ -252,6 +257,7 @@ type AmountPickerProps = { i18n: LocalizerType; initialAmount: HumanDonationAmount | undefined; initialCurrency: string | undefined; + isOnline: boolean; donationAmountsConfig: OneTimeDonationHumanAmounts | undefined; validCurrencies: ReadonlyArray; onChangeCurrency: (value: string) => void; @@ -263,6 +269,7 @@ function AmountPicker({ i18n, initialAmount, initialCurrency = 'usd', + isOnline, validCurrencies, onChangeCurrency, onSubmit, @@ -369,7 +376,7 @@ function AmountPicker({ }, []); const amount = parsedCustomAmount ?? presetAmount; - const isContinueEnabled = currency != null && amount != null; + const isContinueEnabled = isOnline && currency != null && amount != null; const handleContinueClicked = useCallback(() => { if (!isContinueEnabled) { @@ -388,6 +395,17 @@ function AmountPicker({ customInputClassName = 'DonationAmountPicker__CustomInput'; } + const continueButton = ( + + ); + return (