mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-18 05:34:09 +00:00
add splash screen
This commit is contained in:
@@ -0,0 +1,24 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
|
||||||
|
<!-- TODO: ADD CSP -->
|
||||||
|
<title>ontime</title>
|
||||||
|
</head>
|
||||||
|
<body style="background-color: #0003">
|
||||||
|
<div style="margin-top: 10vh; display: grid; place-items: center">
|
||||||
|
<img src="../../assets/images/logosbwa/LOGO-192.png" />
|
||||||
|
<h1
|
||||||
|
style="
|
||||||
|
font-family: Roboto, sans-serif;
|
||||||
|
font-weight: 100;
|
||||||
|
color: #fffffa;
|
||||||
|
font-size: 24px;
|
||||||
|
"
|
||||||
|
>
|
||||||
|
ontime - event timers
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
+25
-9
@@ -11,9 +11,11 @@ const { electron } = require('process');
|
|||||||
|
|
||||||
var env = process.env.NODE_ENV || 'prod';
|
var env = process.env.NODE_ENV || 'prod';
|
||||||
|
|
||||||
const { nodeapp } = import(
|
(async () => {
|
||||||
path.join('file:///', __dirname, env == 'prod' ? '../' : '', 'src/app.js')
|
const { nodeapp } = import(
|
||||||
);
|
path.join('file:///', __dirname, env == 'prod' ? '../' : '', 'src/app.js')
|
||||||
|
);
|
||||||
|
})();
|
||||||
|
|
||||||
// Load Icons
|
// Load Icons
|
||||||
// TODO: Icons appear pixelated
|
// TODO: Icons appear pixelated
|
||||||
@@ -41,10 +43,22 @@ function showNotification(text) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let win;
|
let win;
|
||||||
|
let splash;
|
||||||
let tray = null;
|
let tray = null;
|
||||||
let loaded = false;
|
let loaded = false;
|
||||||
|
|
||||||
function createWindow() {
|
function createWindow() {
|
||||||
|
// create a new `splash`-Window
|
||||||
|
splash = new BrowserWindow({
|
||||||
|
width: 333,
|
||||||
|
height: 333,
|
||||||
|
transparent: true,
|
||||||
|
resizable: false,
|
||||||
|
frame: false,
|
||||||
|
alwaysOnTop: true,
|
||||||
|
});
|
||||||
|
splash.loadURL(`file://${__dirname}/electron/splash/splash.html`);
|
||||||
|
|
||||||
win = new BrowserWindow({
|
win = new BrowserWindow({
|
||||||
width: 1920,
|
width: 1920,
|
||||||
height: 1080,
|
height: 1080,
|
||||||
@@ -54,6 +68,7 @@ function createWindow() {
|
|||||||
maxHeight: 1440,
|
maxHeight: 1440,
|
||||||
backgroundColor: '#202020',
|
backgroundColor: '#202020',
|
||||||
icon: appIcon,
|
icon: appIcon,
|
||||||
|
show: false,
|
||||||
textAreasAreResizable: false,
|
textAreasAreResizable: false,
|
||||||
enableWebSQL: false,
|
enableWebSQL: false,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
@@ -111,14 +126,14 @@ app
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Hide on minimise
|
win.once('ready-to-show', () => {
|
||||||
win.on('minimize', function (event) {
|
setTimeout(() => {
|
||||||
event.preventDefault();
|
win.show();
|
||||||
showNotification('App running in background');
|
splash.destroy();
|
||||||
win.hide();
|
}, 2000);
|
||||||
});
|
});
|
||||||
|
|
||||||
//Hide on close
|
// Hide on close
|
||||||
win.on('close', function (event) {
|
win.on('close', function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
showNotification('App running in background');
|
showNotification('App running in background');
|
||||||
@@ -149,6 +164,7 @@ app
|
|||||||
const trayContextMenu = Menu.buildFromTemplate(trayMenuTemplate);
|
const trayContextMenu = Menu.buildFromTemplate(trayMenuTemplate);
|
||||||
|
|
||||||
tray.setContextMenu(trayContextMenu);
|
tray.setContextMenu(trayContextMenu);
|
||||||
|
// TODO: get IP Address
|
||||||
tray.setToolTip('ontime running on http://localhost:4001/');
|
tray.setToolTip('ontime running on http://localhost:4001/');
|
||||||
})
|
})
|
||||||
.then(() => showNotification(loaded));
|
.then(() => showNotification(loaded));
|
||||||
|
|||||||
Reference in New Issue
Block a user