fix problem

This commit is contained in:
hamid zarghami
2026-06-21 15:04:52 +03:30
parent d34a3a92f1
commit c565c0957f
5 changed files with 307 additions and 455 deletions
+4 -10
View File
@@ -1,7 +1,7 @@
'use client';
"use client";
import React from 'react';
import { glassSurface } from '@/lib/styles/glassSurface';
import { glassSurface } from "@/lib/styles/glassSurface";
import React from "react";
type Props = {
children: React.ReactNode;
@@ -9,13 +9,7 @@ type Props = {
function MenuItemRendererComponent({ children, ...rest }: Props) {
return (
<div
{...rest}
className={glassSurface(
rest.className,
'!pb-4 py-4 transition-all duration-200 ease-out w-full rounded-3xl px-4 flex items-center justify-between gap-4',
)}>
<div {...rest} className={glassSurface(rest.className, "pb-4! py-4 transition-all duration-200 ease-out w-full rounded-3xl px-4 flex items-center justify-between gap-4")}>
{children}
</div>
);
+20 -28
View File
@@ -1,8 +1,8 @@
'use client';
"use client";
import { useEffect, useRef, useState } from 'react';
import { motion } from 'framer-motion';
import Image from 'next/image';
import { motion } from "framer-motion";
import Image from "next/image";
import { useEffect, useRef, useState } from "react";
const MAX_DISPLAY_MS = 1200;
const EXIT_MS = 350;
@@ -14,27 +14,21 @@ interface SplashScreenProps {
onDismiss: () => void;
}
export default function SplashScreen({
logo,
restaurantName,
onDismiss,
}: SplashScreenProps) {
export default function SplashScreen({ logo, restaurantName, onDismiss }: SplashScreenProps) {
const [opacity, setOpacity] = useState(1);
const [logoState, setLogoState] = useState<'idle' | 'loading' | 'ready' | 'error'>(
logo ? 'loading' : 'idle',
);
const [logoState, setLogoState] = useState<"idle" | "loading" | "ready" | "error">(logo ? "loading" : "idle");
const onDismissRef = useRef(onDismiss);
onDismissRef.current = onDismiss;
useEffect(() => {
setLogoState(logo ? 'loading' : 'idle');
setLogoState(logo ? "loading" : "idle");
}, [logo]);
useEffect(() => {
if (!logo || logoState !== 'loading') return;
if (!logo || logoState !== "loading") return;
const logoTimeout = setTimeout(() => {
setLogoState('error');
setLogoState("error");
}, LOGO_TIMEOUT_MS);
return () => clearTimeout(logoTimeout);
@@ -55,13 +49,12 @@ export default function SplashScreen({
};
}, []);
return (
<motion.div
initial={{ opacity: 1 }}
animate={{ opacity }}
transition={{ duration: EXIT_MS / 1000, ease: 'easeOut' }}
className="fixed inset-0 z-[9999] flex flex-col items-center justify-center bg-background"
transition={{ duration: EXIT_MS / 1000, ease: "easeOut" }}
className="fixed inset-0 z-9999 flex flex-col items-center justify-center bg-background"
data-slot="splash-screen"
aria-hidden="true"
>
@@ -74,7 +67,7 @@ export default function SplashScreen({
transition={{
duration: 3,
repeat: Infinity,
ease: 'easeInOut',
ease: "easeInOut",
}}
className="absolute -top-20 -right-20 w-80 h-80 rounded-full bg-primary/20 blur-3xl"
/>
@@ -87,31 +80,30 @@ export default function SplashScreen({
duration: 3,
delay: 0.5,
repeat: Infinity,
ease: 'easeInOut',
ease: "easeInOut",
}}
className="absolute -bottom-20 -left-20 w-80 h-80 rounded-full bg-primary/20 blur-3xl"
/>
</div>
<div className="flex flex-col items-center gap-8 px-8 w-full max-w-md relative z-10">
{logo && logoState !== 'error' && (
{logo && logoState !== "error" && (
<div className="relative">
<Image
src={logo}
alt={restaurantName || 'Restaurant Logo'}
alt={restaurantName || "Restaurant Logo"}
width={200}
height={100}
unoptimized
priority
className="object-contain"
onLoad={() => setLogoState('ready')}
onError={() => setLogoState('error')}
onLoad={() => setLogoState("ready")}
onError={() => setLogoState("error")}
style={{
opacity: logoState === 'ready' ? 1 : 0,
transition: 'opacity 0.3s',
opacity: logoState === "ready" ? 1 : 0,
transition: "opacity 0.3s",
}}
/>
</div>
)}
@@ -127,7 +119,7 @@ export default function SplashScreen({
duration: 1.5,
delay,
repeat: Infinity,
ease: 'easeInOut',
ease: "easeInOut",
}}
className="w-3 h-3 rounded-full bg-primary shadow-lg shadow-primary/50"
/>