Search for username in compose mode
This commit is contained in:
parent
6731cc6629
commit
cbae7f8ee9
36 changed files with 997 additions and 72 deletions
|
@ -6,9 +6,10 @@
|
|||
export type GlobalModalsStateType = {
|
||||
readonly contactModalState?: ContactModalStateType;
|
||||
readonly isProfileEditorVisible: boolean;
|
||||
readonly isWhatsNewVisible: boolean;
|
||||
readonly profileEditorHasError: boolean;
|
||||
readonly safetyNumberModalContactId?: string;
|
||||
readonly isWhatsNewVisible: boolean;
|
||||
readonly usernameNotFoundModalState?: UsernameNotFoundModalStateType;
|
||||
};
|
||||
|
||||
// Actions
|
||||
|
@ -16,6 +17,10 @@ export type GlobalModalsStateType = {
|
|||
const HIDE_CONTACT_MODAL = 'globalModals/HIDE_CONTACT_MODAL';
|
||||
const SHOW_CONTACT_MODAL = 'globalModals/SHOW_CONTACT_MODAL';
|
||||
const SHOW_WHATS_NEW_MODAL = 'globalModals/SHOW_WHATS_NEW_MODAL_MODAL';
|
||||
const SHOW_USERNAME_NOT_FOUND_MODAL =
|
||||
'globalModals/SHOW_USERNAME_NOT_FOUND_MODAL';
|
||||
const HIDE_USERNAME_NOT_FOUND_MODAL =
|
||||
'globalModals/HIDE_USERNAME_NOT_FOUND_MODAL';
|
||||
const HIDE_WHATS_NEW_MODAL = 'globalModals/HIDE_WHATS_NEW_MODAL_MODAL';
|
||||
const TOGGLE_PROFILE_EDITOR = 'globalModals/TOGGLE_PROFILE_EDITOR';
|
||||
export const TOGGLE_PROFILE_EDITOR_ERROR =
|
||||
|
@ -27,6 +32,10 @@ export type ContactModalStateType = {
|
|||
conversationId?: string;
|
||||
};
|
||||
|
||||
export type UsernameNotFoundModalStateType = {
|
||||
username: string;
|
||||
};
|
||||
|
||||
type HideContactModalActionType = {
|
||||
type: typeof HIDE_CONTACT_MODAL;
|
||||
};
|
||||
|
@ -44,6 +53,17 @@ type ShowWhatsNewModalActionType = {
|
|||
type: typeof SHOW_WHATS_NEW_MODAL;
|
||||
};
|
||||
|
||||
type HideUsernameNotFoundModalActionType = {
|
||||
type: typeof HIDE_USERNAME_NOT_FOUND_MODAL;
|
||||
};
|
||||
|
||||
export type ShowUsernameNotFoundModalActionType = {
|
||||
type: typeof SHOW_USERNAME_NOT_FOUND_MODAL;
|
||||
payload: {
|
||||
username: string;
|
||||
};
|
||||
};
|
||||
|
||||
type ToggleProfileEditorActionType = {
|
||||
type: typeof TOGGLE_PROFILE_EDITOR;
|
||||
};
|
||||
|
@ -62,6 +82,8 @@ export type GlobalModalsActionType =
|
|||
| ShowContactModalActionType
|
||||
| HideWhatsNewModalActionType
|
||||
| ShowWhatsNewModalActionType
|
||||
| HideUsernameNotFoundModalActionType
|
||||
| ShowUsernameNotFoundModalActionType
|
||||
| ToggleProfileEditorActionType
|
||||
| ToggleProfileEditorErrorActionType
|
||||
| ToggleSafetyNumberModalActionType;
|
||||
|
@ -73,6 +95,8 @@ export const actions = {
|
|||
showContactModal,
|
||||
hideWhatsNewModal,
|
||||
showWhatsNewModal,
|
||||
hideUsernameNotFoundModal,
|
||||
showUsernameNotFoundModal,
|
||||
toggleProfileEditor,
|
||||
toggleProfileEditorHasError,
|
||||
toggleSafetyNumberModal,
|
||||
|
@ -109,6 +133,23 @@ function showWhatsNewModal(): ShowWhatsNewModalActionType {
|
|||
};
|
||||
}
|
||||
|
||||
function hideUsernameNotFoundModal(): HideUsernameNotFoundModalActionType {
|
||||
return {
|
||||
type: HIDE_USERNAME_NOT_FOUND_MODAL,
|
||||
};
|
||||
}
|
||||
|
||||
function showUsernameNotFoundModal(
|
||||
username: string
|
||||
): ShowUsernameNotFoundModalActionType {
|
||||
return {
|
||||
type: SHOW_USERNAME_NOT_FOUND_MODAL,
|
||||
payload: {
|
||||
username,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function toggleProfileEditor(): ToggleProfileEditorActionType {
|
||||
return { type: TOGGLE_PROFILE_EDITOR };
|
||||
}
|
||||
|
@ -168,6 +209,24 @@ export function reducer(
|
|||
};
|
||||
}
|
||||
|
||||
if (action.type === HIDE_USERNAME_NOT_FOUND_MODAL) {
|
||||
return {
|
||||
...state,
|
||||
usernameNotFoundModalState: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
if (action.type === SHOW_USERNAME_NOT_FOUND_MODAL) {
|
||||
const { username } = action.payload;
|
||||
|
||||
return {
|
||||
...state,
|
||||
usernameNotFoundModalState: {
|
||||
username,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
if (action.type === SHOW_CONTACT_MODAL) {
|
||||
return {
|
||||
...state,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue