From e71c0b06ea7b1bb0d7a7bc42e5efda293efbf865 Mon Sep 17 00:00:00 2001 From: jubitjohn Date: Wed, 5 Jul 2023 11:00:26 +0530 Subject: [PATCH] collaborator List Added --- .../ShareControl/CollaboratorParticipants.tsx | 15 +++++++++++++-- .../ShareControl/ViewerParticipants.tsx | 12 +----------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/apps/photos/src/components/Collections/CollectionShare/ShareControl/CollaboratorParticipants.tsx b/apps/photos/src/components/Collections/CollectionShare/ShareControl/CollaboratorParticipants.tsx index 40b430195..2c71b1fce 100644 --- a/apps/photos/src/components/Collections/CollectionShare/ShareControl/CollaboratorParticipants.tsx +++ b/apps/photos/src/components/Collections/CollectionShare/ShareControl/CollaboratorParticipants.tsx @@ -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 ( - {shareExpireOption.map((item, index) => ( + {collaborators.map((item, index) => ( <> ; } - 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={} /> - {index !== shareExpireOption.length - 1 && ( - - )} + {index !== Viewers.length - 1 && } ))}