From 28c8946324438c76db10e935760b1435a1c4ccb1 Mon Sep 17 00:00:00 2001 From: Jari Kolehmainen Date: Tue, 26 Jan 2021 18:04:33 +0200 Subject: [PATCH] workspace edit fixes Signed-off-by: Jari Kolehmainen --- src/renderer/components/+workspaces/edit-workspace.tsx | 7 ++++--- src/renderer/components/+workspaces/workspaces.tsx | 6 +++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/renderer/components/+workspaces/edit-workspace.tsx b/src/renderer/components/+workspaces/edit-workspace.tsx index 0e9dce01f4..3ab4b44d5a 100644 --- a/src/renderer/components/+workspaces/edit-workspace.tsx +++ b/src/renderer/components/+workspaces/edit-workspace.tsx @@ -1,6 +1,6 @@ import React from "react"; import { observer } from "mobx-react"; -import { workspaceStore } from "../../../common/workspace-store"; +import { WorkspaceStore, workspaceStore } from "../../../common/workspace-store"; import { commandRegistry } from "../../../extensions/registries/command-registry"; import { Input, InputValidator } from "../input"; import { CommandOverlay } from "../command-palette/command-container"; @@ -75,7 +75,8 @@ export class EditWorkspace extends React.Component<{}, EditWorkspaceState> { commandRegistry.add({ id: "workspace.editCurrentWorkspace", - title: "Workspace: Edit current workspace...", + title: "Workspace: Edit current workspace ...", scope: "global", - action: () => CommandOverlay.open() + action: () => CommandOverlay.open(), + isActive: (context) => context.workspace?.id !== WorkspaceStore.defaultId }); diff --git a/src/renderer/components/+workspaces/workspaces.tsx b/src/renderer/components/+workspaces/workspaces.tsx index 4f3e3a7d4b..7ece5f6a8f 100644 --- a/src/renderer/components/+workspaces/workspaces.tsx +++ b/src/renderer/components/+workspaces/workspaces.tsx @@ -1,7 +1,7 @@ import React from "react"; import { observer } from "mobx-react"; import { computed} from "mobx"; -import { workspaceStore } from "../../../common/workspace-store"; +import { WorkspaceStore, workspaceStore } from "../../../common/workspace-store"; import { commandRegistry } from "../../../extensions/registries/command-registry"; import { Select } from "../select"; import { navigate } from "../../navigation"; @@ -25,6 +25,10 @@ export class ChooseWorkspace extends React.Component { if (options.length > 1) { options.push({ value: ChooseWorkspace.removeActionId, label: "Remove workspace ..." }); + + if (workspaceStore.currentWorkspace.id !== WorkspaceStore.defaultId) { + options.push({ value: ChooseWorkspace.editActionId, label: "Edit current workspace ..." }); + } } return options;