Browse Source

Fix listing i18n in DevToolbar, prevent app-finish-rendering event

master
Loëck Vézien 7 years ago
parent
commit
1f172c43c1
No known key found for this signature in database GPG Key ID: CBCDCE384E853AC4
  1. 8
      src/components/DevToolbar.js
  2. 10
      src/main/app.js
  3. 2
      src/main/menu.js

8
src/components/DevToolbar.js

@ -15,6 +15,8 @@ import sortBy from 'lodash/fp/sortBy'
import chunk from 'lodash/chunk'
import styled from 'styled-components'
import color from 'color'
import fs from 'fs'
import path from 'path'
import Box from 'components/base/Box'
import Bar from 'components/base/Bar'
@ -23,6 +25,9 @@ import { ChartWrapper } from 'components/base/Chart'
import theme from 'styles/theme'
const getLanguages = p => fs.readdirSync(p).filter(f => fs.statSync(path.join(p, f)).isDirectory())
const languages = getLanguages(path.join(__static, './i18n'))
const mainWindow = remote.BrowserWindow.getAllWindows().find(w => w.name === 'MainWindow')
type HslColor = {
@ -149,14 +154,13 @@ class DevToolbar extends PureComponent<any, State> {
}
render() {
const { i18n } = this.props
const { cpuUsage } = this.state
return (
<Container>
<Box grow flow={4}>
<Section title="Languages" horizontal>
{Object.keys(i18n.store.data).map(lang => (
{languages.map(lang => (
<Item key={lang} onClick={this.handleChangeLanguage(lang)} style={{ flex: 0 }}>
{lang}
</Item>

10
src/main/app.js

@ -85,6 +85,7 @@ function createMainWindow() {
titleBarStyle: 'hiddenInset',
}
: {}),
autoHideMenuBar: true,
height,
minHeight: MIN_HEIGHT,
minWidth: MIN_WIDTH,
@ -152,6 +153,7 @@ function createDevWindow() {
saveWindowSettings(window)
window.loadURL(`${url}/#/dev`)
window.setMenu(null)
window.on('close', handleCloseWindow(window))
@ -243,16 +245,12 @@ app.on('ready', async () => {
await installExtensions()
}
if (process.platform === 'darwin') {
Menu.setApplicationMenu(menu)
} else {
Menu.setApplicationMenu(null)
}
Menu.setApplicationMenu(menu)
preloadWindow = createPreloadWindow()
})
ipcMain.on('app-finish-rendering', () => {
ipcMain.once('app-finish-rendering', () => {
if (preloadWindow !== null) {
preloadWindow.destroy()
preloadWindow = null

2
src/main/menu.js

@ -46,7 +46,7 @@ const template = [
}
},
},
{ type: 'separator' },
...props(process.platform === 'darwin', [{ type: 'separator' }], []),
],
[],
),

Loading…
Cancel
Save