This commit is contained in:
@@ -86,7 +86,8 @@ export default function SplashScreen({
|
||||
alt={restaurantName || 'Restaurant Logo'}
|
||||
width={200}
|
||||
height={100}
|
||||
priority
|
||||
unoptimized
|
||||
loading="lazy"
|
||||
className="object-contain"
|
||||
onLoad={() => setImageLoaded(true)}
|
||||
style={{ opacity: imageLoaded ? 1 : 0, transition: 'opacity 0.3s' }}
|
||||
|
||||
@@ -36,9 +36,14 @@ function PreferenceWrapper({ children }: Props) {
|
||||
return !sessionStorage.getItem('app-loaded') || isReload;
|
||||
});
|
||||
|
||||
const [mounted, setMounted] = useState(false);
|
||||
const [cachedLogo, setCachedLogo] = useState<string | null>(null);
|
||||
const [cachedName, setCachedName] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
setMounted(true);
|
||||
}, []);
|
||||
|
||||
// بارگذاری رنگ و اطلاعات از localStorage در اولین رندر
|
||||
useEffect(() => {
|
||||
// بارگذاری رنگ
|
||||
@@ -93,9 +98,12 @@ function PreferenceWrapper({ children }: Props) {
|
||||
}
|
||||
}, [showSplash]);
|
||||
|
||||
// استفاده از دادههای cache شده برای اسپلش
|
||||
const splashLogo = aboutData?.data?.logo || cachedLogo || undefined;
|
||||
const splashName = aboutData?.data?.name || cachedName || undefined;
|
||||
const splashLogo = mounted
|
||||
? (aboutData?.data?.logo || cachedLogo || undefined)
|
||||
: undefined;
|
||||
const splashName = mounted
|
||||
? (aboutData?.data?.name || cachedName || undefined)
|
||||
: undefined;
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user