2025-07-15 07:31:17 +10:00
|
|
|
// Copyright 2025 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2025-07-22 10:12:01 -05:00
|
|
|
import React, { useEffect } from 'react';
|
2025-07-15 07:31:17 +10:00
|
|
|
|
|
|
|
import type { LocalizerType } from '../types/Util';
|
|
|
|
import { Modal } from './Modal';
|
|
|
|
import { SpinnerV2 } from './SpinnerV2';
|
2025-07-22 10:12:01 -05:00
|
|
|
import { SECOND } from '../util/durations';
|
2025-07-15 07:31:17 +10:00
|
|
|
|
|
|
|
export type PropsType = {
|
|
|
|
i18n: LocalizerType;
|
2025-07-22 10:12:01 -05:00
|
|
|
onWaitedTooLong: () => void;
|
2025-07-15 07:31:17 +10:00
|
|
|
};
|
|
|
|
|
|
|
|
export function DonationProgressModal(props: PropsType): JSX.Element {
|
2025-07-22 10:12:01 -05:00
|
|
|
const { i18n, onWaitedTooLong } = props;
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
let timeout: NodeJS.Timeout | undefined = setTimeout(() => {
|
|
|
|
timeout = undefined;
|
|
|
|
onWaitedTooLong();
|
|
|
|
}, SECOND * 30);
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
if (timeout) {
|
|
|
|
clearTimeout(timeout);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}, [onWaitedTooLong]);
|
2025-07-15 07:31:17 +10:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Modal
|
|
|
|
i18n={i18n}
|
|
|
|
moduleClassName="DonationProgressModal"
|
|
|
|
modalName="DonationProgressModal"
|
2025-07-22 10:12:01 -05:00
|
|
|
noMouseClose
|
|
|
|
onClose={() => undefined}
|
2025-07-15 07:31:17 +10:00
|
|
|
>
|
|
|
|
<SpinnerV2 size={58} strokeWidth={8} />
|
|
|
|
<div className="DonationProgressModal__text">
|
|
|
|
{i18n('icu:Donations__Processing')}
|
|
|
|
</div>
|
|
|
|
</Modal>
|
|
|
|
);
|
|
|
|
}
|