Compare commits

...

2 Commits

Author SHA1 Message Date
hamid zarghami e89b71b416 render mode
Build and Deploy Docker Images / build_and_deploy (push) Has been cancelled
2026-06-14 09:09:52 +03:30
hamid zarghami 29f7b9db58 update delivery 2026-06-14 09:06:23 +03:30
2 changed files with 15 additions and 21 deletions
@@ -7,6 +7,9 @@ import HorizontalScrollView from "@/components/listview/HorizontalScrollView";
import clsx from "clsx"; import clsx from "clsx";
import { usePathname } from "next/navigation"; import { usePathname } from "next/navigation";
/** TODO: remove when backend sends avatarRenderMode */
const COLORED_SVG_RESTAURANT_SLUGS = new Set(["havasone"]);
const SVG_MASK_STYLE = { const SVG_MASK_STYLE = {
maskSize: "contain", maskSize: "contain",
maskRepeat: "no-repeat", maskRepeat: "no-repeat",
@@ -20,16 +23,17 @@ function CategoryImage({
src, src,
size, size,
alt, alt,
// proxyBase, tintWithPrimary = true,
}: { }: {
src: string; src: string;
size: number; size: number;
alt: string; alt: string;
// proxyBase: string | null; tintWithPrimary?: boolean;
}) { }) {
const isSvg = src.endsWith(".svg"); const isSvg = src.endsWith(".svg");
const shouldUseSvgMask = isSvg && tintWithPrimary;
if (isSvg) { if (shouldUseSvgMask) {
return ( return (
<div <div
className="shrink-0 bg-primary" className="shrink-0 bg-primary"
@@ -44,17 +48,6 @@ function CategoryImage({
aria-label={alt} aria-label={alt}
/> />
); );
return (
// eslint-disable-next-line @next/next/no-img-element
<img
src={src}
width={size}
height={size}
alt={alt}
className="shrink-0 object-contain"
/>
);
} }
return ( return (
@@ -65,6 +58,7 @@ function CategoryImage({
height={size} height={size}
alt={alt} alt={alt}
loading="lazy" loading="lazy"
className="shrink-0 object-contain"
onError={(event) => { onError={(event) => {
event.currentTarget.src = "/assets/images/food-image.png"; event.currentTarget.src = "/assets/images/food-image.png";
}} }}
@@ -107,7 +101,9 @@ const CategoryScroll = ({
className, className,
}: Props) => { }: Props) => {
const segment = usePathname()?.split("/").filter(Boolean)[0]; const segment = usePathname()?.split("/").filter(Boolean)[0];
const proxyBase = segment != null ? `/${segment}` : null; const usesColoredSvg =
segment != null &&
COLORED_SVG_RESTAURANT_SLUGS.has(segment.toLowerCase());
const { renderer: Renderer, imageSize } = variantConfig[variant]; const { renderer: Renderer, imageSize } = variantConfig[variant];
const handleSelect = (categoryId: string) => () => onSelect(categoryId); const handleSelect = (categoryId: string) => () => onSelect(categoryId);
@@ -147,7 +143,7 @@ const CategoryScroll = ({
src={item.avatarUrl || "/assets/images/food-image.png"} src={item.avatarUrl || "/assets/images/food-image.png"}
size={imageSize} size={imageSize}
alt="category image" alt="category image"
// proxyBase={proxyBase} tintWithPrimary={!usesColoredSvg}
/> />
<span className="text-xs text-foreground text-center"> <span className="text-xs text-foreground text-center">
{item.title} {item.title}
+3 -5
View File
@@ -7,6 +7,8 @@ const HOST_MAP: Record<string, string> = {
"thesun.tahavol-mr.ir": "/suncafe", "thesun.tahavol-mr.ir": "/suncafe",
"passataplus.ir": "/passata", "passataplus.ir": "/passata",
"cookieca.ir": "/cookieca", "cookieca.ir": "/cookieca",
"felamingofood.ir": "/felamingo",
"nanakbakery.ir": "/nanakbakery",
// دامنه‌های جدید اینجا اضافه می‌شوند // دامنه‌های جدید اینجا اضافه می‌شوند
}; };
@@ -21,11 +23,7 @@ export function middleware(req: NextRequest) {
const pathname = req.nextUrl.pathname; const pathname = req.nextUrl.pathname;
// مسیرهای api و استاتیک را rewrite نکن // مسیرهای api و استاتیک را rewrite نکن
if ( if (pathname.startsWith("/api") || pathname.startsWith("/_next") || pathname.includes(".")) {
pathname.startsWith("/api") ||
pathname.startsWith("/_next") ||
pathname.includes(".")
) {
return NextResponse.next(); return NextResponse.next();
} }