signal-desktop/ts/state/smart/PreferencesDonations.tsx

47 lines
1.3 KiB
TypeScript
Raw Normal View History

2025-06-14 03:38:09 +10:00
// Copyright 2025 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import React, { memo } from 'react';
import { useSelector } from 'react-redux';
import type { MutableRefObject } from 'react';
import { getIntl } from '../selectors/user';
import { PreferencesDonations } from '../../components/PreferencesDonations';
import type { Page } from '../../components/Preferences';
import { useDonationsActions } from '../ducks/donations';
import type { StateType } from '../reducer';
import { isStagingServer } from '../../util/isStagingServer';
2025-06-14 03:38:09 +10:00
export const SmartPreferencesDonations = memo(
function SmartPreferencesDonations({
contentsRef,
page,
setPage,
}: {
2025-06-14 03:38:09 +10:00
contentsRef: MutableRefObject<HTMLDivElement | null>;
page: Page;
setPage: (page: Page) => void;
2025-06-14 03:38:09 +10:00
}) {
const isStaging = isStagingServer();
2025-06-14 03:38:09 +10:00
const i18n = useSelector(getIntl);
const workflow = useSelector(
(state: StateType) => state.donations.currentWorkflow
);
const { clearWorkflow, submitDonation } = useDonationsActions();
2025-06-14 03:38:09 +10:00
return (
<PreferencesDonations
contentsRef={contentsRef}
i18n={i18n}
isStaging={isStaging}
page={page}
workflow={workflow}
clearWorkflow={clearWorkflow}
submitDonation={submitDonation}
setPage={setPage}
/>
);
2025-06-14 03:38:09 +10:00
}
);