-
-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ndh/fix3807 refresh member list (#3924)
* Extract Dialogs to own files prepare generic contact list * Update modified group * Update changelog * Remove unintended file * Remove console logs * Skip useEffect on first render resolves #3533 * Add missing label for translation * move changelog entry --------- Co-authored-by: SimonLaux <[email protected]>
- Loading branch information
1 parent
45ec699
commit 1199dbe
Showing
11 changed files
with
423 additions
and
375 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
src/renderer/components/dialogs/AddMember/AddMemberDialog.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import React from 'react' | ||
import { useContactSearch } from '../CreateChat' | ||
import { AddMemberInnerDialog } from './AddMemberInnerDialog' | ||
import { useContactsMap } from '../../contact/ContactList' | ||
import Dialog from '../../Dialog' | ||
import type { T } from '@deltachat/jsonrpc-client' | ||
import type { DialogProps } from '../../../contexts/DialogContext' | ||
import { InlineVerifiedIcon } from '../../VerifiedIcon' | ||
import { Avatar } from '../../Avatar' | ||
|
||
export function AddMemberDialog({ | ||
onClose, | ||
onOk, | ||
groupMembers, | ||
listFlags, | ||
isBroadcast = false, | ||
isVerificationRequired = false, | ||
}: { | ||
onOk: (members: number[]) => void | ||
groupMembers: number[] | ||
listFlags: number | ||
isBroadcast?: boolean | ||
isVerificationRequired?: boolean | ||
} & DialogProps) { | ||
const [searchContacts, updateSearchContacts] = useContactsMap(listFlags, '') | ||
const [queryStr, onSearchChange, _, refreshContacts] = | ||
useContactSearch(updateSearchContacts) | ||
return ( | ||
<Dialog canOutsideClickClose={false} fixed onClose={onClose}> | ||
{AddMemberInnerDialog({ | ||
onOk: addMembers => { | ||
onOk(addMembers) | ||
onClose() | ||
}, | ||
onCancel: () => { | ||
onClose() | ||
}, | ||
onSearchChange, | ||
queryStr, | ||
searchContacts, | ||
refreshContacts, | ||
groupMembers, | ||
isBroadcast, | ||
isVerificationRequired, | ||
})} | ||
</Dialog> | ||
) | ||
} | ||
|
||
export const AddMemberChip = (props: { | ||
contact: T.Contact | ||
onRemoveClick: (contact: T.Contact) => void | ||
}) => { | ||
const { contact, onRemoveClick } = props | ||
return ( | ||
<div | ||
key={contact.id} | ||
className='AddMemberChip' | ||
onClick={() => onRemoveClick(contact)} | ||
> | ||
<div className='Avatar'> | ||
<Avatar | ||
displayName={contact.displayName} | ||
avatarPath={contact.profileImage} | ||
color={contact.color} | ||
/> | ||
</div> | ||
<div className='DisplayName'> | ||
{contact.displayName} {contact.isVerified && <InlineVerifiedIcon />} | ||
</div> | ||
</div> | ||
) | ||
} |
Oops, something went wrong.