Skip to content

Commit 86f2ba8

Browse files
[UI] Hide workspace actions for non-permitted users
Signed-off-by: Rajesh-Nagarajan-11 <rajeshnagarajan36@gmail.com>
1 parent 85bcade commit 86f2ba8

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

src/custom/Workspaces/WorkspaceCard.tsx

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -341,24 +341,22 @@ const CardBack = ({
341341
recentActivities,
342342
updatedDate,
343343
createdDate,
344-
deleted,
345344
isDeleteWorkspaceAllowed,
346345
isEditWorkspaceAllowed
347346
}: CardBackProps) => {
348347
const isWorkspaceSelected = selectedWorkspaces?.includes(workspaceId);
349-
const isEditButtonDisabled = isWorkspaceSelected ? true : !isEditWorkspaceAllowed;
350-
const isDeleteButtonDisabled = isWorkspaceSelected ? true : !isDeleteWorkspaceAllowed;
351348

352349
const theme = useTheme();
353350
return (
354351
<CardBackWrapper elevation={2} onClick={onFlipBack}>
355352
<CardBackTopGrid size={12}>
356353
<CardBackTitleGrid size={6}>
357-
<BulkSelectCheckbox
358-
onClick={(e) => e.stopPropagation()}
359-
onChange={onSelect}
360-
disabled={deleted ? true : !isDeleteWorkspaceAllowed}
361-
/>
354+
{isDeleteWorkspaceAllowed && (
355+
<BulkSelectCheckbox
356+
onClick={(e) => e.stopPropagation()}
357+
onChange={onSelect}
358+
/>
359+
)}
362360
<CardTitle
363361
sx={{ color: theme.palette.background.constant?.white }}
364362
variant="body2"
@@ -368,18 +366,20 @@ const CardBack = ({
368366
</CardTitle>
369367
</CardBackTitleGrid>
370368
<CardBackActionsGrid size={6}>
371-
<L5EditIcon
372-
onClick={onEdit}
373-
disabled={isEditButtonDisabled}
374-
style={{ fill: theme.palette.background.constant?.white }}
375-
bulk={true}
376-
/>
377-
<L5DeleteIcon
378-
onClick={onDelete}
379-
style={{ fill: theme.palette.background.constant?.white }}
380-
disabled={isDeleteButtonDisabled}
381-
bulk={true}
382-
/>
369+
{!isWorkspaceSelected && isEditWorkspaceAllowed && (
370+
<L5EditIcon
371+
onClick={onEdit}
372+
style={{ fill: theme.palette.background.constant?.white }}
373+
bulk={true}
374+
/>
375+
)}
376+
{!isWorkspaceSelected && isDeleteWorkspaceAllowed && (
377+
<L5DeleteIcon
378+
onClick={onDelete}
379+
style={{ fill: theme.palette.background.constant?.white }}
380+
bulk={true}
381+
/>
382+
)}
383383
</CardBackActionsGrid>
384384
</CardBackTopGrid>
385385
<Grid2 sx={{ display: 'flex', alignItems: 'center', flexDirection: 'row' }}>

0 commit comments

Comments
 (0)