Add to group by username

This commit is contained in:
Fedor Indutny 2022-06-16 17:38:28 -07:00 committed by GitHub
parent 8dd321d0b6
commit 973b2264fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 332 additions and 45 deletions

View file

@ -25,6 +25,7 @@ import { ContactListItem } from './conversationList/ContactListItem';
import type { ContactCheckboxDisabledReason } from './conversationList/ContactCheckbox';
import { ContactCheckbox as ContactCheckboxComponent } from './conversationList/ContactCheckbox';
import { PhoneNumberCheckbox as PhoneNumberCheckboxComponent } from './conversationList/PhoneNumberCheckbox';
import { UsernameCheckbox as UsernameCheckboxComponent } from './conversationList/UsernameCheckbox';
import { CreateNewGroupButton } from './conversationList/CreateNewGroupButton';
import { StartNewConversation as StartNewConversationComponent } from './conversationList/StartNewConversation';
import { SearchResultsLoadingFakeHeader as SearchResultsLoadingFakeHeaderComponent } from './conversationList/SearchResultsLoadingFakeHeader';
@ -32,19 +33,20 @@ import { SearchResultsLoadingFakeRow as SearchResultsLoadingFakeRowComponent } f
import { UsernameSearchResultListItem } from './conversationList/UsernameSearchResultListItem';
export enum RowType {
ArchiveButton,
Blank,
Contact,
ContactCheckbox,
PhoneNumberCheckbox,
Conversation,
CreateNewGroup,
Header,
MessageSearchResult,
SearchResultsLoadingFakeHeader,
SearchResultsLoadingFakeRow,
StartNewConversation,
UsernameSearchResult,
ArchiveButton = 'ArchiveButton',
Blank = 'Blank',
Contact = 'Contact',
ContactCheckbox = 'ContactCheckbox',
PhoneNumberCheckbox = 'PhoneNumberCheckbox',
UsernameCheckbox = 'UsernameCheckbox',
Conversation = 'Conversation',
CreateNewGroup = 'CreateNewGroup',
Header = 'Header',
MessageSearchResult = 'MessageSearchResult',
SearchResultsLoadingFakeHeader = 'SearchResultsLoadingFakeHeader',
SearchResultsLoadingFakeRow = 'SearchResultsLoadingFakeRow',
StartNewConversation = 'StartNewConversation',
UsernameSearchResult = 'UsernameSearchResult',
}
type ArchiveButtonRowType = {
@ -74,6 +76,13 @@ type PhoneNumberCheckboxRowType = {
isFetching: boolean;
};
type UsernameCheckboxRowType = {
type: RowType.UsernameCheckbox;
username: string;
isChecked: boolean;
isFetching: boolean;
};
type ConversationRowType = {
type: RowType.Conversation;
conversation: ConversationListItemPropsType;
@ -119,6 +128,7 @@ export type Row =
| ContactRowType
| ContactCheckboxRowType
| PhoneNumberCheckboxRowType
| UsernameCheckboxRowType
| ConversationRowType
| CreateNewGroupRowType
| MessageRowType
@ -283,6 +293,23 @@ export const ConversationList: React.FC<PropsType> = ({
/>
);
break;
case RowType.UsernameCheckbox:
result = (
<UsernameCheckboxComponent
username={row.username}
lookupConversationWithoutUuid={lookupConversationWithoutUuid}
showUserNotFoundModal={showUserNotFoundModal}
setIsFetchingUUID={setIsFetchingUUID}
toggleConversationInChooseMembers={conversationId =>
onClickContactCheckbox(conversationId, undefined)
}
isChecked={row.isChecked}
isFetching={row.isFetching}
i18n={i18n}
theme={theme}
/>
);
break;
case RowType.Conversation: {
const itemProps = pick(row.conversation, [
'acceptedMessageRequest',