Use ErrorBoundary for donations
This commit is contained in:
parent
26b289a4ae
commit
eac9a69e20
11 changed files with 285 additions and 7 deletions
57
ts/components/DebugLogErrorModal.tsx
Normal file
57
ts/components/DebugLogErrorModal.tsx
Normal file
|
@ -0,0 +1,57 @@
|
|||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
import type { LocalizerType } from '../types/Util';
|
||||
import { Modal } from './Modal';
|
||||
import { Button, ButtonVariant } from './Button';
|
||||
|
||||
export type PropsType = {
|
||||
description?: string;
|
||||
i18n: LocalizerType;
|
||||
onClose: () => void;
|
||||
onSubmitDebugLog: () => void;
|
||||
};
|
||||
|
||||
function focusRef(el: HTMLElement | null) {
|
||||
if (el) {
|
||||
el.focus();
|
||||
}
|
||||
}
|
||||
|
||||
export function DebugLogErrorModal(props: PropsType): JSX.Element {
|
||||
const { description, i18n, onClose, onSubmitDebugLog } = props;
|
||||
|
||||
const footer = (
|
||||
<>
|
||||
<Button onClick={onClose} variant={ButtonVariant.Secondary}>
|
||||
{i18n('icu:DebugLogErrorModal__SubmitDebugLog__Cancel')}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => {
|
||||
onSubmitDebugLog();
|
||||
onClose();
|
||||
}}
|
||||
ref={focusRef}
|
||||
variant={ButtonVariant.Primary}
|
||||
>
|
||||
{i18n('icu:DebugLogErrorModal__SubmitDebugLog')}
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
|
||||
return (
|
||||
<Modal
|
||||
modalName="DebugLogErrorModal"
|
||||
i18n={i18n}
|
||||
onClose={onClose}
|
||||
title={i18n('icu:DebugLogErrorModal__UnexpectedError')}
|
||||
modalFooter={footer}
|
||||
>
|
||||
<div className="module-error-modal__description">
|
||||
{description || i18n('icu:ErrorModal--description')}
|
||||
</div>
|
||||
</Modal>
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue