Comprehensive set of mobile and all improvements phase 1

This commit is contained in:
gsxdsm
2026-02-17 17:33:11 -08:00
parent 7fcf3c1e1f
commit cb44f8a717
36 changed files with 2037 additions and 304 deletions

View File

@@ -28,8 +28,13 @@ export default function App() {
if (savedPreference === 'true') {
return false;
}
// Only show splash once per session
if (sessionStorage.getItem('automaker-splash-shown')) {
// Only show splash once per browser session.
// Uses localStorage (not sessionStorage) so tab restores after discard
// don't replay the splash — sessionStorage is cleared when a tab is discarded.
// The flag is written on splash complete and cleared when the tab is fully closed
// (via the 'pagehide' + persisted=false event, which fires on true tab close but
// not on discard/background). This gives "once per actual session" semantics.
if (localStorage.getItem('automaker-splash-shown-session')) {
return false;
}
return true;
@@ -103,10 +108,25 @@ export default function App() {
useMobileOnlineManager();
const handleSplashComplete = useCallback(() => {
sessionStorage.setItem('automaker-splash-shown', 'true');
// Mark splash as shown for this session (survives tab discard/restore)
localStorage.setItem('automaker-splash-shown-session', 'true');
setShowSplash(false);
}, []);
// Clear the splash-shown flag when the tab is truly closed (not just discarded).
// `pagehide` with persisted=false fires on real navigation/close but NOT on discard,
// so discarded tabs that are restored skip the splash while true re-opens show it.
useEffect(() => {
const handlePageHide = (e: PageTransitionEvent) => {
if (!e.persisted) {
// Tab is being closed or navigating away (not going into bfcache)
localStorage.removeItem('automaker-splash-shown-session');
}
};
window.addEventListener('pagehide', handlePageHide);
return () => window.removeEventListener('pagehide', handlePageHide);
}, []);
return (
<TooltipProvider delayDuration={300}>
<RouterProvider router={router} />