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

Commit

Permalink
fix: temporarily disable not working menu items (#449)
Browse files Browse the repository at this point in the history
  • Loading branch information
sentialx authored Apr 26, 2020
1 parent fe8f54d commit b78c8a1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
24 changes: 18 additions & 6 deletions src/renderer/views/menu/components/QuickMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { WEBUI_BASE_URL, WEBUI_URL_SUFFIX } from '~/constants/files';
import { Switch } from '~/renderer/components/Switch';
import {
ICON_FIRE,
ICON_NIGHT,
ICON_TOPMOST,
ICON_TAB,
ICON_WINDOW,
Expand Down Expand Up @@ -64,14 +63,22 @@ const onIncognitoClick = () => {
ipcRenderer.send('create-window', true);
};

const goToWebUIPage = (name: string) => () => {
const addNewTab = (url: string) => {
ipcRenderer.send(`add-tab-${store.windowId}`, {
url: `${WEBUI_BASE_URL}${name}${WEBUI_URL_SUFFIX}`,
url,
active: true,
});
store.hide();
};

const goToWebUIPage = (name: string) => () => {
addNewTab(`${WEBUI_BASE_URL}${name}${WEBUI_URL_SUFFIX}`);
};

const goToURL = (url: string) => () => {
addNewTab(url);
};

const onUpdateClick = () => {
ipcRenderer.send('install-update');
};
Expand Down Expand Up @@ -127,7 +134,7 @@ export const QuickMenu = observer(() => {
<Icon icon={ICON_BOOKMARKS} />
<MenuItemTitle>Bookmarks</MenuItemTitle>
</MenuItem>
<MenuItem onClick={goToWebUIPage('downloads')}>
<MenuItem disabled onClick={goToWebUIPage('downloads')}>
<Icon icon={ICON_DOWNLOAD} />
<MenuItemTitle>Downloads</MenuItemTitle>
</MenuItem>
Expand All @@ -136,12 +143,17 @@ export const QuickMenu = observer(() => {
<Icon icon={ICON_SETTINGS} />
<MenuItemTitle>Settings</MenuItemTitle>
</MenuItem>
<MenuItem onClick={goToWebUIPage('extensions')}>
{/* TODO: <MenuItem onClick={goToWebUIPage('extensions')}> */}
<MenuItem
onClick={goToURL(
'https://chrome.google.com/webstore/category/extensions',
)}
>
<Icon icon={ICON_EXTENSIONS} />
<MenuItemTitle>Extensions</MenuItemTitle>
</MenuItem>
<Line />
<MenuItem>
<MenuItem disabled>
<Icon icon={ICON_FIND} />
<MenuItemTitle>Find in page</MenuItemTitle>
<Shortcut>Ctrl+F</Shortcut>
Expand Down
8 changes: 7 additions & 1 deletion src/renderer/views/menu/components/QuickMenu/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const MenuItem = styled.div`
padding: 0 12px;
font-size: 12px;
${({ arrow }: { arrow?: boolean }) =>
${({ arrow }: { arrow?: boolean; disabled?: boolean }) =>
arrow &&
css`
&:after {
Expand All @@ -40,6 +40,12 @@ export const MenuItem = styled.div`
}
`};
${({ disabled }: { arrow?: boolean; disabled?: boolean }) =>
css`
pointer-events: ${disabled ? 'none' : 'inherit'};
opacity: ${disabled ? 0.54 : 1};
`};
&:hover {
${({ theme }: { theme?: ITheme }) => css`
background-color: ${theme['dialog.lightForeground']
Expand Down

0 comments on commit b78c8a1

Please sign in to comment.