2021-05-28 19:11:19 +00:00
|
|
|
// Copyright 2021 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import * as React from 'react';
|
|
|
|
|
2021-08-02 21:19:18 +00:00
|
|
|
import { Button, ButtonSize, ButtonVariant } from '../Button';
|
2021-10-26 19:15:33 +00:00
|
|
|
import type { ConversationType } from '../../state/ducks/conversations';
|
2021-05-28 19:11:19 +00:00
|
|
|
import { Modal } from '../Modal';
|
|
|
|
import { Intl } from '../Intl';
|
|
|
|
import { Emojify } from './Emojify';
|
|
|
|
|
2021-09-17 22:24:21 +00:00
|
|
|
import { useRestoreFocus } from '../../hooks/useRestoreFocus';
|
2021-07-30 20:30:59 +00:00
|
|
|
|
2021-10-26 19:15:33 +00:00
|
|
|
import type { LocalizerType } from '../../types/Util';
|
2021-05-28 19:11:19 +00:00
|
|
|
|
|
|
|
export type PropsType = {
|
|
|
|
i18n: LocalizerType;
|
|
|
|
sender: ConversationType;
|
2021-07-27 20:30:41 +00:00
|
|
|
inGroup: boolean;
|
2021-07-30 20:30:59 +00:00
|
|
|
learnMoreAboutDeliveryIssue: () => unknown;
|
2021-05-28 19:11:19 +00:00
|
|
|
onClose: () => unknown;
|
|
|
|
};
|
|
|
|
|
|
|
|
export function DeliveryIssueDialog(props: PropsType): React.ReactElement {
|
2021-07-30 20:30:59 +00:00
|
|
|
const { i18n, inGroup, learnMoreAboutDeliveryIssue, sender, onClose } = props;
|
2021-07-27 20:30:41 +00:00
|
|
|
|
|
|
|
const key = inGroup
|
|
|
|
? 'DeliveryIssue--summary--group'
|
|
|
|
: 'DeliveryIssue--summary';
|
2021-05-28 19:11:19 +00:00
|
|
|
|
2021-07-30 20:30:59 +00:00
|
|
|
// Focus first button after initial render, restore focus on teardown
|
|
|
|
const [focusRef] = useRestoreFocus();
|
|
|
|
|
2021-05-28 19:11:19 +00:00
|
|
|
return (
|
2021-07-30 20:30:59 +00:00
|
|
|
<Modal hasXButton={false} onClose={onClose} i18n={i18n}>
|
2021-08-02 21:19:18 +00:00
|
|
|
<section>
|
2021-05-28 19:11:19 +00:00
|
|
|
<div className="module-delivery-issue-dialog__image">
|
|
|
|
<img
|
|
|
|
src="images/delivery-issue.svg"
|
|
|
|
height="110"
|
|
|
|
width="200"
|
|
|
|
alt=""
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div className="module-delivery-issue-dialog__title">
|
|
|
|
{i18n('DeliveryIssue--title')}
|
|
|
|
</div>
|
|
|
|
<div className="module-delivery-issue-dialog__description">
|
|
|
|
<Intl
|
2021-07-27 20:30:41 +00:00
|
|
|
id={key}
|
2021-05-28 19:11:19 +00:00
|
|
|
components={{
|
|
|
|
sender: <Emojify text={sender.title} />,
|
|
|
|
}}
|
|
|
|
i18n={i18n}
|
|
|
|
/>
|
|
|
|
</div>
|
2021-08-02 21:19:18 +00:00
|
|
|
</section>
|
|
|
|
<Modal.ButtonFooter>
|
|
|
|
<Button
|
|
|
|
onClick={learnMoreAboutDeliveryIssue}
|
|
|
|
size={ButtonSize.Medium}
|
|
|
|
variant={ButtonVariant.Secondary}
|
|
|
|
>
|
|
|
|
{i18n('DeliveryIssue--learnMore')}
|
|
|
|
</Button>
|
|
|
|
<Button
|
|
|
|
onClick={onClose}
|
|
|
|
ref={focusRef}
|
|
|
|
size={ButtonSize.Medium}
|
|
|
|
variant={ButtonVariant.Primary}
|
|
|
|
className="module-delivery-issue-dialog__close-button"
|
|
|
|
>
|
|
|
|
{i18n('Confirmation--confirm')}
|
|
|
|
</Button>
|
|
|
|
</Modal.ButtonFooter>
|
2021-05-28 19:11:19 +00:00
|
|
|
</Modal>
|
|
|
|
);
|
|
|
|
}
|