'use client'; import { usePathname } from "next/navigation"; import Image from "next/image"; import clsx from "clsx"; import HorizontalScrollView from "@/components/listview/HorizontalScrollView"; import CategoryItemRenderer from "@/components/listview/CategoryItemRenderer"; import CategorySmallItemRenderer from "@/components/listview/CategorySmallItemRenderer"; import { Category } from "@/app/[name]/(Main)/types/Types"; const SVG_MASK_STYLE = { maskSize: "contain", maskRepeat: "no-repeat", maskPosition: "center", WebkitMaskSize: "contain", WebkitMaskRepeat: "no-repeat", WebkitMaskPosition: "center", } as const; function CategoryImage({ src, size, alt, proxyBase, }: { src: string; size: number; alt: string; proxyBase: string | null; }) { const isSvg = src.endsWith(".svg"); if (isSvg) { const isSameOrigin = src.startsWith("/") || (typeof window !== "undefined" && new URL(src, window.location.href).origin === window.location.origin); const maskUrl = isSameOrigin ? src : proxyBase ? `${proxyBase}/api/proxy-svg?url=${encodeURIComponent(src)}` : null; if (maskUrl) { return (
); } return ( // eslint-disable-next-line @next/next/no-img-element