Skip to content

Commit 92e5a14

Browse files
committed
add menu template to be displayed
1 parent 5fdf48e commit 92e5a14

File tree

3 files changed

+66
-2
lines changed

3 files changed

+66
-2
lines changed

packages/flowtest-electron/electron-main.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
// Modules to control application life and create native browser window
2-
const { app, BrowserWindow } = require('electron');
2+
const { app, BrowserWindow, Menu } = require('electron');
33
const path = require('path');
44
const url = require('url');
5+
const template = require('./electron-menu');
56
const Watcher = require('./src/app/watcher');
67
const registerRendererEventHandlers = require('./src/ipc/collection');
78

89
let mainWindow;
910
let watcher;
1011

1112
app.on('ready', async () => {
13+
const menu = Menu.buildFromTemplate(template);
14+
Menu.setApplicationMenu(menu);
15+
1216
// Create the browser window.
1317
mainWindow = new BrowserWindow({
1418
width: 1280,
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
const { shell } = require('electron');
2+
3+
const template = [
4+
{
5+
label: 'FlowTestAI',
6+
submenu: [
7+
{ type: 'separator' },
8+
{
9+
role: 'quit',
10+
label: 'Exit FlowTestAI',
11+
},
12+
],
13+
},
14+
{
15+
label: 'Edit',
16+
submenu: [
17+
{ role: 'undo' },
18+
{ role: 'redo' },
19+
{ type: 'separator' },
20+
{ role: 'cut' },
21+
{ role: 'copy' },
22+
{ role: 'paste' },
23+
{ role: 'selectAll' },
24+
{ type: 'separator' },
25+
{ role: 'hide' },
26+
{ role: 'hideOthers' },
27+
],
28+
},
29+
{
30+
label: 'View',
31+
submenu: [
32+
{ role: 'toggledevtools' },
33+
{ type: 'separator' },
34+
{ role: 'resetzoom' },
35+
{ role: 'zoomin' },
36+
{ role: 'zoomout' },
37+
{ type: 'separator' },
38+
{ role: 'togglefullscreen' },
39+
],
40+
},
41+
{
42+
role: 'window',
43+
submenu: [{ role: 'minimize' }, { role: 'close', accelerator: 'CommandOrControl+Shift+Q' }],
44+
},
45+
{
46+
role: 'help',
47+
label: 'Help',
48+
submenu: [
49+
{
50+
label: 'About',
51+
click: async () => {
52+
await shell.openExternal('https://github.com/FlowTestAI/FlowTest');
53+
},
54+
},
55+
],
56+
},
57+
];
58+
59+
module.exports = template;

packages/flowtest-electron/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"name": "flowtest-electron",
2+
"name": "flowtestai",
3+
"productName": "FlowTestAI",
34
"version": "1.0.0",
45
"homepage": "https://github.com/FlowTestAI/FlowTest/tree/main",
56
"description": "OpenSource IDE for designing API powered flows",

0 commit comments

Comments
 (0)