feat(splashscreen): implement a splash screen for application startup

This commit introduces a splash screen that enhances the user experience during application startup. It includes a new HTML file for the splash screen layout and a corresponding icon. The main application logic has been updated to close the splash screen once the main application is ready.

- Added a splash screen HTML and icon for improved visual feedback
- Updated main application logic to manage splash screen visibility
- Enhanced title bar branding with an image instead of SVG
This commit is contained in:
Christoph Brandau
2026-07-08 15:16:51 +02:00
parent 61a22987ba
commit cc179e9eef
7 changed files with 330 additions and 23 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 253 KiB

+276
View File
@@ -0,0 +1,276 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>GitLite</title>
<style>
:root {
color-scheme: dark;
--ink: #f3f5ff;
--muted: #9aa3c5;
--purple: #9b70ff;
--orange: #ff6d26;
--panel: rgba(15, 18, 31, 0.9);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* {
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
background: #050712;
}
body {
display: grid;
place-items: center;
background:
radial-gradient(circle at 50% 38%, rgba(137, 92, 255, 0.22), transparent 36%),
linear-gradient(135deg, #050712 0%, #080b16 48%, #140b18 100%);
}
.grid {
position: fixed;
inset: 0;
opacity: 0.28;
background-image:
linear-gradient(rgba(151, 118, 255, 0.12) 1px, transparent 1px),
linear-gradient(90deg, rgba(255, 109, 38, 0.08) 1px, transparent 1px);
background-size: 42px 42px;
mask-image: radial-gradient(circle at center, black 0%, transparent 70%);
animation: grid-drift 10s linear infinite;
}
.splash {
position: relative;
display: grid;
justify-items: center;
gap: 16px;
width: 100vw;
height: 100vh;
align-content: center;
padding: 32px;
border: 0;
border-radius: 0;
background:
linear-gradient(180deg, rgba(23, 26, 43, 0.92), rgba(12, 15, 27, 0.94)),
var(--panel);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
overflow: hidden;
}
.splash::before {
content: "";
position: absolute;
inset: 0;
background: linear-gradient(110deg, transparent 0%, rgba(160, 124, 255, 0.12) 48%, transparent 54%);
transform: translateX(-100%);
animation: card-scan 2.8s ease-in-out infinite;
}
.mark {
position: relative;
display: grid;
place-items: center;
width: 174px;
height: 174px;
isolation: isolate;
}
.halo {
position: absolute;
inset: 10px;
border: 1px solid rgba(151, 118, 255, 0.25);
border-radius: 36px;
transform: rotate(45deg);
animation: halo-breathe 2.4s ease-in-out infinite;
}
.halo.secondary {
inset: 25px;
border-color: rgba(255, 109, 38, 0.28);
animation-direction: reverse;
}
.traces {
position: absolute;
inset: -18px;
width: 210px;
height: 210px;
overflow: visible;
}
.trace {
fill: none;
stroke-width: 3;
stroke-linecap: round;
stroke-dasharray: 165;
stroke-dashoffset: 165;
filter: drop-shadow(0 0 8px rgba(151, 118, 255, 0.55));
animation: trace-draw 2.6s ease-in-out infinite;
}
.trace.main {
stroke: var(--purple);
}
.trace.branch {
stroke: var(--orange);
animation-delay: 0.28s;
}
.trace.base {
stroke: rgba(255, 255, 255, 0.42);
stroke-dasharray: 128;
stroke-dashoffset: 128;
animation-delay: 0.55s;
}
.icon {
position: relative;
z-index: 1;
width: 136px;
height: 136px;
object-fit: contain;
filter:
drop-shadow(0 18px 24px rgba(0, 0, 0, 0.55))
drop-shadow(0 0 18px rgba(151, 118, 255, 0.3));
animation: icon-float 2.4s ease-in-out infinite;
}
.sheen {
position: absolute;
z-index: 2;
width: 112px;
height: 172px;
border-radius: 50%;
background: linear-gradient(90deg, transparent 8%, rgba(255, 255, 255, 0.18), transparent 72%);
mix-blend-mode: screen;
transform: translateX(-98px) rotate(16deg);
animation: icon-sheen 2.8s ease-in-out infinite;
}
.copy {
position: relative;
display: grid;
gap: 4px;
justify-items: center;
text-align: center;
}
.copy strong {
color: var(--ink);
font-size: 22px;
font-weight: 900;
line-height: 1;
}
.copy span {
color: var(--muted);
font-size: 12.5px;
font-weight: 700;
}
.bar {
position: relative;
width: 230px;
height: 4px;
margin-top: 2px;
overflow: hidden;
border-radius: 999px;
background: rgba(151, 118, 255, 0.14);
}
.bar span {
position: absolute;
inset: 0;
width: 46%;
border-radius: inherit;
background: linear-gradient(90deg, transparent, var(--purple) 40%, var(--orange) 74%, transparent);
box-shadow: 0 0 16px rgba(255, 109, 38, 0.32);
animation: bar-slide 1.35s ease-in-out infinite;
}
@keyframes grid-drift {
to { transform: translate3d(42px, 42px, 0); }
}
@keyframes card-scan {
0%, 34% { transform: translateX(-100%); }
72%, 100% { transform: translateX(100%); }
}
@keyframes icon-float {
0%, 100% { transform: translateY(0) scale(1); }
50% { transform: translateY(-5px) scale(1.015); }
}
@keyframes icon-sheen {
0%, 18% { transform: translateX(-98px) rotate(16deg); opacity: 0; }
44% { opacity: 0.9; }
68%, 100% { transform: translateX(98px) rotate(16deg); opacity: 0; }
}
@keyframes halo-breathe {
0%, 100% { opacity: 0.35; transform: rotate(45deg) scale(0.95); }
50% { opacity: 0.8; transform: rotate(45deg) scale(1.04); }
}
@keyframes trace-draw {
0% { stroke-dashoffset: 165; opacity: 0; }
36% { opacity: 1; }
64%, 100% { stroke-dashoffset: 0; opacity: 0.72; }
}
@keyframes bar-slide {
0% { transform: translateX(-120%); }
100% { transform: translateX(320%); }
}
@media (prefers-reduced-motion: reduce) {
.grid,
.splash::before,
.halo,
.trace,
.icon,
.sheen,
.bar span {
animation: none;
}
.trace {
stroke-dashoffset: 0;
opacity: 0.72;
}
}
</style>
</head>
<body>
<div class="grid" aria-hidden="true"></div>
<main class="splash" role="status" aria-live="polite">
<div class="mark" aria-hidden="true">
<span class="halo"></span>
<span class="halo secondary"></span>
<svg class="traces" viewBox="0 0 220 220">
<path class="trace main" d="M28 154 C72 114, 88 108, 110 110 S156 116, 192 68" />
<path class="trace branch" d="M62 74 C100 88, 126 124, 158 166" />
<path class="trace base" d="M46 180 L174 180" />
</svg>
<img class="icon" src="/splash-icon.png" alt="" />
<span class="sheen"></span>
</div>
<div class="copy">
<strong>GitLite</strong>
<span>Starting workspace</span>
</div>
<div class="bar" aria-hidden="true"><span></span></div>
</main>
</body>
</html>
+14 -1
View File
@@ -19,6 +19,18 @@ use git::{
restore_to_commit, search_code_introductions, stage_files, stash_apply, stash_drop, stash_pop, restore_to_commit, search_code_introductions, stage_files, stash_apply, stash_drop, stash_pop,
stash_push, undo_last_commit, unstage_files, stash_push, undo_last_commit, unstage_files,
}; };
use tauri::Manager;
#[tauri::command]
fn close_splashscreen(app: tauri::AppHandle) {
if let Some(window) = app.get_webview_window("main") {
let _ = window.show();
let _ = window.set_focus();
}
if let Some(window) = app.get_webview_window("splashscreen") {
let _ = window.close();
}
}
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
@@ -97,7 +109,8 @@ async fn main() {
cred_load, cred_load,
cred_save, cred_save,
cred_delete, cred_delete,
set_sync_badge set_sync_badge,
close_splashscreen
]) ])
.run(tauri::generate_context!()) .run(tauri::generate_context!())
.expect("error while running tauri application"); .expect("error while running tauri application");
+13
View File
@@ -18,8 +18,21 @@
"height": 800, "height": 800,
"minWidth": 900, "minWidth": 900,
"minHeight": 600, "minHeight": 600,
"visible": false,
"decorations": false, "decorations": false,
"shadow": true "shadow": true
},
{
"label": "splashscreen",
"url": "splashscreen.html",
"title": "GitLite",
"width": 460,
"height": 420,
"resizable": false,
"decorations": false,
"center": true,
"skipTaskbar": true,
"shadow": true
} }
], ],
"security": { "security": {
+15 -3
View File
@@ -477,8 +477,8 @@
.titlebar-brand { .titlebar-brand {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 7px; gap: 8px;
padding: 0 14px; padding: 0 13px 0 11px;
height: 100%; height: 100%;
font-size: 13px; font-size: 13px;
font-weight: 700; font-weight: 700;
@@ -486,7 +486,19 @@
color: var(--color-bar-text); color: var(--color-bar-text);
border-right: 1px solid rgba(255,255,255,0.06); border-right: 1px solid rgba(255,255,255,0.06);
} }
.titlebar-brand svg { color: #ffd343; filter: drop-shadow(0 0 10px rgba(255,211,67,0.3)); flex-shrink: 0; } .titlebar-brand-icon {
display: grid;
place-items: center;
width: 24px;
height: 24px;
flex: 0 0 24px;
}
.titlebar-brand-icon img {
width: 24px;
height: 24px;
object-fit: contain;
filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5));
}
.tb-version { .tb-version {
margin-left: 1px; margin-left: 1px;
+4 -18
View File
@@ -3,6 +3,7 @@
import { getVersion } from "@tauri-apps/api/app"; import { getVersion } from "@tauri-apps/api/app";
import { getCurrentWindow } from "@tauri-apps/api/window"; import { getCurrentWindow } from "@tauri-apps/api/window";
import { CloudDownload, Download, FolderOpen, GitBranch, GitCompare, LoaderCircle, Minus, RefreshCw, Search, Settings, Upload, X } from "@lucide/svelte"; import { CloudDownload, Download, FolderOpen, GitBranch, GitCompare, LoaderCircle, Minus, RefreshCw, Search, Settings, Upload, X } from "@lucide/svelte";
import iconUrl from "../../src-tauri/icons/icon.png";
export let branch: string = ""; export let branch: string = "";
export let ahead: number = 0; export let ahead: number = 0;
@@ -44,24 +45,9 @@
<header class="titlebar" data-tauri-drag-region> <header class="titlebar" data-tauri-drag-region>
<!-- Brand --> <!-- Brand -->
<div class="titlebar-brand" data-tauri-drag-region> <div class="titlebar-brand" data-tauri-drag-region>
<svg <span class="titlebar-brand-icon" data-tauri-drag-region>
width="15" <img src={iconUrl} alt="" data-tauri-drag-region />
height="15" </span>
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
data-tauri-drag-region
>
<circle cx="12" cy="18" r="3" />
<circle cx="6" cy="6" r="3" />
<circle cx="18" cy="6" r="3" />
<path d="M18 9v1a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2V9" />
<line x1="12" y1="12" x2="12" y2="15" />
</svg>
<span data-tauri-drag-region>GitLite</span> <span data-tauri-drag-region>GitLite</span>
{#if appVersion} {#if appVersion}
<span class="tb-version" data-tauri-drag-region title="Version {appVersion}">v{appVersion}</span> <span class="tb-version" data-tauri-drag-region title="Version {appVersion}">v{appVersion}</span>
+8 -1
View File
@@ -1,4 +1,5 @@
import { mount } from "svelte"; import { mount } from "svelte";
import { invoke } from "@tauri-apps/api/core";
import App from "./App.svelte"; import App from "./App.svelte";
import "./app.css"; import "./app.css";
@@ -9,4 +10,10 @@ if (!target) {
throw new Error("App target element was not found."); throw new Error("App target element was not found.");
} }
export default mount(App, { target }); const app = mount(App, { target });
void invoke("close_splashscreen").catch(() => {
// Browser preview and failed startup paths should keep working without Tauri.
});
export default app;