fix bug slug
deploy to danak / build_and_deploy (push) Has been cancelled

This commit is contained in:
hamid zarghami
2026-06-07 15:58:08 +03:30
parent 9b00a22d11
commit 5002596bb9
2 changed files with 8 additions and 24 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ const Business: FC = () => {
<div className="w-full mt-5">
<GridWrapper desktop={4} gapDesktop={40} mobile={1}>
{data?.data?.map((item) => {
return <CatalogueItem refetch={refetch} key={item.id} item={item} />;
return <CatalogueItem slug={slug ?? ""} refetch={refetch} key={item.id} item={item} />;
})}
</GridWrapper>
</div>
@@ -15,9 +15,10 @@ import CatalogPreview from "./CatalogPreview";
type Props = {
item: CatalogItemType;
refetch: () => void;
slug: string;
};
const CatalogueItem: FC<Props> = ({ item, refetch }) => {
const CatalogueItem: FC<Props> = ({ item, refetch, slug }) => {
const { data: business } = useGetBusiness();
const deleteCatalog = useDleteCatalog();
@@ -36,10 +37,7 @@ const CatalogueItem: FC<Props> = ({ item, refetch }) => {
await navigator.clipboard.writeText(shareUrl);
toast("لینک در کلیپ‌بورد کپی شد", "success");
} catch (err) {
const isAbort =
err instanceof DOMException
? err.name === "AbortError"
: err instanceof Error && err.name === "AbortError";
const isAbort = err instanceof DOMException ? err.name === "AbortError" : err instanceof Error && err.name === "AbortError";
if (isAbort) return;
toast(extractErrorMessage(err, "امکان اشتراک‌گذاری وجود ندارد"), "error");
}
@@ -63,16 +61,11 @@ const CatalogueItem: FC<Props> = ({ item, refetch }) => {
<CatalogPreview item={item} />
<div>
<h6>{item.name}</h6>
<div className="mt-2 text-[#999999] text-xs">
{moment(item.createdAt).format("jYYYY/jMM/jDD")}
</div>
<div className="mt-2 text-[#999999] text-xs">{moment(item.createdAt).format("jYYYY/jMM/jDD")}</div>
</div>
</div>
<div className="flex justify-end gap-1 items-center mt-1">
<Link
to={Paths.viewerBySlug + `/${business?.data?.slug}/${item.slug}`}
onClick={requestViewerFullscreen}
>
<Link to={Paths.viewerBySlug + `/${slug ?? business?.data?.slug}/${item.slug}`} onClick={requestViewerFullscreen}>
<div className="size-6 bg-[#EAECF4] rounded-md flex justify-center items-center">
<Eye size={18} color="#0047FF" />
</div>
@@ -82,20 +75,11 @@ const CatalogueItem: FC<Props> = ({ item, refetch }) => {
<Edit size={18} color="#0047FF" />
</div>
</Link>
<button
type="button"
onClick={handleShare}
className="size-6 bg-[#EAECF4] rounded-md flex justify-center items-center border-0 p-0 cursor-pointer shrink-0"
aria-label="اشتراک‌گذاری"
>
<button type="button" onClick={handleShare} className="size-6 bg-[#EAECF4] rounded-md flex justify-center items-center border-0 p-0 cursor-pointer shrink-0" aria-label="اشتراک‌گذاری">
<Share size={18} color="#000" />
</button>
<div className="size-6 bg-[#EAECF4] rounded-md flex justify-center items-center">
<TrashWithConfrim
onDelete={handleDelete}
colorIcon="red"
isloading={deleteCatalog.isPending}
/>
<TrashWithConfrim onDelete={handleDelete} colorIcon="red" isloading={deleteCatalog.isPending} />
</div>
</div>
</div>