collaborator List Added

This commit is contained in:
jubitjohn 2023-07-05 11:00:26 +05:30
parent 2be02d880e
commit e71c0b06ea
2 changed files with 14 additions and 13 deletions

View file

@ -1,6 +1,6 @@
import { Box } from '@mui/material';
import React from 'react';
import React, { useEffect, useState } from 'react';
import { t } from 'i18next';
import { Collection } from 'types/collection';
import MenuSectionTitle from 'components/Menu/MenuSectionTitle';
@ -27,12 +27,23 @@ export function CollaboratorParticipants({ collection }: Iprops) {
'1 year',
'Custom',
];
const [collaborators, setCollaborators] = useState([]);
useEffect(() => {
collection.sharees?.map((sharee) => {
if (sharee.role === 'COLLABORATOR')
setCollaborators((prevViewers) => [
...prevViewers,
sharee.email,
]);
});
}, [collection.sharees]);
return (
<Box mb={3}>
<MenuSectionTitle title={t('Collaborators')} />
<MenuItemGroup>
{shareExpireOption.map((item, index) => (
{collaborators.map((item, index) => (
<>
<EnteMenuItem
fontWeight="normal"

View file

@ -16,14 +16,6 @@ export function ViewerParticipants({ collection }: Iprops) {
if (!collection.sharees?.length) {
return <></>;
}
const shareExpireOption = [
'Never',
'1 day',
'1 week',
'1 month',
'1 year',
'Custom',
];
const [Viewers, setViewers] = useState([]);
@ -47,9 +39,7 @@ export function ViewerParticipants({ collection }: Iprops) {
label={item}
startIcon={<AvatarCollectionShare email={item} />}
/>
{index !== shareExpireOption.length - 1 && (
<MenuItemDivider />
)}
{index !== Viewers.length - 1 && <MenuItemDivider />}
</>
))}
</MenuItemGroup>