Skip to content

Commit

Permalink
fix: added linux about dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
sr258 committed Apr 10, 2022
1 parent 913b0af commit a39f4ae
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 18 deletions.
2 changes: 1 addition & 1 deletion server/src/boot/updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let updating: boolean = false;

const t = i18next.getFixedT(null, 'lumi');

const loadPlatformInformation = (): {
export const loadPlatformInformation = (): {
package: string;
platform: string;
supportsUpdates: 'no' | 'external' | 'yes';
Expand Down
2 changes: 1 addition & 1 deletion server/src/menu/analyticsMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ export default (window: electron.BrowserWindow, websocket: SocketIO.Server) => [
editMenu(),
...viewMenu(),
...windowMenu(),
helpMenu(window, websocket)
helpMenu(window)
];
2 changes: 1 addition & 1 deletion server/src/menu/h5peditorMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,5 @@ export default (
editMenu(),
...viewMenu(),
...windowMenu(),
helpMenu(window, websocket)
helpMenu(window)
].filter((m) => m !== undefined);
23 changes: 16 additions & 7 deletions server/src/menu/helpMenu.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import electron from 'electron';
import SocketIO from 'socket.io';
import electron, { dialog } from 'electron';
import i18next from 'i18next';
import { loadPlatformInformation } from '../boot/updater';

export default function (
window: electron.BrowserWindow,
websocket: SocketIO.Server
): any {
export default function (window: electron.BrowserWindow): any {
return {
label: i18next.t('lumi:menu.help.label'),
submenu: [
Expand Down Expand Up @@ -45,7 +42,19 @@ export default function (
);
}
},
{ label: i18next.t('lumi:menu.help.about'), role: 'about' }
process.platform === 'linux'
? {
label: i18next.t('lumi:menu.help.about'),
click: () => {
const platformInfo = loadPlatformInformation();
dialog.showMessageBox(window, {
message: `Lumi v${electron.app.getVersion()} - ${
platformInfo?.package ?? 'unknown package'
}\n(C) 2022 Lumi Education GbR Jan Philip Schellenberg und Sebastian Rettig\nAGPL 3.0 License`
});
}
}
: { label: i18next.t('lumi:menu.help.about'), role: 'about' }
]
};
}
6 changes: 2 additions & 4 deletions server/src/menu/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ export default function menuFactory(
case '/':
default:
electron.Menu.setApplicationMenu(
electron.Menu.buildFromTemplate(
launchpadMenu(window, webSocket)
)
electron.Menu.buildFromTemplate(launchpadMenu(window))
);
break;

Expand All @@ -43,7 +41,7 @@ export default function menuFactory(

case '/run':
electron.Menu.setApplicationMenu(
electron.Menu.buildFromTemplate(runMenu(window, webSocket))
electron.Menu.buildFromTemplate(runMenu(window))
);
break;

Expand Down
4 changes: 2 additions & 2 deletions server/src/menu/launchpadMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import helpMenu from './helpMenu';
import windowMenu from './windowMenu';
import viewMenu from './viewMenu';

export default (window: electron.BrowserWindow, websocket: SocketIO.Server) => [
export default (window: electron.BrowserWindow) => [
...macMenu(),
editMenu(),
...viewMenu(),
...windowMenu(),
helpMenu(window, websocket)
helpMenu(window)
];
4 changes: 2 additions & 2 deletions server/src/menu/runMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import editMenu from './editMenu';

import helpMenu from './helpMenu';

export default (window: electron.BrowserWindow, websocket: SocketIO.Server) => [
export default (window: electron.BrowserWindow) => [
editMenu(),
helpMenu(window, websocket)
helpMenu(window)
];

0 comments on commit a39f4ae

Please sign in to comment.