Skip to content

Commit 5c79b20

Browse files
committed
[dashboard]: only display delete button if not preparing
1 parent 447dd3b commit 5c79b20

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

components/dashboard/src/workspaces/WorkspaceEntry.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ export function WorkspaceEntry({ desc, model, isAdmin, stopWorkspace }: Props) {
5858
href: downloadURL
5959
});
6060
if (!isAdmin) {
61+
// Workspaces can only be deleted if not preparing
62+
const canDelete = state !== 'preparing';
63+
6164
menuEntries.push(
6265
{
6366
title: 'Share',
@@ -69,19 +72,22 @@ export function WorkspaceEntry({ desc, model, isAdmin, stopWorkspace }: Props) {
6972
{
7073
title: 'Pin',
7174
active: !!ws.pinned,
72-
separator: true,
75+
separator: canDelete,
7376
onClick: () => {
7477
model.togglePinned(ws.id);
7578
}
7679
},
77-
{
80+
);
81+
82+
if (canDelete) {
83+
menuEntries.push({
7884
title: 'Delete',
7985
customFontStyle: 'text-red-600 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300',
8086
onClick: () => {
8187
setModalVisible(true);
8288
}
83-
}
84-
);
89+
});
90+
}
8591
}
8692
const project = getProject(ws);
8793

0 commit comments

Comments
 (0)