Display the renderer type in the About dialog (#3441)

* Now displaying the renderer type in the About dialog

* Show the number of renderers per type in the About dialog

* Use values instead of entries (key is unused)

Co-Authored-By: onecamp <juancampa@gmail.com>
This commit is contained in:
onecamp 2019-01-24 18:46:39 -05:00 committed by GitHub
parent 0dc8fb9ed4
commit 8733ecc84a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 1 deletions

View file

@ -13,6 +13,7 @@ const helpMenu = require('./menus/help');
const darwinMenu = require('./menus/darwin');
const {getDecoratedKeymaps} = require('../plugins');
const {execCommand} = require('../commands');
const {getRendererTypes} = require('../utils/renderer-utils');
const appName = app.getName();
const appVersion = app.getVersion();
@ -39,10 +40,18 @@ exports.createMenu = (createWindow, getLoadedPluginVersions) => {
const pluginList =
loadedPlugins.length === 0 ? 'none' : loadedPlugins.map(plugin => `\n ${plugin.name} (${plugin.version})`);
const rendererCounts = Object.values(getRendererTypes()).reduce((acc, type) => {
acc[type] = acc[type] ? acc[type] + 1 : 1;
return acc;
}, {});
const renderers = Object.entries(rendererCounts)
.map(([type, count]) => type + (count > 1 ? ` (${count})` : ''))
.join(', ');
dialog.showMessageBox({
title: `About ${appName}`,
message: `${appName} ${appVersion} (${updateChannel})`,
detail: `Plugins: ${pluginList}\n\nCreated by Guillermo Rauch\nCopyright © 2018 ZEIT, Inc.`,
detail: `Renderers: ${renderers}\nPlugins: ${pluginList}\n\nCreated by Guillermo Rauch\nCopyright © 2018 ZEIT, Inc.`,
buttons: [],
icon
});