From 9e2f70d2ebe1224edc1621ac0febb8764ac38c4c Mon Sep 17 00:00:00 2001 From: Yee Jia Wei Date: Mon, 18 Dec 2023 14:55:39 +0800 Subject: [PATCH] update collection sharing permission to predefined --- .../EditCollectionSharingModal.tsx | 326 ++++++------------ 1 file changed, 106 insertions(+), 220 deletions(-) diff --git a/components/ModalContent/EditCollectionSharingModal.tsx b/components/ModalContent/EditCollectionSharingModal.tsx index 8a836bc..3c06f6b 100644 --- a/components/ModalContent/EditCollectionSharingModal.tsx +++ b/components/ModalContent/EditCollectionSharingModal.tsx @@ -146,7 +146,7 @@ export default function EditCollectionSharingModal({ {permissions === true && ( <> -

Member Management

+

Members

- +
@@ -184,39 +184,29 @@ export default function EditCollectionSharingModal({ {collection?.members[0]?.user && ( <> - {permissions === true ? ( -

- (All Members have Read access to this collection.) -

- ) : ( -

- Here are all the members who are collaborating on this - collection. -

- )} - -
+
-
- -
-
-

- {collectionOwner.name} -

-
- Admin -
+
+
+
+
-

@{collectionOwner.username}

+
+

{collectionOwner.name}

+

@{collectionOwner.username}

+
+
+
+

+ Owner +

@@ -227,200 +217,96 @@ export default function EditCollectionSharingModal({ return (
- {permissions === true && ( - { - const updatedMembers = collection.members.filter( - (member) => { - return member.user.username !== e.user.username; - } - ); - setCollection({ - ...collection, - members: updatedMembers, - }); - }} - /> - )} -
- -
-

{e.user.name}

-

@{e.user.username}

-
-
-
-
-

- Permissions -

- {permissions === true && ( -

- (Click to toggle.) -

- )} -
- - {permissions !== true && - !e.canCreate && - !e.canUpdate && - !e.canDelete ? ( -

- Has no permissions. -

- ) : ( -
- - - - - +
+
+
+
- )} +
+

{e.user.name}

+

@{e.user.username}

+
+
+ +
+ {permissions === true && ( + { + const updatedMembers = collection.members.filter( + (member) => { + return member.user.username !== e.user.username; + } + ); + setCollection({ + ...collection, + members: updatedMembers, + }); + }} + /> + )} + +
+ {permissions === true ? ( + + ) : ( +

+ { + (e.canCreate && e.canUpdate && e.canDelete) + ? "Admin" + : (e.canCreate) + ? 'Contributor' + : 'Viewer' + } +

+ )} +
+
); - })} + }) + }
)}