Skip to content

Commit

Permalink
Add splash screen before starting backend finished (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
michelu89 authored Jun 13, 2024
1 parent 550857c commit 48c0539
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 1 deletion.
25 changes: 24 additions & 1 deletion core/electron-libs/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const processes = [];
* @type BrowserWindow
*/
let mainWindow = null;
let splashWindow = null;

async function cleanUpProcesses() {
for (const process of processes) {
Expand All @@ -49,9 +50,14 @@ async function cleanUpProcesses() {
}

function startService() {
createSplashWindow();

if (inDevMode()) {
global.backendPort = 9091;
windowsManager.createWindow();
setTimeout(function () {
splashWindow.close();
windowsManager.createWindow();
}, 1000);
return;
}

Expand All @@ -70,6 +76,7 @@ function startService() {
process.stdout.on('data', data => {
if (data.includes(`Tomcat started on port(s): ${port}`)) {
console.log(`Tomcat is now started on port ${port}`);
splashWindow.close();
windowsManager.createWindow();
}
});
Expand All @@ -93,6 +100,22 @@ function startService() {
});
}

function createSplashWindow() {
splashWindow = new BrowserWindow({
width: 800,
height: 600,
frame: false,
alwaysOnTop: true,
transparent: true,
});

const splashScreenPath = inDevMode()
? path.join('.', 'electron-libs', 'loading-screen')
: path.join(__dirname, '..', '..', '..', 'loading-screen');

splashWindow.loadFile(`${splashScreenPath}${path.sep}splash.html`).catch(() => console.log('Splash screen not found.'));
}

module.exports = {
mainWindow,
cleanUpProcesses,
Expand Down
74 changes: 74 additions & 0 deletions core/electron-libs/loading-screen/splash.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<!--
~ Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH
~
~ See the AUTHORS file(s) distributed with this work for
~ additional information regarding authorship.
~
~ This Source Code Form is subject to the terms of the Mozilla Public
~ License, v. 2.0. If a copy of the MPL was not distributed with this
~ file, You can obtain one at https://mozilla.org/MPL/2.0/.
~
~ SPDX-License-Identifier: MPL-2.0
-->

<!doctype html>
<html>
<head>
<title>Loading...</title>
<style>
body {
background-color: #f9f9f9;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
font-family: Arial, sans-serif;
flex-direction: column;
}

.loader {
border: 16px solid #f3f3f3;
border-radius: 50%;
border-top: 16px solid #3498db;
width: 50px;
height: 50px;
animation: spin 2s linear infinite;
}

.text {
margin-top: 20px;
margin-bottom: 50px;
font-size: 20px;
display: flex;
align-items: center;
}

.text img {
width: 50px;
height: 50px;
margin-left: 10px;
margin-right: 10px;
}

@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
</head>
<body>
<p class="text">
<img
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsSAAALEgHS3X78AAAAB3RJTUUH5gcGCi0Jz+O2bgAAE01JREFUeNrt3WtvG1d+BvDnf4YXkZQi0VonkuPEcaxc3I3hdr2NiyJA0naLLRrsLrIN0G1fxAsUeRHE36NfIF/AQFH4RWGgL4JNigZxDKONnHqTQHEc5WIqkS9SbEkUdSHFmTmnL6iRaWp4kTzkiDrPDxjwIpk6Oub/OWfODEcAEREREREREREREREREREREREREREREREREfUFibsB9Y4ePRp3E4j2jEKh0PWfEVsAsNiJdifKYOhpAOyg6PfUzISox0wn3xRFECTi/k3BYidq1KwmOgqGKH5QpJqM/NLhc0Q2M508t9vZQFcLrsWUv9PiZyCQbUybx02f300IdKXA2hW+Ugr37t3D8vKy1P0iEva9RPuUAMDg4CCGh4eRTqdhjAHaB0BHAdFpGPRqDaC+mMXzPDz55JPI5/MyMjKiEokElFIiInBdV4wx8H0fnucJAIgItNbwfZ+hQH1Paw3P87CxsWGq1apZW1tDtVqFiAD3C7p+YGw1C2j19bYiLaiQkX/r9bPZLK5duwazGXM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c/crUXAZkHQSKO2rxPMChpnDQwA2k/aLWA1O6lnN6f+drRYFkkBtdkVqL/fuCsg2F78jSEQ9rpE+0HYVL3dLKGT0X9bEIRN/4HoZwBho3/j36iqTzdV1/DGAKjfdQgLAqJ+1+xz/WEBEHbbUfG30qtdgPoQ0Lj/MWRd9zWpez5sEbD+lmg/aHcRj2ZB0K74Oz5WHllBNTksWP849JThkA0hjyNtK9Ee1C4Amj3fduRvNv0HIi6qXYRA/f2w0Z4BQDbo5HJeps3Xtr1eq8IPdPNvAzaeIWhafL1+DaB+t6HZ5wyI9oNmh+zCAqHZiT0PdVXgbv9x0LDzA8IWBevXAdDwb5o9JtovOg2CTp7bka4UVcOuQLOfJTu8T2SDTou+2WMAnU3/gS4XWEgQtBvV27WHgUD7jdnh15oGQKdFX68nBdVBEHTaHgYA7TednB3Y9rndFD/Q/TWATn6pVguFnXQGkS0if//3dERtsjYQe7uI9qC2xb7bUb9ebIXWQRgwBMhWLYs/isIP7Kki28EMgWjfi7LQm+GVN4mIiIiIiIjs8P+SVJY7O2dqiAAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMi0wNy0wNlQxMDo0NDo1MCswMDowMFe+cTcAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjItMDctMDZUMTA6NDQ6NTArMDA6MDAm48mLAAAAAElFTkSuQmCC"
alt="Aspect Model Editor Icon"
/>
Loading Aspect Model Editor...
</p>
<div class="loader"></div>
</body>
</html>
21 changes: 21 additions & 0 deletions core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@
"filter": [
"**/*"
]
},
{
"from": "./electron-libs/loading-screen/",
"to": "loading-screen/",
"filter": [
"**/*"
]
}
]
},
Expand Down Expand Up @@ -69,6 +76,13 @@
"filter": [
"**/*"
]
},
{
"from": "./electron-libs/loading-screen/",
"to": "loading-screen/",
"filter": [
"**/*"
]
}
]
},
Expand Down Expand Up @@ -101,6 +115,13 @@
"filter": [
"**/*"
]
},
{
"from": "./electron-libs/loading-screen/",
"to": "loading-screen/",
"filter": [
"**/*"
]
}
]
},
Expand Down

0 comments on commit 48c0539

Please sign in to comment.