From 20d217d825891cf29a432a048d1f8e7bc04d062a Mon Sep 17 00:00:00 2001
From: srichman333 <sarah_n_richman@brown.edu>
Date: Wed, 14 Jun 2023 15:02:39 -0400
Subject: PropertiesView changes - colors on all permissions and fixed bug with
 when the drop down arrow is displayed

---
 src/client/views/PropertiesView.tsx | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

(limited to 'src/client/views/PropertiesView.tsx')

diff --git a/src/client/views/PropertiesView.tsx b/src/client/views/PropertiesView.tsx
index a5ac58f75..fb21c2db2 100644
--- a/src/client/views/PropertiesView.tsx
+++ b/src/client/views/PropertiesView.tsx
@@ -319,8 +319,7 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
                     .filter(permission => !Doc.noviceMode || ![SharingPermissions.View].includes(permission as any))
                     .map(permission => (
                         <option className="propertiesView-permisssions-select" key={permission} value={permission}>
-                            {' '}
-                            {permission}{' '}
+                            {permission}
                         </option>
                     ))}
             </select>
@@ -379,16 +378,19 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
                 </div>
                 {/* {name !== "Me" ? this.notifyIcon : null} */}
                 <div className="propertiesView-sharingTable-item-permission">
-                    {admin && permission !== 'Owner' ? this.getPermissionsSelect(name, permission) : permission}
+                    {this.colorACLDropDown(name, admin, permission, showExpansionIcon)}
                     {(permission === 'Owner' && name == 'Me') || showExpansionIcon ? this.expansionIcon : null}
                 </div>
             </div>
         );
     }
 
-    publicACLDropDown(admin: boolean, permission: string, showExpansionIcon?: boolean) {
+    colorACLDropDown(name: string, admin: boolean, permission: string, showExpansionIcon?: boolean) {
         var dropDownText = '';
         switch (StrCast(permission)) {
+            case 'Admin':
+                dropDownText = '⬢ ';
+                break;
             case 'Edit':
                 dropDownText = '⬢ ';
                 break;
@@ -402,15 +404,15 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
                 dropDownText = '▲ ';
                 break;
         }
-
         return (
             <div>
                 <div className={'propertiesView-shareDropDown'}>
                     <div className={`propertiesView-shareDropDown${permission}`}>
                         <div className="propertiesView-shareDropDown">
                             {' '}
-                            {dropDownText} {admin && permission !== 'Owner' ? this.getPermissionsSelect('Public', permission) : permission}
-                            {permission === 'Owner' || showExpansionIcon ? this.expansionIcon : null}
+                            {dropDownText}
+                            {admin && permission !== 'Owner' ? this.getPermissionsSelect(name, permission) : permission}
+                            {/* {(permission === 'Owner' && name == 'Me') || showExpansionIcon ? this.expansionIcon : null} */}
                         </div>
                     </div>
                 </div>
@@ -437,9 +439,11 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
         const docs = SelectionManager.Views().length < 2 ? [this.layoutDocAcls ? docToUse : docToUse?.[DataSym]] : SelectionManager.Views().map(docView => (this.layoutDocAcls ? docView.props.Document : docView.props.Document[DataSym]));
         const target = docs[0];
 
-        const effectiveAcls = GetEffectiveAcl(target);
-        const showAdmin = effectiveAcls == AclAdmin || docToUse!['acl-' + normalizeEmail(Doc.CurrentUserEmail)] == 'Owner';
-
+        // const effectiveAcls = GetEffectiveAcl(target);
+        // const showAdmin = effectiveAcls == AclAdmin || docToUse!['acl-' + normalizeEmail(Doc.CurrentUserEmail)] == 'Owner';
+        const curUserAcl = docToUse!['acl-' + normalizeEmail(Doc.CurrentUserEmail)]
+        const showAdmin = curUserAcl == 'Admin' || curUserAcl == 'Owner'
+        
         // users in common between all docs
         // const commonKeys: string[] = intersection(...docs.map(doc => doc?.[AclSym] && Object.keys(doc[AclSym]).filter(key => key !== 'acl-Me')));
         // const ownerSame = Doc.CurrentUserEmail !== target.author && docs.filter(doc => doc).every(doc => doc.author === docs[0].author);
@@ -480,11 +484,11 @@ export class PropertiesView extends React.Component<PropertiesViewProps> {
         return (
             <div>
                 {' '}
-                Sharing Mode
-                <div>{this.publicACLDropDown(showAdmin, StrCast(target['acl-Public']), false)}</div>
+                Sharing Mode for Public / Guest Users
+                <div>{this.colorACLDropDown('Public', showAdmin, StrCast(target['acl-Public']), false)}</div>
                 <div>
                     {' '}
-                    <br></br> Who has access to the Dashboard?{' '}
+                    <br></br> Sharing Modes for Individual Users and Groups with Access to the Dashboard{' '}
                 </div>
                 <div className="propertiesView-sharingTable">{<div> {tableEntries}</div>}</div>
             </div>
-- 
cgit v1.2.3-70-g09d2

