feat(ui): aggiunge guida utente e menu Help > Documentazione
This commit is contained in:
23
main.js
23
main.js
@@ -1,4 +1,4 @@
|
||||
const { app, BrowserWindow, dialog, ipcMain, shell } = require('electron');
|
||||
const { app, BrowserWindow, dialog, ipcMain, shell, Menu } = require('electron');
|
||||
const path = require('path');
|
||||
const fs = require('fs-extra');
|
||||
|
||||
@@ -13,7 +13,7 @@ const {
|
||||
} = require('./services/unrouted');
|
||||
|
||||
const CAD_EXTENSIONS = ['prt', 'asm', 'dwr'];
|
||||
const DEFAULT_DESTINATION = './output/cad';
|
||||
const DEFAULT_DESTINATION = 'X:\\';
|
||||
const SETTINGS_FILENAME = 'cad-router-settings.json';
|
||||
const LINUX_RUNTIME_DIR = '.cadroute';
|
||||
|
||||
@@ -79,6 +79,25 @@ function createWindow() {
|
||||
win.loadFile(path.join(__dirname, 'renderer', 'index.html'));
|
||||
}
|
||||
|
||||
function createDocsWindow() {
|
||||
const docs = new BrowserWindow({
|
||||
width: 900,
|
||||
height: 700,
|
||||
title: 'CadRoute — Documentazione',
|
||||
icon: path.join(__dirname, 'build', 'icon.png'),
|
||||
webPreferences: { contextIsolation: true, nodeIntegration: false },
|
||||
});
|
||||
docs.loadFile(path.join(__dirname, 'renderer', 'docs', 'index.html'));
|
||||
docs.setMenuBarVisibility(false);
|
||||
}
|
||||
|
||||
Menu.setApplicationMenu(Menu.buildFromTemplate([
|
||||
{
|
||||
label: 'Help',
|
||||
submenu: [{ label: 'Documentazione', click: () => createDocsWindow() }],
|
||||
},
|
||||
]));
|
||||
|
||||
app.whenReady().then(async () => {
|
||||
await ensureRuntimeDirectory();
|
||||
const persistedDestination = await loadPersistedDestination();
|
||||
|
||||
Reference in New Issue
Block a user