chore: resolve graphify merge conflicts from develop
Deploy Canina / deploy (push) Successful in 1m31s

This commit is contained in:
parsa committed 2026-08-24 01:21:46 +03:30
commit 0f50d6bed1
16 files changed
+5878 -5761

No files matched your search

@@ -1,8 +1,7 @@
/* eslint-disable @next/next/no-img-element */
"use client";
import React from "react";
import Link from "next/link";
import { Banner } from "../lib/types";
import SafeImage from "./SafeImage";
interface BannerPlacementProps {
banners: Banner[];
@@ -36,14 +35,14 @@ export default function BannerPlacement({
const cardContent = (
<div className="group relative rounded-3xl overflow-hidden shadow-lg hover:shadow-2xl transition-all duration-300 border border-medical-gray-100 bg-white">
<div className="aspect-[16/7] sm:aspect-[16/6] md:aspect-[16/7] overflow-hidden bg-medical-gray-100 relative">
<img
<SafeImage
src={banner.imageUrl}
alt={banner.title || "کنینا بنر"}
className="w-full h-full object-cover group-hover:scale-105 transition-transform duration-500"
loading="lazy"
className="w-full h-full"
imgClassName="w-full h-full object-cover group-hover:scale-105 transition-transform duration-500"
/>
{(banner.title || banner.subtitle) && (
<div className="absolute inset-0 bg-gradient-to-t from-black/80 via-black/30 to-transparent p-6 flex flex-col justify-end text-white text-right">
<div className="absolute inset-0 bg-gradient-to-t from-black/80 via-black/30 to-transparent p-6 flex flex-col justify-end text-white text-right pointer-events-none">
{banner.title && (
<h4 className="text-lg sm:text-xl font-black mb-1 leading-tight">
{banner.title}
@@ -98,14 +97,14 @@ export default function BannerPlacement({
const cardContent = (
<div className="group relative rounded-3xl overflow-hidden shadow-xl hover:shadow-2xl transition-all duration-300 border border-medical-gray-200 bg-white">
<div className="aspect-[21/6] sm:aspect-[21/5] min-h-[140px] sm:min-h-[180px] overflow-hidden bg-medical-gray-100 relative">
<img
<SafeImage
src={banner.imageUrl}
alt={banner.title || "کنینا"}
className="w-full h-full object-cover group-hover:scale-103 transition-transform duration-500"
loading="lazy"
className="w-full h-full"
imgClassName="w-full h-full object-cover group-hover:scale-103 transition-transform duration-500"
/>
{(banner.title || banner.subtitle) && (
<div className="absolute inset-0 bg-gradient-to-l from-black/80 via-black/40 to-transparent p-6 sm:p-10 flex flex-col justify-center text-white text-right">
<div className="absolute inset-0 bg-gradient-to-l from-black/80 via-black/40 to-transparent p-6 sm:p-10 flex flex-col justify-center text-white text-right pointer-events-none">
{banner.title && (
<h4 className="text-xl sm:text-3xl font-black mb-2 leading-tight">
{banner.title}
@@ -158,14 +157,14 @@ export default function BannerPlacement({
const cardContent = (
<div className="group relative rounded-2xl overflow-hidden shadow-md hover:shadow-xl transition-all duration-300 border border-medical-gray-200 bg-white">
<div className="aspect-[4/3] overflow-hidden bg-medical-gray-100 relative">
<img
<SafeImage
src={banner.imageUrl}
alt={banner.title || "بنر کنینا"}
className="w-full h-full object-cover group-hover:scale-105 transition-transform duration-500"
loading="lazy"
className="w-full h-full"
imgClassName="w-full h-full object-cover group-hover:scale-105 transition-transform duration-500"
/>
{banner.title && (
<div className="absolute inset-0 bg-gradient-to-t from-black/80 to-transparent p-4 flex flex-col justify-end text-white text-right">
<div className="absolute inset-0 bg-gradient-to-t from-black/80 to-transparent p-4 flex flex-col justify-end text-white text-right pointer-events-none">
<span className="text-xs font-black">{banner.title}</span>
</div>
)}
@@ -1,7 +1,7 @@
/* eslint-disable @next/next/no-img-element */
"use client";
import React from "react";
import Link from "next/link";
import Image from "next/image";
import { useSettingsStore } from "../lib/store/settingsStore";
interface BrandLogoProps {
@@ -39,12 +39,18 @@ export default function BrandLogo({
lg: "text-xl sm:text-3xl",
};
const isBlobOrData = typeof logoUrl === 'string' && (logoUrl.startsWith('blob:') || logoUrl.startsWith('data:'));
const content = (
<div className={`flex items-center gap-2.5 sm:gap-3 group shrink-0 ${className}`}>
{logoUrl ? (
<img
<Image
src={logoUrl}
alt={`${textEn} ${textFa}`}
width={180}
height={48}
priority
unoptimized={isBlobOrData}
className="h-10 sm:h-12 w-auto max-w-[160px] sm:max-w-[200px] object-contain shrink-0"
/>
) : (
+7 -3
View File
@@ -1,6 +1,6 @@
/* eslint-disable @next/next/no-img-element */
"use client";
import React, { useState, useEffect } from "react";
import Image from "next/image";
import { Phone, Mail, MapPin, Instagram, ShieldCheck, Globe, ArrowUp, Download } from "lucide-react";
import { useSettingsStore } from "../lib/store/settingsStore";
import BrandLogo from "./BrandLogo";
@@ -190,11 +190,15 @@ export default function Footer({
target="_blank"
rel="noopener noreferrer"
title="درگاه پرداخت امن و معتبر زیبال"
className="block"
>
<img
style={{ maxWidth: '65px', height: '65px', objectFit: 'contain' }}
<Image
src="https://zibal.ir/trust/assets/2.png"
alt="نماد اعتماد درگاه پرداخت زیبال"
width={65}
height={65}
unoptimized
className="max-w-[65px] h-[65px] object-contain"
/>
</a>
</div>
@@ -1,4 +1,3 @@
/* eslint-disable @next/next/no-img-element */
"use client";
import React, { useState } from "react";
import Link from "next/link";
@@ -26,6 +25,7 @@ import { toPersian } from "../lib/utils";
import api from "../lib/services/api";
import { toast } from "sonner";
import { useSettingsStore } from "../lib/store/settingsStore";
import SafeImage from "./SafeImage";
interface OrderDetailsModalProps {
isOpen: boolean;
@@ -418,14 +418,14 @@ export default function OrderDetailsModal({
<div className="flex items-center gap-4">
<div
onClick={() => setZoomedImage(pImg)}
className="w-14 h-14 bg-medical-gray-50 rounded-xl p-1.5 flex items-center justify-center shrink-0 border border-medical-gray-200 cursor-zoom-in hover:scale-105 transition-transform"
className="w-14 h-14 bg-medical-gray-50 rounded-xl p-1 flex items-center justify-center shrink-0 border border-medical-gray-200 cursor-zoom-in hover:scale-105 transition-transform overflow-hidden"
title="مشاهده تصویر بزرگ"
>
<img
<SafeImage
src={pImg}
alt={pName}
className="max-w-full max-h-full object-contain"
onError={(e: any) => { e.currentTarget.src = '/assets/images/canina-product-placeholder.png'; }}
className="w-full h-full"
imgClassName="w-full h-full object-contain"
/>
</div>
<div>
@@ -711,10 +711,11 @@ export default function OrderDetailsModal({
>
<X className="w-5 h-5" />
</button>
<img
<SafeImage
src={zoomedImage}
alt="نمایش کامل تصویر محصول"
className="max-h-[70vh] w-auto object-contain rounded-2xl"
className="max-h-[70vh] w-full"
imgClassName="max-h-[70vh] w-auto object-contain rounded-2xl mx-auto"
/>
</div>
</div>
@@ -4,6 +4,7 @@ import { Product } from "../lib/data/products";
import { productService } from "../lib/services/productService";
import { motion, AnimatePresence } from "motion/react";
import { PetProfileSkeleton } from "./Skeleton";
import SafeImage from "./SafeImage";
import {
Dog,
Cat,
@@ -28,7 +29,6 @@ import {
} from "lucide-react";
import { usePetStore, PetProfile as GlobalPetProfile, Reminder, HealthLog } from "../lib/store/usePetStore";
import { useCartStore } from "../lib/store/cartStore";
import SafeImage from "./SafeImage";
import SmartAdvisor from "./SmartAdvisor";
import OrderDetailsModal from "./OrderDetailsModal";
import { toast } from "sonner";
@@ -554,10 +554,11 @@ export default function PetProfile({ initialView, advisorNeed, embedded = false
{/* Photo preview container */}
<div className="relative w-20 h-20 rounded-2xl overflow-hidden bg-medical-gray-200 border-2 border-dashed border-medical-gray-300 flex items-center justify-center shrink-0">
{formData.imageUrl ? (
<img
<SafeImage
src={formData.imageUrl.startsWith('http') ? formData.imageUrl : `${BASE_DOMAIN}${formData.imageUrl}`}
alt="عکس پت"
className="w-full h-full object-cover"
className="w-full h-full"
imgClassName="w-full h-full object-cover"
/>
) : (
<Dog className="w-8 h-8 text-medical-gray-400" />
@@ -14,6 +14,7 @@ import {
Loader2,
Sparkles
} from "lucide-react";
import SafeImage from "./SafeImage";
interface PodcastInlinePlayerProps {
podcast: {
@@ -203,13 +204,11 @@ export default function PodcastInlinePlayer({ podcast }: PodcastInlinePlayerProp
onClick={togglePlay}
className="relative w-full md:w-56 sm:w-64 aspect-square rounded-2xl overflow-hidden cursor-pointer bg-neutral-800 border border-white/15 group-hover:border-canina-blue/50 transition-all flex items-center justify-center shrink-0 shadow-lg"
>
<img
<SafeImage
src={displayCover}
alt={podcast.title || "کاور پادکست"}
className={`w-full h-full object-cover transition-transform duration-700 ${isPlaying ? "scale-105" : "scale-100"}`}
onError={(e) => {
(e.target as HTMLImageElement).src = '/images/default-podcast.png';
}}
className="w-full h-full"
imgClassName={`w-full h-full object-cover transition-transform duration-700 ${isPlaying ? "scale-105" : "scale-100"}`}
/>
<div className="absolute inset-0 bg-black/40 group-hover:bg-black/20 transition-colors flex items-center justify-center">
<div className="w-12 h-12 rounded-full bg-canina-blue text-white flex items-center justify-center shadow-xl shadow-canina-blue/50 group-hover:scale-110 active:scale-95 transition-transform">
@@ -16,6 +16,7 @@ import {
Loader2,
Sparkles
} from "lucide-react";
import SafeImage from "./SafeImage";
interface PodcastPlayerModalProps {
isOpen: boolean;
@@ -277,13 +278,11 @@ export default function PodcastPlayerModal({ isOpen, onClose, podcast }: Podcast
{/* Cover Art Artwork */}
<div className="relative group my-2">
<div className="w-40 h-40 sm:w-48 sm:h-48 rounded-3xl overflow-hidden shadow-2xl border-2 border-white/20 relative bg-neutral-800 flex items-center justify-center">
<img
<SafeImage
src={displayCover}
alt={podcast.title || "کاور پادکست"}
className={`w-full h-full object-cover transition-transform duration-700 ${isPlaying ? "scale-105" : "scale-100"}`}
onError={(e) => {
(e.target as HTMLImageElement).src = '/images/default-podcast.png';
}}
className="w-full h-full"
imgClassName={`w-full h-full object-cover transition-transform duration-700 ${isPlaying ? "scale-105" : "scale-100"}`}
/>
<div className="absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent pointer-events-none" />
+10 -10
View File
@@ -325,10 +325,11 @@ export default function ProductPage({ productSlug }: { productSlug: string }) {
: 'border-medical-gray-200 hover:border-canina-blue/50 opacity-70 hover:opacity-100'
}`}
>
<img
<SafeImage
src={imgUrl}
alt={`${product.name} - ${idx + 1}`}
className="w-full h-full object-contain"
className="w-full h-full"
imgClassName="w-full h-full object-contain"
/>
</button>
);
@@ -707,13 +708,11 @@ export default function ProductPage({ productSlug }: { productSlug: string }) {
onClick={() => setIsVideoModalOpen(true)}
className="relative w-full md:w-80 aspect-video rounded-2xl overflow-hidden cursor-pointer bg-neutral-800 border border-white/10 group-hover:border-canina-blue/50 transition-all flex items-center justify-center shrink-0"
>
<img
<SafeImage
src={product.videoCover || product.image}
alt={product.videoTitle || product.name}
className="w-full h-full object-cover group-hover:scale-105 transition-transform duration-500"
onError={(e) => {
(e.target as HTMLImageElement).src = product.image;
}}
className="w-full h-full"
imgClassName="w-full h-full object-cover group-hover:scale-105 transition-transform duration-500"
/>
<div className="absolute inset-0 bg-black/40 group-hover:bg-black/20 transition-colors flex items-center justify-center">
<div className="w-12 h-12 rounded-full bg-canina-blue text-white flex items-center justify-center shadow-xl shadow-canina-blue/50 group-hover:scale-110 transition-transform">
@@ -1137,10 +1136,11 @@ export default function ProductPage({ productSlug }: { productSlug: string }) {
{/* Main Zoomed Image Container */}
<div className="bg-white rounded-3xl p-6 sm:p-10 shadow-2xl border border-white/20 max-h-[75vh] flex items-center justify-center overflow-hidden w-full">
<img
<SafeImage
src={activeImage || product.image}
alt={product.name}
className="max-h-[60vh] max-w-full w-auto object-contain drop-shadow-2xl"
className="max-h-[60vh] max-w-full w-full"
imgClassName="max-h-[60vh] max-w-full w-auto object-contain drop-shadow-2xl mx-auto"
/>
</div>
@@ -1165,7 +1165,7 @@ export default function ProductPage({ productSlug }: { productSlug: string }) {
: 'border-transparent opacity-60 hover:opacity-100'
}`}
>
<img src={img} alt="Thumbnail" className="w-full h-full object-contain" />
<SafeImage src={img} alt="Thumbnail" className="w-full h-full" imgClassName="w-full h-full object-contain" />
</button>
))}
</div>
+17 -1
View File
@@ -43,7 +43,23 @@ export default function SafeImage({
);
}
// Check if external domain is in allowed remote patterns or relative path
const isExternal = typeof src === 'string' && (src.startsWith('http://') || src.startsWith('https://'));
const isBlobOrData = typeof src === 'string' && (src.startsWith('blob:') || src.startsWith('data:'));
const isAllowedHost = React.useMemo(() => {
if (!isExternal) return true;
try {
const url = new URL(src);
const allowedHosts = [
'canina.ir', 'api.canina.ir', 'stage.canina.ir', 'stageapi.canina.ir',
'apicanina.parsaaghayi.ir', 'canina.de', 'www.canina.de',
'images.unsplash.com', 'plus.unsplash.com', 'localhost', '127.0.0.1'
];
return allowedHosts.some(h => url.hostname === h || url.hostname.endsWith(`.${h}`));
} catch {
return false;
}
}, [src, isExternal]);
return (
<div className={cn("relative overflow-hidden group flex items-center justify-center", className)}>
@@ -58,7 +74,7 @@ export default function SafeImage({
width={500}
height={500}
loading="lazy"
unoptimized={isExternal}
unoptimized={isBlobOrData || !isAllowedHost}
className={cn(
"transition-all duration-700 w-full h-full",
imgClassName,