add viewers and collabs in participants List

This commit is contained in:
jubitjohn 2023-07-05 11:27:28 +05:30
parent 26c3198111
commit b67c2b399e
4 changed files with 41 additions and 27 deletions

View file

@ -9,24 +9,18 @@ import { EnteMenuItem } from 'components/Menu/EnteMenuItem';
// import AvatarCollectionShare from '../AvatarCollectionShare'; // import AvatarCollectionShare from '../AvatarCollectionShare';
// import ChevronRightIcon from '@mui/icons-material/ChevronRight'; // import ChevronRightIcon from '@mui/icons-material/ChevronRight';
import MenuItemDivider from 'components/Menu/MenuItemDivider'; import MenuItemDivider from 'components/Menu/MenuItemDivider';
import ManageAddCollab from './MangeAddCollab';
interface Iprops { interface Iprops {
collection: Collection; collection: Collection;
onRootClose: () => void;
} }
export function CollaboratorParticipants({ collection }: Iprops) { export function CollaboratorParticipants({ collection, onRootClose }: Iprops) {
if (!collection.sharees?.length) { if (!collection.sharees?.length) {
return <></>; return <></>;
} }
const shareExpireOption = [
'Never',
'1 day',
'1 week',
'1 month',
'1 year',
'Custom',
];
const [collaborators, setCollaborators] = useState([]); const [collaborators, setCollaborators] = useState([]);
useEffect(() => { useEffect(() => {
@ -51,11 +45,15 @@ export function CollaboratorParticipants({ collection }: Iprops) {
onClick={() => console.log('clicked')} onClick={() => console.log('clicked')}
label={item} label={item}
/> />
{index !== shareExpireOption.length - 1 && ( {index !== collaborators.length - 1 && (
<MenuItemDivider /> <MenuItemDivider />
)} )}
</> </>
))} ))}
<ManageAddCollab
collection={collection}
onRootClose={onRootClose}
/>
</MenuItemGroup> </MenuItemGroup>
</Box> </Box>
); );

View file

@ -9,9 +9,10 @@ import { CollaboratorParticipants } from './CollaboratorParticipants';
interface Iprops { interface Iprops {
collection: Collection; collection: Collection;
onRootClose: () => void;
} }
export function ManageParticipantsList({ collection }: Iprops) { export function ManageParticipantsList({ collection, onRootClose }: Iprops) {
if (!collection.sharees?.length) { if (!collection.sharees?.length) {
return <></>; return <></>;
} }
@ -20,8 +21,11 @@ export function ManageParticipantsList({ collection }: Iprops) {
<Box mb={3}> <Box mb={3}>
<OwnerParticipant collection={collection}></OwnerParticipant> <OwnerParticipant collection={collection}></OwnerParticipant>
<CollaboratorParticipants <CollaboratorParticipants
collection={collection}></CollaboratorParticipants> collection={collection}
<ViewerParticipants collection={collection}></ViewerParticipants> onRootClose={onRootClose}></CollaboratorParticipants>
<ViewerParticipants
collection={collection}
onRootClose={onRootClose}></ViewerParticipants>
</Box> </Box>
); );
} }

View file

@ -28,7 +28,7 @@ export default function ManageAddCollab({ collection, onRootClose }: Iprops) {
<EnteMenuItem <EnteMenuItem
startIcon={<AddIcon />} startIcon={<AddIcon />}
onClick={openManageShare} onClick={openManageShare}
label={t('Add Collaborator')} label={t('Add Collaborators')}
/> />
</MenuItemGroup> </MenuItemGroup>
</Stack> </Stack>

View file

@ -7,12 +7,14 @@ import { EnteMenuItem } from 'components/Menu/EnteMenuItem';
import MenuItemDivider from 'components/Menu/MenuItemDivider'; import MenuItemDivider from 'components/Menu/MenuItemDivider';
import MenuSectionTitle from 'components/Menu/MenuSectionTitle'; import MenuSectionTitle from 'components/Menu/MenuSectionTitle';
import AvatarCollectionShare from '../AvatarCollectionShare'; import AvatarCollectionShare from '../AvatarCollectionShare';
import ManageAddViewer from './ManageAddViewer';
interface Iprops { interface Iprops {
collection: Collection; collection: Collection;
onRootClose: () => void;
} }
export function ViewerParticipants({ collection }: Iprops) { export function ViewerParticipants({ collection, onRootClose }: Iprops) {
if (!collection.sharees?.length) { if (!collection.sharees?.length) {
return <></>; return <></>;
} }
@ -30,6 +32,7 @@ export function ViewerParticipants({ collection }: Iprops) {
<Box mb={3}> <Box mb={3}>
<MenuSectionTitle title={t('Viewers')} /> <MenuSectionTitle title={t('Viewers')} />
<MenuItemGroup> <MenuItemGroup>
<>
{Viewers.map((item, index) => ( {Viewers.map((item, index) => (
<> <>
<EnteMenuItem <EnteMenuItem
@ -37,11 +40,20 @@ export function ViewerParticipants({ collection }: Iprops) {
key={item} key={item}
onClick={() => console.log('clicked')} onClick={() => console.log('clicked')}
label={item} label={item}
startIcon={<AvatarCollectionShare email={item} />} startIcon={
<AvatarCollectionShare email={item} />
}
/> />
{index !== Viewers.length - 1 && <MenuItemDivider />} {index !== Viewers.length - 1 && (
<MenuItemDivider />
)}
</> </>
))} ))}
<ManageAddViewer
collection={collection}
onRootClose={onRootClose}
/>
</>
</MenuItemGroup> </MenuItemGroup>
</Box> </Box>
); );