Files
ladill-woo-manager/resources/views/partials/boot-splash.blade.php
T
isaaccladandCursor 877879ef9b
Deploy Ladill Woo Manager / deploy (push) Successful in 53s
Show boot splash on app open/reload for logged-in users.
The once-per-session sessionStorage guard suppressed the loading screen after
its first appearance, so logged-in users effectively never saw it. Show it on
app entry (external referrer / direct / new tab) and reloads, while still
suppressing it on internal link navigations and back/forward to avoid flashing.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 19:21:56 +00:00

70 lines
3.6 KiB
PHP

@php
// Branded boot splash (Ladill Mail style). Resolve this app's icon from the
// launcher registry by matching the current host's subdomain, so the icon is
// correct even when the subdomain slug differs from the icon filename
// (e.g. woo.ladill.com -> woomanager.svg).
$sub = strtolower((string) ((explode('.', (string) (parse_url((string) config('app.url'), PHP_URL_HOST) ?: '')))[0] ?? ''));
$iconFile = null;
foreach ((array) config('ladill_launcher.apps', []) as $app) {
$host = (string) (parse_url((string) ($app['url'] ?? ''), PHP_URL_HOST) ?: '');
$appSub = strtolower((string) ((explode('.', $host))[0] ?? ''));
if ($appSub !== '' && $appSub === $sub && !empty($app['icon'])) {
$iconFile = (string) $app['icon'];
break;
}
}
if ($iconFile === null && $sub !== '') {
$iconFile = "{$sub}.svg";
}
$icon = $iconFile && is_file(public_path("images/launcher-icons/{$iconFile}"))
? "images/launcher-icons/{$iconFile}"
: null;
$label = (string) config('app.name', 'Ladill');
@endphp
<div id="ladill-boot" role="status" aria-live="polite">
<div class="lb-wrap">
@if ($icon)
<img class="lb-logo" src="{{ asset($icon) }}?v={{ @filemtime(public_path($icon)) ?: '1' }}" alt="">
@endif
<div class="lb-bar"><span></span></div>
<div class="lb-title">Loading {{ $label }}</div>
</div>
</div>
<style>
#ladill-boot{position:fixed;inset:0;z-index:99999;background:#f8fafc;display:flex;align-items:center;justify-content:center;transition:opacity .35s ease;font-family:'Figtree',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif}
#ladill-boot .lb-wrap{display:flex;flex-direction:column;align-items:center;gap:24px;width:260px}
#ladill-boot .lb-logo{width:64px;height:64px;animation:lb-pulse 1.6s ease-in-out infinite}
#ladill-boot .lb-bar{width:100%;height:4px;background:#e2e8f0;border-radius:999px;overflow:hidden}
#ladill-boot .lb-bar>span{display:block;height:100%;width:8%;border-radius:999px;background:linear-gradient(90deg,#4f46e5,#7c3aed);animation:lb-fill 1.9s cubic-bezier(.4,0,.2,1) forwards}
#ladill-boot .lb-title{font-size:14px;color:#64748b;font-weight:500}
@keyframes lb-fill{0%{width:8%}55%{width:68%}100%{width:93%}}
@keyframes lb-pulse{0%,100%{transform:scale(1);opacity:1}50%{transform:scale(.93);opacity:.82}}
</style>
<script>
(function(){
var el=document.getElementById('ladill-boot');
if(!el)return;
function remove(){if(el&&el.parentNode)el.parentNode.removeChild(el);}
// Show when the user opens or reloads the app; suppress only on internal
// link navigations and back/forward so we don't flash on every click.
try{
var navType='navigate';
var nav=performance.getEntriesByType&&performance.getEntriesByType('navigation');
if(nav&&nav.length){navType=nav[0].type;}
else if(performance.navigation){navType=performance.navigation.type===1?'reload':(performance.navigation.type===2?'back_forward':'navigate');}
var internal=false;
if(navType!=='reload'&&document.referrer){
try{internal=new URL(document.referrer).origin===location.origin;}catch(e){}
}
if(internal||navType==='back_forward'){remove();return;}
}catch(e){}
var start=Date.now(),MIN=550;
function done(){
var wait=Math.max(0,MIN-(Date.now()-start));
setTimeout(function(){if(!el)return;el.style.opacity='0';setTimeout(remove,400);},wait);
}
if(document.readyState==='complete')done();else window.addEventListener('load',done);
setTimeout(done,8000); // safety net
})();
</script>