Browse Source
Merge pull request #112 from loeck/master
Fix listing i18n in DevToolbar, prevent app-finish-rendering event
master
Meriadec Pillet
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
11 additions and
9 deletions
-
src/components/DevToolbar.js
-
src/main/app.js
-
src/main/menu.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> |
|
|
|
|
|
@ -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 |
|
|
|
|
|
@ -46,7 +46,7 @@ const template = [ |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ type: 'separator' }, |
|
|
|
...props(process.platform === 'darwin', [{ type: 'separator' }], []), |
|
|
|
], |
|
|
|
[], |
|
|
|
), |
|
|
|