Skip to content
This repository was archived by the owner on Apr 29, 2022. It is now read-only.

Commit 3c2da1c

Browse files
authored
Improve user interface on Linux & Windows (#157)
1 parent bd21f70 commit 3c2da1c

File tree

8 files changed

+123
-85
lines changed

8 files changed

+123
-85
lines changed

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@
3434
"menubar": "8.0.2"
3535
},
3636
"devDependencies": {
37-
"@material-ui/core": "4.9.12",
37+
"@material-ui/core": "4.9.13",
3838
"@material-ui/icons": "4.9.1",
3939
"babel-cli": "6.26.0",
4040
"babel-preset-env": "1.7.0",
4141
"babel-preset-react": "6.24.1",
42-
"blueimp-md5": "2.13.0",
42+
"blueimp-md5": "2.15.0",
4343
"chai": "4.2.0",
4444
"classnames": "2.2.6",
4545
"concurrently": "5.2.0",
@@ -73,9 +73,9 @@
7373
"redux": "4.0.5",
7474
"redux-thunk": "2.3.0",
7575
"tongwen-core": "3.2.3",
76-
"transliteration": "2.1.8",
76+
"transliteration": "2.1.9",
7777
"typeface-roboto": "0.0.75",
78-
"wait-on": "4.0.2"
78+
"wait-on": "5.0.0"
7979
},
8080
"homepage": "./",
8181
"private": true,

public/electron.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ if (!gotTheLock) {
133133
},
134134
{ type: 'separator' },
135135
{
136-
label: getLocale('Quit'),
136+
label: getLocale('quit'),
137137
click: () => {
138138
mb.app.quit();
139139
},

public/libs/create-menu.js

+33-29
Original file line numberDiff line numberDiff line change
@@ -182,37 +182,41 @@ const createMenu = () => {
182182
];
183183
} else {
184184
// File menu for Windows & Linux
185+
const submenu = [
186+
{
187+
label: getLocale('about'),
188+
click: () => sendToAllWindows('open-dialog-about'),
189+
},
190+
{
191+
type: 'separator',
192+
},
193+
{
194+
label: getLocale('preferencesMenuItem'),
195+
accelerator: 'CmdOrCtrl+,',
196+
click: () => sendToAllWindows('go-to-preferences'),
197+
},
198+
{ type: 'separator' },
199+
{ role: 'quit', label: getLocale('quit') },
200+
];
201+
if (updaterEnabled) {
202+
submenu.splice(1, 0, {
203+
type: 'separator',
204+
});
205+
submenu.splice(2, 0, {
206+
label: getLocale('checkForUpdates'),
207+
click: () => {
208+
prepareUpdaterForAppImage(autoUpdater);
209+
global.updateSilent = false;
210+
autoUpdater.checkForUpdates();
211+
},
212+
});
213+
submenu.splice(3, 0, {
214+
type: 'separator',
215+
});
216+
}
185217
template.unshift({
186218
label: getLocale('file'),
187-
submenu: [
188-
{
189-
label: getLocale('about'),
190-
click: () => sendToAllWindows('open-dialog-about'),
191-
},
192-
{
193-
type: 'separator',
194-
visible: updaterEnabled,
195-
},
196-
{
197-
label: getLocale('checkForUpdates'),
198-
click: () => {
199-
prepareUpdaterForAppImage(autoUpdater);
200-
global.updateSilent = false;
201-
autoUpdater.checkForUpdates();
202-
},
203-
visible: updaterEnabled,
204-
},
205-
{
206-
type: 'separator',
207-
},
208-
{
209-
label: getLocale('preferencesMenuItem'),
210-
accelerator: 'CmdOrCtrl+,',
211-
click: () => sendToAllWindows('go-to-preferences'),
212-
},
213-
{ type: 'separator' },
214-
{ role: 'quit', label: getLocale('quit') },
215-
],
219+
submenu,
216220
});
217221
}
218222

src/components/pages/home/index.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,10 @@ const styles = (theme) => ({
159159
marginRight: 12,
160160
},
161161
appBarColorDefault: {
162-
background: theme.palette.type === 'dark' ? theme.palette.grey[900] : theme.palette.primary.main,
163-
color: theme.palette.type === 'dark' ? theme.palette.getContrastText(theme.palette.grey[900]) : theme.palette.primary.contrastText,
162+
// eslint-disable-next-line no-nested-ternary
163+
background: theme.palette.type === 'dark' ? theme.palette.grey[900] : (window.process.platform === 'darwin' ? theme.palette.primary.main : null),
164+
// eslint-disable-next-line no-nested-ternary
165+
color: theme.palette.type === 'dark' ? theme.palette.getContrastText(theme.palette.grey[900]) : (window.process.platform === 'darwin' ? theme.palette.primary.contrastText : null),
164166
},
165167
translateButtonLabel: {
166168
fontWeight: 500,
@@ -178,6 +180,8 @@ const styles = (theme) => ({
178180
},
179181
toolbar: {
180182
minHeight: 40,
183+
paddingRight: theme.spacing(1.5),
184+
paddingLeft: theme.spacing(1.5),
181185
},
182186
toolbarIconButton: {
183187
padding: theme.spacing(1),

src/components/pages/language-list/index.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,17 @@ const styles = (theme) => ({
2929
flexGrow: 1,
3030
},
3131
appBarColorDefault: {
32-
background: theme.palette.type === 'dark' ? theme.palette.grey[900] : theme.palette.primary.main,
33-
color: theme.palette.type === 'dark' ? theme.palette.getContrastText(theme.palette.grey[900]) : theme.palette.primary.contrastText,
32+
// eslint-disable-next-line no-nested-ternary
33+
background: theme.palette.type === 'dark' ? theme.palette.grey[900] : (window.process.platform === 'darwin' ? theme.palette.primary.main : null),
34+
// eslint-disable-next-line no-nested-ternary
35+
color: theme.palette.type === 'dark' ? theme.palette.getContrastText(theme.palette.grey[900]) : (window.process.platform === 'darwin' ? theme.palette.primary.contrastText : null),
3436
WebkitAppRegion: 'drag',
3537
WebkitUserSelect: 'none',
3638
},
3739
toolbar: {
3840
minHeight: 40,
41+
paddingRight: theme.spacing(1.5),
42+
paddingLeft: theme.spacing(1.5),
3943
},
4044
toolbarIconButton: {
4145
padding: theme.spacing(1),

src/components/pages/phrasebook/index.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ const styles = (theme) => ({
7171
},
7272
toolbar: {
7373
minHeight: 40,
74+
paddingRight: theme.spacing(1.5),
75+
paddingLeft: theme.spacing(1.5),
7476
},
7577
});
7678

@@ -110,11 +112,13 @@ class Phrasebook extends React.Component {
110112

111113
return (
112114
<div className={classes.container}>
113-
<AppBar position="static" color="default" elevation={0} classes={{ colorDefault: classes.appBarColorDefault }}>
114-
<Toolbar variant="dense" className={classes.toolbar}>
115-
<Typography variant="subtitle1" color="inherit" className={classes.title}>{getLocale('phrasebook')}</Typography>
116-
</Toolbar>
117-
</AppBar>
115+
{window.process.platform === 'darwin' && window.mode !== 'menubar' && (
116+
<AppBar position="static" color="default" elevation={0} classes={{ colorDefault: classes.appBarColorDefault }}>
117+
<Toolbar variant="dense" className={classes.toolbar}>
118+
<Typography variant="subtitle1" color="inherit" className={classes.title}>{getLocale('phrasebook')}</Typography>
119+
</Toolbar>
120+
</AppBar>
121+
)}
118122
<SearchBox />
119123
{(() => {
120124
if (phrasebookItems.length < 1 && phrasebookLoading === false) {

src/components/pages/preferences/index.js

+10-8
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ const styles = (theme) => ({
8686
},
8787
toolbar: {
8888
minHeight: 40,
89+
paddingRight: theme.spacing(1.5),
90+
paddingLeft: theme.spacing(1.5),
8991
},
9092
logo: {
9193
height: 28,
@@ -126,11 +128,13 @@ const Preferences = (props) => {
126128
return (
127129
<div className={classes.container}>
128130
<DialogShortcut />
129-
<AppBar position="static" color="default" elevation={1} classes={{ colorDefault: classes.appBarColorDefault }}>
130-
<Toolbar variant="dense" className={classes.toolbar}>
131-
<Typography variant="subtitle1" color="inherit" className={classes.title}>{getLocale('preferences')}</Typography>
132-
</Toolbar>
133-
</AppBar>
131+
{window.process.platform === 'darwin' && window.mode !== 'menubar' && (
132+
<AppBar position="static" color="default" elevation={1} classes={{ colorDefault: classes.appBarColorDefault }}>
133+
<Toolbar variant="dense" className={classes.toolbar}>
134+
<Typography variant="subtitle1" color="inherit" className={classes.title}>{getLocale('preferences')}</Typography>
135+
</Toolbar>
136+
</AppBar>
137+
)}
134138
<div className={classes.innerContainer}>
135139
<Typography variant="body2" className={classes.paperTitle}>
136140
{getLocale('general')}
@@ -146,9 +150,7 @@ const Preferences = (props) => {
146150
</ListItem>
147151
)}
148152
>
149-
{window.process.platform === 'darwin' && (
150-
<MenuItem dense onClick={() => requestSetPreference('themeSource', 'system')}>{getLocale('system')}</MenuItem>
151-
)}
153+
<MenuItem dense onClick={() => requestSetPreference('themeSource', 'system')}>{getLocale('system')}</MenuItem>
152154
<MenuItem dense onClick={() => requestSetPreference('themeSource', 'light')}>{getLocale('light')}</MenuItem>
153155
<MenuItem dense onClick={() => requestSetPreference('themeSource', 'dark')}>{getLocale('dark')}</MenuItem>
154156
</EnhancedMenu>

0 commit comments

Comments
 (0)