-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: dynamically enable menu options #2621
Conversation
@@ -176,6 +243,8 @@ export async function createMenu(mainWindow: BrowserWindow): Promise<Menu> { | |||
); | |||
} | |||
}, | |||
id: MENU_ITEMS.projectStatistics.id, | |||
enabled: false, | |||
}, | |||
{ | |||
icon: getIconBasedOnTheme( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was not sure about this option: 'Set Path to Sources'. Disabled it as well?
src/ElectronBackend/main/menu.ts
Outdated
|
||
type Item = { label: string; id: string }; | ||
|
||
const MENU_ITEMS: Record<(typeof INITIALLY_DISABLED_MENU_ITEMS)[number], Item> = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i find that calling this MENU_ITEMS
is misleading, since this is only the disabled menu items.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I will come up with something else.
d31767d
to
2be9cac
Compare
Signed-off-by: alexzurbonsen <alexander.zur.bonsen@tngtech.com>
2be9cac
to
dbe5b62
Compare
Summary of changes
This PR deactivates some menu options initially and activates them once a file is opened.
Ideally, I wanted to disable the entire
Edit
menu, but that does not come with nice UX. Instead I disabled individual options. The ones that come with a role, likecut
andcopy
cannot be disabled in the same way. I left them as is.I would have also liked to disable the
Export
submenu in theFile
menu. But if I do that I can't enable it in the same way as individual items. As an easy solution I just disabled the submenu items instead.Context and reason for change
Closes #2411
How can the changes be tested
Manually check that options are disabled and will be enabled once a file is opened.