Skip to content
This repository was archived by the owner on Jun 4, 2023. It is now read-only.

Commit b78c8a1

Browse files
authored
fix: temporarily disable not working menu items (#449)
1 parent fe8f54d commit b78c8a1

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

src/renderer/views/menu/components/QuickMenu/index.tsx

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import { WEBUI_BASE_URL, WEBUI_URL_SUFFIX } from '~/constants/files';
1717
import { Switch } from '~/renderer/components/Switch';
1818
import {
1919
ICON_FIRE,
20-
ICON_NIGHT,
2120
ICON_TOPMOST,
2221
ICON_TAB,
2322
ICON_WINDOW,
@@ -64,14 +63,22 @@ const onIncognitoClick = () => {
6463
ipcRenderer.send('create-window', true);
6564
};
6665

67-
const goToWebUIPage = (name: string) => () => {
66+
const addNewTab = (url: string) => {
6867
ipcRenderer.send(`add-tab-${store.windowId}`, {
69-
url: `${WEBUI_BASE_URL}${name}${WEBUI_URL_SUFFIX}`,
68+
url,
7069
active: true,
7170
});
7271
store.hide();
7372
};
7473

74+
const goToWebUIPage = (name: string) => () => {
75+
addNewTab(`${WEBUI_BASE_URL}${name}${WEBUI_URL_SUFFIX}`);
76+
};
77+
78+
const goToURL = (url: string) => () => {
79+
addNewTab(url);
80+
};
81+
7582
const onUpdateClick = () => {
7683
ipcRenderer.send('install-update');
7784
};
@@ -127,7 +134,7 @@ export const QuickMenu = observer(() => {
127134
<Icon icon={ICON_BOOKMARKS} />
128135
<MenuItemTitle>Bookmarks</MenuItemTitle>
129136
</MenuItem>
130-
<MenuItem onClick={goToWebUIPage('downloads')}>
137+
<MenuItem disabled onClick={goToWebUIPage('downloads')}>
131138
<Icon icon={ICON_DOWNLOAD} />
132139
<MenuItemTitle>Downloads</MenuItemTitle>
133140
</MenuItem>
@@ -136,12 +143,17 @@ export const QuickMenu = observer(() => {
136143
<Icon icon={ICON_SETTINGS} />
137144
<MenuItemTitle>Settings</MenuItemTitle>
138145
</MenuItem>
139-
<MenuItem onClick={goToWebUIPage('extensions')}>
146+
{/* TODO: <MenuItem onClick={goToWebUIPage('extensions')}> */}
147+
<MenuItem
148+
onClick={goToURL(
149+
'https://chrome.google.com/webstore/category/extensions',
150+
)}
151+
>
140152
<Icon icon={ICON_EXTENSIONS} />
141153
<MenuItemTitle>Extensions</MenuItemTitle>
142154
</MenuItem>
143155
<Line />
144-
<MenuItem>
156+
<MenuItem disabled>
145157
<Icon icon={ICON_FIND} />
146158
<MenuItemTitle>Find in page</MenuItemTitle>
147159
<Shortcut>Ctrl+F</Shortcut>

src/renderer/views/menu/components/QuickMenu/style.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const MenuItem = styled.div`
2222
padding: 0 12px;
2323
font-size: 12px;
2424
25-
${({ arrow }: { arrow?: boolean }) =>
25+
${({ arrow }: { arrow?: boolean; disabled?: boolean }) =>
2626
arrow &&
2727
css`
2828
&:after {
@@ -40,6 +40,12 @@ export const MenuItem = styled.div`
4040
}
4141
`};
4242
43+
${({ disabled }: { arrow?: boolean; disabled?: boolean }) =>
44+
css`
45+
pointer-events: ${disabled ? 'none' : 'inherit'};
46+
opacity: ${disabled ? 0.54 : 1};
47+
`};
48+
4349
&:hover {
4450
${({ theme }: { theme?: ITheme }) => css`
4551
background-color: ${theme['dialog.lightForeground']

0 commit comments

Comments
 (0)