ADD: Styled splash screen
This commit is contained in:
53
loading.html
53
loading.html
@@ -2,24 +2,61 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="icon" href="/src/assets/favicon.png">
|
||||
<link rel="icon" href="src/assets/favicon.png">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>ZERO/ONE Starting...</title>
|
||||
<link rel="stylesheet" href="src/assets/main.css">
|
||||
<style>
|
||||
body {
|
||||
background: black;
|
||||
background: black url(src/assets/images/splashBG.png) center;
|
||||
background-size: cover;
|
||||
color: white;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.badge {
|
||||
background: #f79c1e;
|
||||
color: black;
|
||||
display: inline-block;
|
||||
align-self: center;
|
||||
width: fit-content;
|
||||
border-radius: 4px;
|
||||
padding: 4px 8px;
|
||||
}
|
||||
|
||||
.title {
|
||||
margin-top: 10vh;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.status {
|
||||
margin-top: 10vh;
|
||||
}
|
||||
|
||||
.footer {
|
||||
font-size: 0.5rem;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<h1 style="font-family: 'Comic Sans MS', sans-serif">LOADING</h1>
|
||||
<div class="flex h-full flex-col text-center justify-between items-center p-2 px-8 select-none">
|
||||
<div class="title flex flex-col gap-2">
|
||||
<h1 class="text-5xl">ZERO<span class="opacity-70">/</span>ONE</h1>
|
||||
<p class="text-muted-foreground">Configuration Suite v0.1</p>
|
||||
<div class="badge text-xs">PUBLIC BETA</div>
|
||||
<div class="status">
|
||||
<p>Stand by...</p>
|
||||
<p class="text-muted-foreground text-sm">The goblins are turning the cogs.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer flex flex-col gap-2 text-muted-foreground">
|
||||
<img class="w-3 self-center" src="/src/assets/icons/binarisEmblem.svg" alt="binaris-logo">
|
||||
<p>Copyright 2024 Binaris Circuitry Ltd.</p>
|
||||
<p>This software is licensed under the Apache License, Version 2.0 (the "License"). Usage of this
|
||||
software is
|
||||
permitted only in compliance with the terms of the License.</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
31
src/main.js
31
src/main.js
@@ -14,23 +14,25 @@ if (ess) {
|
||||
const isDevelopment = process.env.NODE_ENV !== 'production'
|
||||
|
||||
// Minimum time to show the splash screen, in milliseconds
|
||||
const splashTime = isDevelopment ? 500 : 3000
|
||||
const splashTime = isDevelopment ? 40000 : 40000
|
||||
const loadingWindowWidth = 800 / 2
|
||||
const loadingWindowHeight = 1100 / 2
|
||||
|
||||
const zoomFactor = 1
|
||||
const width = 1111
|
||||
const height = 666
|
||||
const mainWindowWidth = 1111
|
||||
const mainWindowHeight = 666
|
||||
|
||||
const createMainWindow = () => {
|
||||
// Create the browser window.
|
||||
const mainWindow = new BrowserWindow({
|
||||
show: false,
|
||||
width: width,
|
||||
height: height,
|
||||
width: mainWindowWidth,
|
||||
height: mainWindowHeight,
|
||||
titleBarStyle: 'hidden',
|
||||
trafficLightPosition: { x: 10, y: 10 },
|
||||
resizable: true,
|
||||
minWidth: width / 3,
|
||||
minHeight: height / 3,
|
||||
minWidth: mainWindowWidth / 3,
|
||||
minHeight: mainWindowHeight / 3,
|
||||
maximizable: true,
|
||||
fullscreenable: false,
|
||||
center: true,
|
||||
@@ -43,12 +45,12 @@ const createMainWindow = () => {
|
||||
},
|
||||
})
|
||||
|
||||
mainWindow.setAspectRatio(width / height)
|
||||
mainWindow.setAspectRatio(mainWindowWidth / mainWindowHeight)
|
||||
mainWindow.webContents.on('dom-ready', () => {
|
||||
mainWindow.webContents.setZoomFactor(zoomFactor)
|
||||
})
|
||||
mainWindow.on('resize', () => {
|
||||
mainWindow.webContents.setZoomFactor(zoomFactor * mainWindow.getSize()[0] / width)
|
||||
mainWindow.webContents.setZoomFactor(zoomFactor * mainWindow.getSize()[0] / mainWindowWidth)
|
||||
})
|
||||
mainWindow.on('maximize', () => {
|
||||
mainWindow.webContents.send('electron:maximized')
|
||||
@@ -70,9 +72,9 @@ const createMainWindow = () => {
|
||||
const createLoadingWindow = (mainWindow) => {
|
||||
const loadingWindow = new BrowserWindow({
|
||||
show: false,
|
||||
width: 400,
|
||||
height: 600,
|
||||
resizable: false,
|
||||
width: loadingWindowWidth,
|
||||
height: loadingWindowHeight,
|
||||
resizable: true,
|
||||
fullscreenable: false,
|
||||
maximizable: false,
|
||||
transparent: true,
|
||||
@@ -84,12 +86,11 @@ const createLoadingWindow = (mainWindow) => {
|
||||
},
|
||||
})
|
||||
const startTime = Date.now()
|
||||
let loading = true
|
||||
let loadingTimeout
|
||||
loadingWindow.once('show', () => {
|
||||
mainWindow.webContents.once('did-finish-load', () => {
|
||||
return
|
||||
loadingTimeout = setTimeout(() => {
|
||||
loading = false
|
||||
mainWindow.show()
|
||||
mainWindow.focus()
|
||||
loadingWindow.close()
|
||||
@@ -97,7 +98,7 @@ const createLoadingWindow = (mainWindow) => {
|
||||
})
|
||||
})
|
||||
loadingWindow.once('closed', () => {
|
||||
if (loading) {
|
||||
if (!mainWindow.isVisible()) {
|
||||
clearTimeout(loadingTimeout)
|
||||
mainWindow.close()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user