perf(images): enable Next.js image optimization with fast internal docker proxy routing and clean button text SSR
This commit is contained in:
1 parent
0ff9a6b886
commit
e081441c22
2 files changed
+16
-19
No files matched your search
@@ -19,10 +19,10 @@ interface SafeImageProps extends Omit<React.ImgHTMLAttributes<HTMLImageElement>,
|
||||
height?: number;
|
||||
}
|
||||
|
||||
export default function SafeImage({
|
||||
src: rawSrc,
|
||||
alt = "تصویر مکمل کنینا",
|
||||
className,
|
||||
export default function SafeImage({
|
||||
src: rawSrc,
|
||||
alt = "تصویر مکمل کنینا",
|
||||
className,
|
||||
imgClassName,
|
||||
fallbackText = "در حال بروزرسانی تصویر...",
|
||||
priority = false,
|
||||
@@ -92,9 +92,9 @@ export default function SafeImage({
|
||||
<Sparkles className="w-6 h-6 text-canina-blue/20" />
|
||||
</div>
|
||||
)}
|
||||
<Image
|
||||
src={src}
|
||||
alt={alt}
|
||||
<Image
|
||||
src={src}
|
||||
alt={alt}
|
||||
width={width}
|
||||
height={height}
|
||||
priority={priority}
|
||||
@@ -102,20 +102,15 @@ export default function SafeImage({
|
||||
sizes={sizes}
|
||||
quality={quality}
|
||||
unoptimized={
|
||||
isBlobOrData ||
|
||||
isBlobOrData ||
|
||||
!isAllowedHost ||
|
||||
(typeof src === 'string' && (
|
||||
src.startsWith('/api/uploads/') ||
|
||||
src.startsWith('/api/media/') ||
|
||||
src.startsWith('/uploads/') ||
|
||||
src.toLowerCase().endsWith('.svg')
|
||||
))
|
||||
(typeof src === 'string' && src.toLowerCase().endsWith('.svg'))
|
||||
}
|
||||
className={cn(
|
||||
"transition-all duration-500 w-full h-full object-contain",
|
||||
imgClassName,
|
||||
loading && !priority ? "opacity-0 scale-105" : "opacity-100 scale-100"
|
||||
)}
|
||||
)}
|
||||
onLoad={() => setLoading(false)}
|
||||
onError={() => setError(true)}
|
||||
/>
|
||||
|
||||
Reference in new issue
Block a user