@@ -14,6 +14,7 @@ import {
1414import { ChainIcon , DeleteIcon , LockIcon , PublicIcon } from '../../icons' ;
1515import { useTheme } from '../../theme' ;
1616import { BLACK , WHITE } from '../../theme/colors' ;
17+ import { CustomTooltip } from '../CustomTooltip' ;
1718import { Modal , ModalBody , ModalButtonPrimary , ModalButtonSecondary , ModalFooter } from '../Modal' ;
1819import UserShareSearch from '../UserSearchField/UserSearchField' ;
1920import {
@@ -97,13 +98,15 @@ const AccessList: React.FC<AccessListProps> = ({
9798 { ownerData . id === actorData . id ? (
9899 < div > Owner</ div >
99100 ) : (
100- < IconButton
101- edge = "end"
102- aria-label = "delete"
103- onClick = { ( ) => handleDelete ( actorData . email ) }
104- >
105- < DeleteIcon fill = { theme . palette . background . neutral ?. default } />
106- </ IconButton >
101+ < CustomTooltip title = "Remove Access" placement = "top" arrow >
102+ < IconButton
103+ edge = "end"
104+ aria-label = "delete"
105+ onClick = { ( ) => handleDelete ( actorData . email ) }
106+ >
107+ < DeleteIcon fill = { theme . palette . background . neutral ?. default } />
108+ </ IconButton >
109+ </ CustomTooltip >
107110 ) }
108111 </ ListItemSecondaryAction >
109112 </ ListItem >
@@ -185,6 +188,9 @@ const ShareModal: React.FC<ShareModalProps> = ({
185188 const handleMenuClose = ( ) => setMenu ( false ) ;
186189
187190 const isShareDisabled = ( ) => {
191+ // Ensure at least one user other than the owner is selected
192+ const otherUsersSelected = shareUserData . some ( ( user ) => user . id !== ownerData . id ) ;
193+
188194 const existingAccessIds = shareUserData . map ( ( user ) => user . id ) ;
189195 const ownerDataId = ownerData ?. id ;
190196
@@ -195,10 +201,10 @@ const ShareModal: React.FC<ShareModalProps> = ({
195201 const hasMismatchedUsers = ! shareUserData . every ( ( user ) => existingAccessIds . includes ( user . id ) ) ;
196202
197203 return (
198- shareUserData . length === existingAccessIds . length &&
199- ! hasMismatchedUsers &&
200- ( selectedOption === selectedResource ?. visibility ||
201- shareUserData . length !== existingAccessIds . length )
204+ ! otherUsersSelected || // Disable if no other users are selected
205+ ( shareUserData . length === existingAccessIds . length &&
206+ ! hasMismatchedUsers &&
207+ selectedOption === selectedResource ?. visibility )
202208 ) ;
203209 } ;
204210
@@ -238,52 +244,60 @@ const ShareModal: React.FC<ShareModalProps> = ({
238244 }
239245 fetchSuggestions = { fetchSuggestions }
240246 />
241- < CustomListItemText >
242- < Typography variant = "h6" > General Access</ Typography >
243- </ CustomListItemText >
244- < CustomDialogContentText >
245- < FormControlWrapper size = "small" >
246- < div style = { { display : 'flex' , justifyContent : 'start' , alignItems : 'center' } } >
247- < VisibilityIconWrapper >
248- { selectedOption === SHARE_MODE . PUBLIC ? (
249- < PublicIcon
250- width = { 24 }
251- height = { 24 }
252- stroke = { theme . palette . mode === 'dark' ? WHITE : BLACK }
253- />
254- ) : (
255- < LockIcon
256- width = { 24 }
257- height = { 24 }
258- stroke = { theme . palette . mode === 'dark' ? WHITE : BLACK }
259- />
260- ) }
261- </ VisibilityIconWrapper >
262- < div style = { { display : 'flex' , flexDirection : 'column' } } >
263- < CustomSelect
264- variant = "outlined"
265- defaultValue = { selectedOption }
266- labelId = "share-menu-select"
267- id = "share-menu"
268- open = { openMenu }
269- onClose = { handleMenuClose }
270- onOpen = { ( ) => setMenu ( true ) }
271- onChange = { handleOptionClick }
272- disabled = { isVisibilitySelectorDisabled }
273- >
274- { Object . values ( SHARE_MODE ) . map ( ( option ) => (
275- < MenuItem key = { option } selected = { option === selectedOption } value = { option } >
276- { option . charAt ( 0 ) . toUpperCase ( ) + option . slice ( 1 ) }
277- </ MenuItem >
278- ) ) }
279- </ CustomSelect >
280- < Typography component = "span" variant = "body2" >
281- { selectedOption === SHARE_MODE . PRIVATE ? options . PRIVATE : options . PUBLIC }
282- </ Typography >
283- </ div >
284- </ div >
285- </ FormControlWrapper >
286- </ CustomDialogContentText >
247+ { selectedResource ?. visibility !== 'published' && (
248+ < >
249+ < CustomListItemText >
250+ < Typography variant = "h6" > General Access</ Typography >
251+ </ CustomListItemText >
252+ < CustomDialogContentText >
253+ < FormControlWrapper size = "small" >
254+ < div style = { { display : 'flex' , justifyContent : 'start' , alignItems : 'center' } } >
255+ < VisibilityIconWrapper >
256+ { selectedOption === SHARE_MODE . PUBLIC ? (
257+ < PublicIcon
258+ width = { 24 }
259+ height = { 24 }
260+ stroke = { theme . palette . mode === 'dark' ? WHITE : BLACK }
261+ />
262+ ) : (
263+ < LockIcon
264+ width = { 24 }
265+ height = { 24 }
266+ stroke = { theme . palette . mode === 'dark' ? WHITE : BLACK }
267+ />
268+ ) }
269+ </ VisibilityIconWrapper >
270+ < div style = { { display : 'flex' , flexDirection : 'column' } } >
271+ < CustomSelect
272+ variant = "outlined"
273+ defaultValue = { selectedOption }
274+ labelId = "share-menu-select"
275+ id = "share-menu"
276+ open = { openMenu }
277+ onClose = { handleMenuClose }
278+ onOpen = { ( ) => setMenu ( true ) }
279+ onChange = { handleOptionClick }
280+ disabled = { isVisibilitySelectorDisabled }
281+ >
282+ { Object . values ( SHARE_MODE ) . map ( ( option ) => (
283+ < MenuItem
284+ key = { option }
285+ selected = { option === selectedOption }
286+ value = { option }
287+ >
288+ { option . charAt ( 0 ) . toUpperCase ( ) + option . slice ( 1 ) }
289+ </ MenuItem >
290+ ) ) }
291+ </ CustomSelect >
292+ < Typography component = "span" variant = "body2" >
293+ { selectedOption === SHARE_MODE . PRIVATE ? options . PRIVATE : options . PUBLIC }
294+ </ Typography >
295+ </ div >
296+ </ div >
297+ </ FormControlWrapper >
298+ </ CustomDialogContentText >
299+ </ >
300+ ) }
287301 </ ModalBody >
288302
289303 < ModalFooter
0 commit comments