Removes some Backbone views

This commit is contained in:
Josh Perez 2021-06-17 17:15:09 -04:00 committed by GitHub
parent 93bc094342
commit 94d116c621
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 160 additions and 656 deletions

View file

@ -19,14 +19,13 @@ export type GroupV2Membership = {
export type Props = {
canAddNewMembers: boolean;
i18n: LocalizerType;
maxShownMemberCount?: number;
memberships: Array<GroupV2Membership>;
showContactModal: (conversationId: string) => void;
startAddingNewMembers: () => void;
i18n: LocalizerType;
startAddingNewMembers?: () => void;
};
const MAX_MEMBER_COUNT = 5;
const collator = new Intl.Collator(undefined, { sensitivity: 'base' });
function sortConversationTitles(
left: GroupV2Membership,
@ -68,18 +67,20 @@ function sortMemberships(
export const ConversationDetailsMembershipList: React.ComponentType<Props> = ({
canAddNewMembers,
i18n,
maxShownMemberCount = 5,
memberships,
showContactModal,
startAddingNewMembers,
i18n,
}) => {
const [showAllMembers, setShowAllMembers] = React.useState<boolean>(false);
const sortedMemberships = sortMemberships(memberships);
const shouldHideRestMembers = sortedMemberships.length - MAX_MEMBER_COUNT > 1;
const shouldHideRestMembers =
sortedMemberships.length - maxShownMemberCount > 1;
const membersToShow =
shouldHideRestMembers && !showAllMembers
? MAX_MEMBER_COUNT
? maxShownMemberCount
: sortedMemberships.length;
return (
@ -94,7 +95,7 @@ export const ConversationDetailsMembershipList: React.ComponentType<Props> = ({
<div className="module-conversation-details-membership-list__add-members-icon" />
}
label={i18n('ConversationDetailsMembershipList--add-members')}
onClick={startAddingNewMembers}
onClick={() => startAddingNewMembers?.()}
/>
)}
{sortedMemberships.slice(0, membersToShow).map(({ isAdmin, member }) => (