Search for username in compose mode

This commit is contained in:
Scott Nonnenberg 2021-11-11 17:17:29 -08:00 committed by GitHub
parent 6731cc6629
commit cbae7f8ee9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 997 additions and 72 deletions

View file

@ -2,9 +2,14 @@
// SPDX-License-Identifier: AGPL-3.0-only
import React from 'react';
import type { ContactModalStateType } from '../state/ducks/globalModals';
import type {
ContactModalStateType,
UsernameNotFoundModalStateType,
} from '../state/ducks/globalModals';
import type { LocalizerType } from '../types/Util';
import { ButtonVariant } from './Button';
import { ConfirmationDialog } from './ConfirmationDialog';
import { WhatsNewModal } from './WhatsNewModal';
type PropsType = {
@ -18,6 +23,9 @@ type PropsType = {
// SafetyNumberModal
safetyNumberModalContactId?: string;
renderSafetyNumber: () => JSX.Element;
// UsernameNotFoundModal
hideUsernameNotFoundModal: () => unknown;
usernameNotFoundModalState?: UsernameNotFoundModalStateType;
// WhatsNewModal
isWhatsNewVisible: boolean;
hideWhatsNewModal: () => unknown;
@ -34,6 +42,9 @@ export const GlobalModalContainer = ({
// SafetyNumberModal
safetyNumberModalContactId,
renderSafetyNumber,
// UsernameNotFoundModal
hideUsernameNotFoundModal,
usernameNotFoundModalState,
// WhatsNewModal
hideWhatsNewModal,
isWhatsNewVisible,
@ -42,6 +53,23 @@ export const GlobalModalContainer = ({
return renderSafetyNumber();
}
if (usernameNotFoundModalState) {
return (
<ConfirmationDialog
cancelText={i18n('ok')}
cancelButtonVariant={ButtonVariant.Secondary}
i18n={i18n}
onClose={hideUsernameNotFoundModal}
>
{i18n('startConversation--username-not-found', {
atUsername: i18n('at-username', {
username: usernameNotFoundModalState.username,
}),
})}
</ConfirmationDialog>
);
}
if (contactModalState) {
return renderContactModal();
}