Splash only appears when the server is slow: no flash of the welcome screen on a fast start

The splash used to stay a fixed 700ms plus a fade, so a fast response still showed it
briefly and jumped away. Now only the matching background shows for the first 350ms;
the splash content appears only if the response has not arrived by then, and once shown
it stays at least 700ms. Not run on a device.
This commit is contained in:
2026-10-11 01:19:34 +03:30
parent 8a61cb25b8
commit c7407f32b9
2 changed files with 32 additions and 9 deletions

View File

@@ -8,8 +8,12 @@ const GLYPHS = [
{ c: '÷', x: 64, d: 3.8 }, { c: '∑', x: 80, d: 0.6 }, { c: '×', x: 90, d: 4.6 },
];
/** تا وقتی نشستِ قبلی بررسی می‌شود نمایش داده می‌شود؛ عمداً تأخیرِ ساختگی ندارد. */
export function SplashScreen() {
/**
* تا وقتی نشستِ قبلی بررسی می‌شود نمایش داده می‌شود. `showContent=false` فقط پس‌زمینه است؛ App
* محتوا را فقط وقتی روشن می‌کند که پاسخِ سرور دیر کرده باشد.
*/
export function SplashScreen({ showContent }: { showContent: boolean }) {
if (!showContent) return <div className="h-full bg-rose" />;
return (
<div className="relative flex h-full flex-col items-center justify-center overflow-hidden bg-rose">
<div aria-hidden="true" className="pointer-events-none absolute inset-x-0 bottom-0 h-1/2">