fix(images): restore direct upload loading to fix 502, fix StatCounter CLS and SmartAdvisor button contrast
E2E Playwright Tests / Run Full E2E & Security Suites (push) Failing after 6s
Deploy Canina / deploy (push) Has been cancelled

This commit is contained in:
parsa aghaei committed 2026-09-02 15:09:54 +03:30
1 parent 062718fb84
commit 5e6e25390e
3 files changed
+25 -26

No files matched your search

+15 -23
View File
@@ -9,11 +9,11 @@ import { Banner } from "../lib/types";
import { getMediaUrl } from "../lib/media";
function StatCounter({ target }: { target: number }) {
const [displayValue, setDisplayValue] = useState(0);
const [displayValue, setDisplayValue] = useState(target);
useEffect(() => {
const controls = animate(0, target, {
duration: 3,
duration: 2,
ease: [0.16, 1, 0.3, 1],
onUpdate: (latest) => setDisplayValue(Math.round(latest))
});
@@ -21,19 +21,13 @@ function StatCounter({ target }: { target: number }) {
}, [target]);
return (
<motion.div
initial={{ scale: 0.8, opacity: 0 }}
animate={{ scale: 1, opacity: 1 }}
transition={{ duration: 2.5, ease: "easeOut" }}
className="text-4xl lg:text-6xl font-black text-canina-blue font-vazir origin-right flex items-center"
<div
className="text-4xl lg:text-6xl font-black text-canina-blue font-vazir origin-right flex items-center min-w-[3ch]"
>
<motion.span
animate={{ scale: [1, 1.1, 1] }}
transition={{ duration: 3, ease: "easeInOut" }}
>
<span>
{toPersian(displayValue)}+
</motion.span>
</motion.div>
</span>
</div>
);
}
@@ -213,8 +207,7 @@ export default function Hero({ banners = [], onShopNavigate }: { banners?: Banne
alt={banner.title || "Canina Pharma Germany"}
fill
priority={idx === 0}
sizes="(max-width: 1024px) 100vw, 600px"
quality={80}
unoptimized={true}
className="object-cover"
/>
</motion.div>
@@ -226,8 +219,7 @@ export default function Hero({ banners = [], onShopNavigate }: { banners?: Banne
alt={activeBanner?.title || "Canina Pharma Germany"}
fill
priority
sizes="(max-width: 1024px) 100vw, 600px"
quality={80}
unoptimized={true}
className="object-cover"
/>
</div>
@@ -257,20 +249,20 @@ export default function Hero({ banners = [], onShopNavigate }: { banners?: Banne
<>
<button
onClick={handlePrevSlide}
className="absolute right-4 top-1/2 -translate-y-1/2 w-11 h-11 rounded-full bg-black/40 hover:bg-black/70 text-white backdrop-blur-md flex items-center justify-center transition-all opacity-0 group-hover:opacity-100 z-30"
className="absolute right-4 top-1/2 -translate-y-1/2 w-11 h-11 rounded-full bg-black/40 hover:bg-black/70 text-white backdrop-blur-md flex items-center justify-center transition-all opacity-0 group-hover:opacity-100 z-30 cursor-pointer"
aria-label="اسلاید قبلی"
>
<ChevronRight className="w-5 h-5" />
</button>
<button
onClick={handleNextSlide}
className="absolute left-4 top-1/2 -translate-y-1/2 w-11 h-11 rounded-full bg-black/40 hover:bg-black/70 text-white backdrop-blur-md flex items-center justify-center transition-all opacity-0 group-hover:opacity-100 z-30"
className="absolute left-4 top-1/2 -translate-y-1/2 w-11 h-11 rounded-full bg-black/40 hover:bg-black/70 text-white backdrop-blur-md flex items-center justify-center transition-all opacity-0 group-hover:opacity-100 z-30 cursor-pointer"
aria-label="اسلاید بعدی"
>
<ChevronLeft className="w-5 h-5" />
</button>
{/* Dot Indicators with 44x44 Touch Target */}
{/* Dot Indicators with 44x44 Touch Target & Composited Animations */}
<div className="absolute bottom-4 left-1/2 -translate-x-1/2 flex items-center gap-1 z-30 bg-black/40 backdrop-blur-md px-3 py-1 rounded-full">
{heroBanners.map((_, idx) => (
<button
@@ -280,10 +272,10 @@ export default function Hero({ banners = [], onShopNavigate }: { banners?: Banne
aria-label={`رفتن به اسلاید ${idx + 1}`}
>
<span
className={`block rounded-full transition-all duration-300 ${
className={`block rounded-full transition-opacity duration-300 ${
currentSlide === idx
? "w-5 h-2 bg-canina-gold"
: "w-2 h-2 bg-white/60 hover:bg-white"
? "w-4 h-2 bg-canina-gold opacity-100"
: "w-2 h-2 bg-white opacity-60 hover:opacity-100"
}`}
/>
</button>
@@ -104,7 +104,12 @@ export default function SafeImage({
unoptimized={
isBlobOrData ||
!isAllowedHost ||
(typeof src === 'string' && src.toLowerCase().endsWith('.svg'))
(typeof src === 'string' && (
src.startsWith('/api/uploads/') ||
src.startsWith('/api/media/') ||
src.startsWith('/uploads/') ||
src.toLowerCase().endsWith('.svg')
))
}
className={cn(
"transition-all duration-500 w-full h-full object-contain",
@@ -391,8 +391,10 @@ export default function SmartAdvisor({ onComplete, rules = [] }: SmartAdvisorPro
animate={shake ? { x: [-10, 10, -10, 10, -5, 5, -2, 2, 0] } : { x: 0 }}
transition={{ duration: 0.4 }}
className={cn(
"w-full whitespace-nowrap bg-canina-blue text-white px-6 sm:px-10 py-3 sm:py-4 rounded-full font-bold text-sm sm:text-base hover:bg-canina-blue/90 hover:shadow-xl focus-visible:ring-4 focus-visible:ring-canina-blue/30 focus-visible:outline-none transition-all flex items-center justify-center gap-2 group font-vazir min-h-[48px] shadow-md shadow-canina-blue/20 cursor-pointer",
(!name.trim() || !breed.trim()) ? "opacity-60" : ""
"w-full whitespace-nowrap px-6 sm:px-10 py-3 sm:py-4 rounded-full font-bold text-sm sm:text-base focus-visible:ring-4 focus-visible:ring-canina-blue/30 focus-visible:outline-none transition-all flex items-center justify-center gap-2 group font-vazir min-h-[48px] shadow-md cursor-pointer",
(!name.trim() || !breed.trim())
? "bg-slate-700 text-white shadow-none"
: "bg-canina-blue text-white hover:bg-canina-blue/90 hover:shadow-xl shadow-canina-blue/20"
)}
>
<span>{getText('advisor_submit_btn', "ثبت هویت و ادامه")}</span>