Context menu for left pane list items

This commit is contained in:
Fedor Indutny 2023-04-05 13:48:00 -07:00 committed by GitHub
parent 02dedc7157
commit f61d8f38b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 1046 additions and 110 deletions

View file

@ -64,6 +64,7 @@ type ContactRowType = {
type: RowType.Contact;
contact: ContactListItemPropsType;
isClickable?: boolean;
hasContextMenu?: boolean;
};
type ContactCheckboxRowType = {
@ -175,12 +176,16 @@ export type PropsType = {
i18n: LocalizerType;
theme: ThemeType;
blockConversation: (conversationId: string) => void;
onClickArchiveButton: () => void;
onClickContactCheckbox: (
conversationId: string,
disabledReason: undefined | ContactCheckboxDisabledReason
) => void;
onSelectConversation: (conversationId: string, messageId?: string) => void;
onOutgoingAudioCallInConversation: (conversationId: string) => void;
onOutgoingVideoCallInConversation: (conversationId: string) => void;
removeConversation?: (conversationId: string) => void;
renderMessageSearchResult?: (id: string) => JSX.Element;
showChooseGroupMembers: () => void;
showConversation: ShowConversationType;
@ -195,9 +200,13 @@ export function ConversationList({
getPreferredBadge,
getRow,
i18n,
blockConversation,
onClickArchiveButton,
onClickContactCheckbox,
onSelectConversation,
onOutgoingAudioCallInConversation,
onOutgoingVideoCallInConversation,
removeConversation,
renderMessageSearchResult,
rowCount,
scrollBehavior = ScrollBehavior.Default,
@ -266,7 +275,7 @@ export function ConversationList({
result = undefined;
break;
case RowType.Contact: {
const { isClickable = true } = row;
const { isClickable = true, hasContextMenu = false } = row;
result = (
<ContactListItem
{...row.contact}
@ -274,6 +283,15 @@ export function ConversationList({
onClick={isClickable ? onSelectConversation : undefined}
i18n={i18n}
theme={theme}
hasContextMenu={hasContextMenu}
onAudioCall={
isClickable ? onOutgoingAudioCallInConversation : undefined
}
onVideoCall={
isClickable ? onOutgoingVideoCallInConversation : undefined
}
onBlock={isClickable ? blockConversation : undefined}
onRemove={isClickable ? removeConversation : undefined}
/>
);
break;
@ -343,6 +361,7 @@ export function ConversationList({
'muteExpiresAt',
'phoneNumber',
'profileName',
'removalStage',
'sharedGroupNames',
'shouldShowDraft',
'title',
@ -452,18 +471,22 @@ export function ConversationList({
);
},
[
blockConversation,
getPreferredBadge,
getRow,
i18n,
lookupConversationWithoutUuid,
onClickArchiveButton,
onClickContactCheckbox,
onOutgoingAudioCallInConversation,
onOutgoingVideoCallInConversation,
onSelectConversation,
lookupConversationWithoutUuid,
showUserNotFoundModal,
setIsFetchingUUID,
removeConversation,
renderMessageSearchResult,
setIsFetchingUUID,
showChooseGroupMembers,
showConversation,
showUserNotFoundModal,
theme,
]
);