дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 11:15:40 +02:00
feat(app): Show a themed splash until the launch project opens
Project windows are created in setup with the saved theme's frame colour, and the splash covers the first render while the launch project opens, so a window no longer flashes white or the Welcome screen. Single-instance is now release-only so a dev build can run beside an installed release.
Цей коміт міститься в:
1 джерело
63a03d1c08
коміт
bf06ca7832
8 files changed
+166
-23
No files matched your search
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* The start-up splash (`#splash` in index.html). It covers the first render and
|
||||
* stays up while start-up work holds it (opening the window's launch project),
|
||||
* so a project window never flashes the Welcome screen first.
|
||||
*/
|
||||
const holds: Promise<unknown>[] = [];
|
||||
/** Never keep the splash longer than this; a slow open shows its own progress. */
|
||||
const MAX_WAIT_MS = 4000;
|
||||
|
||||
/** Keeps the splash up until `work` settles. Call before `hideSplash()`. */
|
||||
export function holdSplash(work: Promise<unknown>): void {
|
||||
holds.push(work.catch(() => {}));
|
||||
}
|
||||
|
||||
/** Fades the splash out once every hold has settled and the page has painted. */
|
||||
export function hideSplash(): void {
|
||||
const el = document.getElementById("splash");
|
||||
if (!el) return;
|
||||
const timeout = new Promise((resolve) => setTimeout(resolve, MAX_WAIT_MS));
|
||||
void Promise.race([Promise.all(holds), timeout]).then(() =>
|
||||
// Two frames: let React commit the state the holds produced before uncovering it.
|
||||
requestAnimationFrame(() =>
|
||||
requestAnimationFrame(() => {
|
||||
el.classList.add("splash-out");
|
||||
setTimeout(() => el.remove(), 200);
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in new issue
Заблокувати користувача