added splash loading screen

This commit is contained in:
2025-12-18 16:42:56 +01:00
parent d54b0bcdef
commit 41dddef354
2 changed files with 260 additions and 8 deletions

229
desktop/loading.html Normal file
View File

@@ -0,0 +1,229 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Waifuboard</title>
<style>
:root {
--color-bg: #09090b;
--color-primary: #8b5cf6;
--color-text: #ffffff;
--color-text-dim: #a1a1aa;
}
* {
box-sizing: border-box;
user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
}
body {
margin: 0;
background: linear-gradient(135deg, #18181b 0%, var(--color-bg) 100%);
color: var(--color-text);
font-family: 'Inter', system-ui, -apple-system, sans-serif;
display: flex;
align-items: center;
justify-content: center;
width: 400px;
height: 300px;
overflow: hidden;
position: relative;
border-radius: 16px;
-webkit-app-region: drag;
}
body::before {
content: "";
position: absolute;
inset: 0;
border-radius: 16px;
box-shadow: 0 0 0 1px rgba(255,255,255,0.05),
0 20px 40px rgba(0,0,0,0.6);
pointer-events: none;
}
img {
-webkit-user-drag: none;
user-drag: none;
}
.bg-particle {
position: absolute;
background: var(--color-primary);
border-radius: 50%;
opacity: 0;
animation: particleFloat 8s ease-in-out infinite;
}
.bg-particle:nth-child(1) {
width: 4px;
height: 4px;
top: 20%;
left: 10%;
animation-delay: 0s;
}
.bg-particle:nth-child(2) {
width: 6px;
height: 6px;
top: 60%;
left: 80%;
animation-delay: 2s;
}
.bg-particle:nth-child(3) {
width: 3px;
height: 3px;
top: 40%;
left: 20%;
animation-delay: 4s;
}
.bg-particle:nth-child(4) {
width: 5px;
height: 5px;
top: 70%;
left: 70%;
animation-delay: 1s;
}
.splash-container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 28px;
width: 100%;
animation: fadeIn 0.5s ease-out;
}
.brand-container {
display: flex;
flex-direction: column;
align-items: center;
gap: 10px;
}
.brand-container.horizontal {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
gap: 14px;
width: 100%;
}
.brand-icon {
width: 50px;
height: 50px;
object-fit: contain;
animation: iconPulse 2s ease-in-out infinite;
}
.brand-name {
font-size: 25px;
font-weight: 700;
letter-spacing: -0.02em;
margin: 0;
padding: 0;
color: #ffffff;
line-height: 1;
display: flex;
align-items: center;
}
.spinner-wrapper {
display: flex;
flex-direction: column;
align-items: center;
gap: 10px;
}
.spinner {
width: 44px;
height: 44px;
border: 5px solid rgba(139, 92, 246, 0.2);
border-top: 5px solid var(--color-primary);
border-radius: 50%;
animation: spin 1s linear infinite;
}
.loading-text {
font-size: 12px;
color: #a1a1aa;
text-transform: uppercase;
letter-spacing: 0.1em;
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes iconPulse {
0%, 100% {
transform: scale(1);
filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.4));
}
50% {
transform: scale(1.05);
filter: drop-shadow(0 0 16px rgba(139, 92, 246, 0.6));
}
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
@keyframes particleFloat {
0% {
opacity: 0;
transform: translateY(0) scale(0);
}
25% {
opacity: 0.3;
}
50% {
opacity: 0.6;
transform: translateY(-100px) scale(1);
}
75% {
opacity: 0.3;
}
100% {
opacity: 0;
transform: translateY(-200px) scale(0);
}
}
</style>
</head>
<body>
<div class="bg-particle"></div>
<div class="bg-particle"></div>
<div class="bg-particle"></div>
<div class="bg-particle"></div>
<div class="splash-container">
<div class="brand-container horizontal">
<img src="public/assets/waifuboards.ico" alt="Waifuboard Logo" class="brand-icon">
<h1 class="brand-name">Waifuboard</h1>
</div>
<div class="spinner-wrapper">
<div class="spinner"></div>
<span class="loading-text">Loading</span>
</div>
</div>
</body>
</html>

View File

@@ -3,6 +3,9 @@ const { fork } = require('child_process');
const path = require('path');
const log = require('electron-log');
const sessionId = new Date().toISOString().replace(/[:.]/g, '-');
log.transports.file.resolvePath = () => path.join(app.getPath('userData'), 'logs', `${sessionId}.log`);
log.transports.file.level = 'info';
log.format = '[{y}-{m}-{d} {h}:{i}:{s}.{ms}] [{level}] {text}';
@@ -61,6 +64,23 @@ function startBackend() {
});
}
let splash;
function createSplash() {
splash = new BrowserWindow({
width: 400,
height: 300,
frame: false,
transparent: false,
alwaysOnTop: true,
resizable: false,
hasShadow: false,
backgroundColor: '#00000000'
});
splash.loadFile('loading.html');
}
function createWindow() {
win = new BrowserWindow({
width: 1200,
@@ -75,6 +95,7 @@ function createWindow() {
});
win.setMenu(null);
win.maximize();
win.loadURL('http://localhost:54322');
@@ -98,15 +119,17 @@ process.on('uncaughtException', (err) => {
});
app.whenReady().then(async () => {
log.info('--- Application Started ---');
console.log("Logs location:", log.transports.file.getFile().path);
startBackend();
createSplash();
try {
await waitForServer(54322);
createWindow();
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow();
});
splash.close();
} catch (e) {
splash.close();
log.error(e);
app.quit();
}
});
app.on('window-all-closed', () => {