v0.1.0-pre.044
This commit is contained in:
BIN
kb-app-demo-desktop/frontend/fonts/DOS_Amazigh.ttf
Normal file
BIN
kb-app-demo-desktop/frontend/fonts/DOS_Amazigh.ttf
Normal file
Binary file not shown.
BIN
kb-app-demo-desktop/frontend/imgs/logo.png
Normal file
BIN
kb-app-demo-desktop/frontend/imgs/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.6 KiB |
BIN
kb-app-demo-desktop/frontend/imgs/splash.png
Normal file
BIN
kb-app-demo-desktop/frontend/imgs/splash.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 611 KiB |
18
kb-app-demo-desktop/frontend/main.html
Normal file
18
kb-app-demo-desktop/frontend/main.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<!-- file: kb-app-demo-desktop/frontend/main.html -->
|
||||
<!-- version: 1 -->
|
||||
<!doctype html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Khadhroony Bot3</title>
|
||||
<style>body{font-family:sans-serif;margin:0;background:#111827;color:#f9fafb}main{max-width:900px;margin:8rem auto;padding:2rem}code{color:#93c5fd}</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<h1>Khadhroony Bot3</h1>
|
||||
<p>La fenêtre splash de <code>kb-app-demo-desktop</code> est migrée.</p>
|
||||
<p>La fenêtre principale sera complétée dans la prochaine tranche.</p>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
8
kb-app-demo-desktop/frontend/sass/splash.scss
Normal file
8
kb-app-demo-desktop/frontend/sass/splash.scss
Normal file
@@ -0,0 +1,8 @@
|
||||
/* file: kb-app-demo-desktop/frontend/sass/splash.scss */
|
||||
/* version: 1 */
|
||||
html, body { width: 100%; height: 100%; margin: 0; background: transparent; overflow: hidden; }
|
||||
body { display: grid; place-items: center; font-family: sans-serif; }
|
||||
#splash-container { width: 100%; height: 100%; display: grid; place-content: center; justify-items: center; gap: 1rem; opacity: 0; background: radial-gradient(circle, #1f2937, #030712); color: #f9fafb; }
|
||||
#splash-container img { width: min(55vw, 420px); max-height: 55vh; object-fit: contain; }
|
||||
#splash-container h1 { margin: 0; letter-spacing: .08em; }
|
||||
#messages-container { min-height: 1.5rem; color: #d1d5db; }
|
||||
19
kb-app-demo-desktop/frontend/splash.html
Normal file
19
kb-app-demo-desktop/frontend/splash.html
Normal file
@@ -0,0 +1,19 @@
|
||||
<!-- file: kb-app-demo-desktop/frontend/splash.html -->
|
||||
<!-- version: 1 -->
|
||||
<!doctype html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Chargement — Khadhroony Bot3</title>
|
||||
<link rel="stylesheet" href="sass/splash.scss" />
|
||||
</head>
|
||||
<body>
|
||||
<main id="splash-container">
|
||||
<img src="imgs/splash.png" alt="Khadhroony Bot3" />
|
||||
<h1>Khadhroony Bot3</h1>
|
||||
<div id="messages-container" aria-live="polite"></div>
|
||||
</main>
|
||||
<script type="module" src="ts/splash.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
40
kb-app-demo-desktop/frontend/ts/splash.ts
Normal file
40
kb-app-demo-desktop/frontend/ts/splash.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
// file: kb-app-demo-desktop/frontend/ts/splash.ts
|
||||
// version: 1
|
||||
|
||||
import { listen } from "@tauri-apps/api/event";
|
||||
|
||||
type SplashOrder = {
|
||||
order: string;
|
||||
msg: string | null;
|
||||
status: string | null;
|
||||
duration_ms: number | null;
|
||||
};
|
||||
|
||||
const container = document.querySelector<HTMLElement>("#splash-container");
|
||||
const messages = document.querySelector<HTMLElement>("#messages-container");
|
||||
|
||||
function duration(order: SplashOrder): number {
|
||||
if (typeof order.duration_ms !== "number" || !Number.isFinite(order.duration_ms) || order.duration_ms <= 0) {
|
||||
return 500;
|
||||
}
|
||||
return order.duration_ms;
|
||||
}
|
||||
|
||||
async function applyOrder(order: SplashOrder): Promise<void> {
|
||||
if (!container) {
|
||||
return;
|
||||
}
|
||||
if (order.order === "add_msg" && messages && order.msg) {
|
||||
messages.textContent = order.msg;
|
||||
messages.dataset.status = order.status ?? "info";
|
||||
return;
|
||||
}
|
||||
if (order.order === "fadein" || order.order === "fadeout") {
|
||||
container.style.transition = `opacity ${duration(order)}ms ease-in-out`;
|
||||
container.style.opacity = order.order === "fadein" ? "1" : "0";
|
||||
}
|
||||
}
|
||||
|
||||
void listen<SplashOrder>("splash", event => {
|
||||
void applyOrder(event.payload);
|
||||
});
|
||||
Reference in New Issue
Block a user