adjust menu and add about page
This commit is contained in:
parent
e4b721115f
commit
9b2b852c40
4 changed files with 90 additions and 8 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB |
88
main.js
88
main.js
|
|
@ -1,7 +1,8 @@
|
|||
'use strict'
|
||||
|
||||
// Import parts of electron to use
|
||||
const { app, BrowserWindow, dialog, ipcMain } = require('electron')
|
||||
const { app, BrowserWindow, dialog, ipcMain, Menu} = require('electron')
|
||||
const openAboutWindow = require('about-window').default
|
||||
const path = require('path')
|
||||
const url = require('url')
|
||||
|
||||
|
|
@ -39,6 +40,83 @@ if (process.platform === 'win32') {
|
|||
}
|
||||
}
|
||||
|
||||
// Build main menu from file.
|
||||
let mainMenu = Menu.buildFromTemplate(
|
||||
[
|
||||
// { role: 'fileMenu' }
|
||||
{
|
||||
label: 'Datei',
|
||||
submenu: [
|
||||
{
|
||||
label: 'Beenden',
|
||||
role: 'quit'
|
||||
}
|
||||
]
|
||||
},
|
||||
// { role: 'viewMenu' }
|
||||
{
|
||||
label: 'Ansicht',
|
||||
submenu: [
|
||||
{
|
||||
label: 'Neu laden',
|
||||
role: 'reload'
|
||||
},
|
||||
{
|
||||
label: 'Erzwinge Neustart',
|
||||
role: 'forceReload'
|
||||
},
|
||||
{type: 'separator'},
|
||||
{
|
||||
label: 'Zoom zurücksetzen',
|
||||
role: 'resetZoom'
|
||||
},
|
||||
{
|
||||
label: 'Hineinzoomen',
|
||||
role: 'zoomIn',
|
||||
accelerator: 'Ctrl+=',
|
||||
},
|
||||
{
|
||||
label: 'Herauszoomen',
|
||||
role: 'zoomOut',
|
||||
accelerator: 'Ctrl+-',
|
||||
},
|
||||
{type: 'separator'},
|
||||
]
|
||||
},
|
||||
// { role: 'windowMenu' }
|
||||
{
|
||||
label: 'Fenster',
|
||||
submenu: [
|
||||
{
|
||||
label: 'Minimieren',
|
||||
role: 'minimize'
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Hilfe',
|
||||
role: 'help',
|
||||
submenu: [
|
||||
{
|
||||
label: 'Über Marvin',
|
||||
click: () => {
|
||||
openAboutWindow({
|
||||
icon_path: path.join(__dirname, 'marvin.ico'),
|
||||
bug_report_url:'mailto:r.nasarek@gnm.de',
|
||||
bug_link_text: 'Einen Fehler melden',
|
||||
license: 'MIT',
|
||||
description: 'App zur Dokumentverwaltung im IKK am Germanischen Nationalmuseum.',
|
||||
win_options: {title: 'Über Marvin'}
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
|
||||
function createWindow() {
|
||||
// Create the browser window.
|
||||
mainWindow = new BrowserWindow({
|
||||
|
|
@ -56,7 +134,10 @@ function createWindow() {
|
|||
// and load the index.html of the app.
|
||||
let indexPath
|
||||
|
||||
|
||||
// Server Options
|
||||
if (dev && process.argv.indexOf('--noDevServer') === -1) {
|
||||
// Ether from devServer
|
||||
indexPath = url.format({
|
||||
protocol: 'http:',
|
||||
host: 'localhost:8080',
|
||||
|
|
@ -64,6 +145,7 @@ function createWindow() {
|
|||
slashes: true
|
||||
})
|
||||
} else {
|
||||
// Or build file
|
||||
indexPath = url.format({
|
||||
protocol: 'file:',
|
||||
pathname: path.join(__dirname, 'dist', 'index.html'),
|
||||
|
|
@ -71,8 +153,12 @@ function createWindow() {
|
|||
})
|
||||
}
|
||||
|
||||
// Load base html
|
||||
mainWindow.loadURL(indexPath)
|
||||
|
||||
// Load menu
|
||||
Menu.setApplicationMenu(mainMenu)
|
||||
|
||||
// Don't show until we are ready and loaded
|
||||
mainWindow.once('ready-to-show', () => {
|
||||
mainWindow.show()
|
||||
|
|
|
|||
|
|
@ -34,17 +34,15 @@
|
|||
"start": "cross-env NODE_ENV=development webpack serve --hot --host 0.0.0.0 --config=./webpack.dev.config.js --mode development",
|
||||
"build": "cross-env NODE_ENV=production webpack --config webpack.build.config.js --mode production",
|
||||
"package": "npm run build",
|
||||
"postpackage": "electron-packager ./ --out=./builds --overwrite --platform win32,linux --icon marvin.ico --extra-resource 'resources/files'"
|
||||
"postpackage": "electron-packager ./ --ignore 'resources/files' --out=./builds --asar --overwrite --platform win32,linux --icon marvin.ico --extra-resource 'resources/files'"
|
||||
},
|
||||
"dependencies": {
|
||||
"@emotion/react": "^11.10.0",
|
||||
"@emotion/styled": "^11.10.0",
|
||||
"@mui/icons-material": "^5.10.2",
|
||||
"@mui/material": "^5.10.2",
|
||||
"about-window": "^1.15.2",
|
||||
"docx-templates": "^4.9.2",
|
||||
"fast-xml-parser": "^4.0.9",
|
||||
"file-saver": "^2.0.5",
|
||||
"node-fetch": "^3.2.10",
|
||||
"postcss": "^8.4.16",
|
||||
"react": "^18.2.0",
|
||||
"react-async-devtools": "^10.0.1",
|
||||
|
|
@ -52,8 +50,6 @@
|
|||
"react-loader-spinner": "^5.3.3",
|
||||
"react-router-dom": "^6.3.0",
|
||||
"replace-special-characters": "^1.2.6",
|
||||
"write-json-file": "^5.0.0",
|
||||
"xml-parse-from-string": "^1.0.1",
|
||||
"xml2js": "^0.4.23"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
"rootDir": "/home/rbrt/Schreibtisch/marvin/Gm312/leihgabenbegleitblaetter"
|
||||
"rootDir": "/home/rbrt/WebstormProjects/marvin"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue