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"> <div className="w-full mt-5">
<GridWrapper desktop={4} gapDesktop={40} mobile={1}> <GridWrapper desktop={4} gapDesktop={40} mobile={1}>
{data?.data?.map((item) => { {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> </GridWrapper>
</div> </div>
@@ -15,9 +15,10 @@ import CatalogPreview from "./CatalogPreview";
type Props = { type Props = {
item: CatalogItemType; item: CatalogItemType;
refetch: () => void; refetch: () => void;
slug: string;
}; };
const CatalogueItem: FC<Props> = ({ item, refetch }) => { const CatalogueItem: FC<Props> = ({ item, refetch, slug }) => {
const { data: business } = useGetBusiness(); const { data: business } = useGetBusiness();
const deleteCatalog = useDleteCatalog(); const deleteCatalog = useDleteCatalog();
@@ -36,10 +37,7 @@ const CatalogueItem: FC<Props> = ({ item, refetch }) => {
await navigator.clipboard.writeText(shareUrl); await navigator.clipboard.writeText(shareUrl);
toast("لینک در کلیپ‌بورد کپی شد", "success"); toast("لینک در کلیپ‌بورد کپی شد", "success");
} catch (err) { } catch (err) {
const isAbort = const isAbort = err instanceof DOMException ? err.name === "AbortError" : err instanceof Error && err.name === "AbortError";
err instanceof DOMException
? err.name === "AbortError"
: err instanceof Error && err.name === "AbortError";
if (isAbort) return; if (isAbort) return;
toast(extractErrorMessage(err, "امکان اشتراک‌گذاری وجود ندارد"), "error"); toast(extractErrorMessage(err, "امکان اشتراک‌گذاری وجود ندارد"), "error");
} }
@@ -63,16 +61,11 @@ const CatalogueItem: FC<Props> = ({ item, refetch }) => {
<CatalogPreview item={item} /> <CatalogPreview item={item} />
<div> <div>
<h6>{item.name}</h6> <h6>{item.name}</h6>
<div className="mt-2 text-[#999999] text-xs"> <div className="mt-2 text-[#999999] text-xs">{moment(item.createdAt).format("jYYYY/jMM/jDD")}</div>
{moment(item.createdAt).format("jYYYY/jMM/jDD")}
</div>
</div> </div>
</div> </div>
<div className="flex justify-end gap-1 items-center mt-1"> <div className="flex justify-end gap-1 items-center mt-1">
<Link <Link to={Paths.viewerBySlug + `/${slug ?? business?.data?.slug}/${item.slug}`} onClick={requestViewerFullscreen}>
to={Paths.viewerBySlug + `/${business?.data?.slug}/${item.slug}`}
onClick={requestViewerFullscreen}
>
<div className="size-6 bg-[#EAECF4] rounded-md flex justify-center items-center"> <div className="size-6 bg-[#EAECF4] rounded-md flex justify-center items-center">
<Eye size={18} color="#0047FF" /> <Eye size={18} color="#0047FF" />
</div> </div>
@@ -82,20 +75,11 @@ const CatalogueItem: FC<Props> = ({ item, refetch }) => {
<Edit size={18} color="#0047FF" /> <Edit size={18} color="#0047FF" />
</div> </div>
</Link> </Link>
<button <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="اشتراک‌گذاری">
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" /> <Share size={18} color="#000" />
</button> </button>
<div className="size-6 bg-[#EAECF4] rounded-md flex justify-center items-center"> <div className="size-6 bg-[#EAECF4] rounded-md flex justify-center items-center">
<TrashWithConfrim <TrashWithConfrim onDelete={handleDelete} colorIcon="red" isloading={deleteCatalog.isPending} />
onDelete={handleDelete}
colorIcon="red"
isloading={deleteCatalog.isPending}
/>
</div> </div>
</div> </div>
</div> </div>