bug fix
This commit is contained in:
parent
9b1506a64e
commit
653b1bc396
|
@ -60,17 +60,13 @@ export default function LinkActions({ link, className, btnStyle }: Props) {
|
||||||
<>
|
<>
|
||||||
{isPublicRoute ? (
|
{isPublicRoute ? (
|
||||||
<div
|
<div
|
||||||
className={clsx(
|
className={clsx(className || "top-3 right-3 absolute z-20")}
|
||||||
className || "top-3 right-3",
|
|
||||||
"absolute z-20",
|
|
||||||
btnStyle
|
|
||||||
)}
|
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
role="button"
|
role="button"
|
||||||
onMouseDown={dropdownTriggerer}
|
onMouseDown={dropdownTriggerer}
|
||||||
onClick={() => setLinkModal(true)}
|
onClick={() => setLinkModal(true)}
|
||||||
>
|
>
|
||||||
<div className="btn btn-sm btn-square text-neutral">
|
<div className={clsx("btn btn-sm btn-square text-neutral", btnStyle)}>
|
||||||
<i title="More" className="bi-three-dots text-xl" />
|
<i title="More" className="bi-three-dots text-xl" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -19,6 +19,7 @@ import { useCollections } from "@/hooks/store/collections";
|
||||||
import { useUser } from "@/hooks/store/user";
|
import { useUser } from "@/hooks/store/user";
|
||||||
import { useLinks } from "@/hooks/store/links";
|
import { useLinks } from "@/hooks/store/links";
|
||||||
import useLocalSettingsStore from "@/store/localSettings";
|
import useLocalSettingsStore from "@/store/localSettings";
|
||||||
|
import LinkPin from "./LinkPin";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
link: LinkIncludingShortenedCollectionAndTags;
|
link: LinkIncludingShortenedCollectionAndTags;
|
||||||
|
@ -134,11 +135,16 @@ export default function LinkCardCompact({ link, editMode }: Props) {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<LinkPin
|
||||||
|
link={link}
|
||||||
|
className="absolute top-3 right-[3.25rem] group-hover:opacity-100 group-focus-within:opacity-100 opacity-0 duration-100"
|
||||||
|
btnStyle="btn-ghost"
|
||||||
|
/>
|
||||||
<LinkActions
|
<LinkActions
|
||||||
link={link}
|
link={link}
|
||||||
collection={collection}
|
collection={collection}
|
||||||
className={
|
className={
|
||||||
"top-3 right-3 group-hover:opacity-100 group-focus-within:opacity-100 opacity-0 duration-100"
|
"absolute top-3 right-3 group-hover:opacity-100 group-focus-within:opacity-100 opacity-0 duration-100"
|
||||||
}
|
}
|
||||||
btnStyle="btn-ghost"
|
btnStyle="btn-ghost"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -24,6 +24,7 @@ import { useUser } from "@/hooks/store/user";
|
||||||
import { useGetLink, useLinks } from "@/hooks/store/links";
|
import { useGetLink, useLinks } from "@/hooks/store/links";
|
||||||
import useLocalSettingsStore from "@/store/localSettings";
|
import useLocalSettingsStore from "@/store/localSettings";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
|
import LinkPin from "./LinkPin";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
link: LinkIncludingShortenedCollectionAndTags;
|
link: LinkIncludingShortenedCollectionAndTags;
|
||||||
|
@ -246,6 +247,10 @@ export default function LinkMasonry({ link, editMode, columns }: Props) {
|
||||||
"top-3 right-3 group-hover:opacity-100 group-focus-within:opacity-100 opacity-0 duration-100"
|
"top-3 right-3 group-hover:opacity-100 group-focus-within:opacity-100 opacity-0 duration-100"
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
<LinkPin
|
||||||
|
link={link}
|
||||||
|
className="absolute top-3 right-[3.25rem] group-hover:opacity-100 group-focus-within:opacity-100 opacity-0 duration-100"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,10 +18,10 @@ export default function LinkPin({ link, className, btnStyle }: Props) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={clsx(className || "top-3 right-3 absolute", btnStyle)}
|
className={clsx(className || "top-3 right-3 absolute")}
|
||||||
onClick={() => pinLink(link)}
|
onClick={() => pinLink(link)}
|
||||||
>
|
>
|
||||||
<div className="btn btn-sm btn-square text-neutral">
|
<div className={clsx("btn btn-sm btn-square text-neutral", btnStyle)}>
|
||||||
<i
|
<i
|
||||||
title="Pin"
|
title="Pin"
|
||||||
className={clsx(
|
className={clsx(
|
||||||
|
|
|
@ -433,12 +433,38 @@ const useUpdatePreview = () => {
|
||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
onSuccess: (data) => {
|
onSuccess: (data) => {
|
||||||
queryClient.invalidateQueries({ queryKey: ["links"] });
|
queryClient.setQueryData(["dashboardData"], (oldData: any) => {
|
||||||
queryClient.invalidateQueries({ queryKey: ["dashboardData"] });
|
if (!oldData?.links) return undefined;
|
||||||
|
return {
|
||||||
|
...oldData,
|
||||||
|
links: oldData.links.map((e: any) =>
|
||||||
|
e.id === data.response.id
|
||||||
|
? {
|
||||||
|
...e,
|
||||||
|
preview: `archives/preview/${e.collectionId}/${e.id}.jpeg`,
|
||||||
|
}
|
||||||
|
: e
|
||||||
|
),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
queryClient.invalidateQueries({ queryKey: ["collections"] });
|
queryClient.setQueriesData({ queryKey: ["links"] }, (oldData: any) => {
|
||||||
queryClient.invalidateQueries({ queryKey: ["tags"] });
|
if (!oldData) return undefined;
|
||||||
queryClient.invalidateQueries({ queryKey: ["publicLinks"] });
|
return {
|
||||||
|
pages: oldData.pages.map((page: any) =>
|
||||||
|
page.map((item: any) =>
|
||||||
|
item.id === data.response.id
|
||||||
|
? {
|
||||||
|
...item,
|
||||||
|
preview: `archives/preview/${item.collectionId}/${item.id}.jpeg`,
|
||||||
|
updatedAt: new Date().toISOString(),
|
||||||
|
}
|
||||||
|
: item
|
||||||
|
)
|
||||||
|
),
|
||||||
|
pageParams: oldData.pageParams,
|
||||||
|
};
|
||||||
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -124,7 +124,7 @@ export default async function updateLinkById(
|
||||||
})),
|
})),
|
||||||
},
|
},
|
||||||
pinnedBy:
|
pinnedBy:
|
||||||
data?.pinnedBy && data.pinnedBy[0].id === userId
|
data?.pinnedBy && data.pinnedBy[0]?.id === userId
|
||||||
? { connect: { id: userId } }
|
? { connect: { id: userId } }
|
||||||
: { disconnect: { id: userId } },
|
: { disconnect: { id: userId } },
|
||||||
},
|
},
|
||||||
|
|
Ŝarĝante…
Reference in New Issue