rearchive protection

This commit is contained in:
daniel31x13
2023-10-31 15:44:58 -04:00
parent ccafc997fc
commit 56a281ae3d
14 changed files with 246 additions and 132 deletions
+18 -4
View File
@@ -55,7 +55,7 @@ export default function PreservedFormats() {
if (response.ok) {
toast.success(`Link is being archived...`);
getLink(link?.id as number);
} else toast.error(data);
} else toast.error(data.response);
};
const handleDownload = (format: "png" | "pdf") => {
@@ -152,11 +152,18 @@ export default function PreservedFormats() {
<div className="flex flex-col-reverse sm:flex-row gap-5 items-center justify-center">
{link?.collection.ownerId === session.data?.user.id ? (
<div
className="w-full text-center bg-sky-600 p-1 rounded-md cursor-pointer select-none mt-3"
className={`w-full text-center bg-sky-700 p-1 rounded-md cursor-pointer select-none hover:bg-sky-600 duration-100 ${
link?.pdfPath &&
link?.screenshotPath &&
link?.pdfPath !== "pending" &&
link?.screenshotPath !== "pending"
? "mt-3"
: ""
}`}
onClick={() => updateArchive()}
>
<p>Update Preserved Formats</p>
<p className="text-xs">(re-fetch)</p>
<p className="text-xs">(Refresh Formats)</p>
</div>
) : undefined}
<Link
@@ -165,7 +172,14 @@ export default function PreservedFormats() {
""
)}`}
target="_blank"
className="sm:mt-3 text-gray-500 dark:text-gray-300 duration-100 hover:opacity-60 flex gap-2 w-fit items-center text-sm"
className={`text-gray-500 dark:text-gray-300 duration-100 hover:opacity-60 flex gap-2 w-fit items-center text-sm ${
link?.pdfPath &&
link?.screenshotPath &&
link?.pdfPath !== "pending" &&
link?.screenshotPath !== "pending"
? "sm:mt-3"
: ""
}`}
>
<FontAwesomeIcon
icon={faArrowUpRightFromSquare}
+11 -16
View File
@@ -30,11 +30,15 @@ export default function LinkModal({
}: Props) {
return (
<div className={className}>
{/* {method === "CREATE" && (
<p className="text-xl text-black dark:text-white text-center">
New Link
</p>
)} */}
{method === "CREATE" ? (
<>
<p className="ml-10 mt-[0.1rem] text-xl mb-3 font-thin">
Create a New Link
</p>
<AddOrEditLink toggleLinkModal={toggleLinkModal} method="CREATE" />
</>
) : undefined}
{activeLink && method === "UPDATE" ? (
<>
<p className="ml-10 mt-[0.1rem] text-xl mb-3 font-thin">Edit Link</p>
@@ -46,19 +50,10 @@ export default function LinkModal({
</>
) : undefined}
{method === "CREATE" ? (
{method === "FORMATS" ? (
<>
<p className="ml-10 mt-[0.1rem] text-xl mb-3 font-thin">
Create a New Link
</p>
<AddOrEditLink toggleLinkModal={toggleLinkModal} method="CREATE" />
</>
) : undefined}
{activeLink && method === "FORMATS" ? (
<>
<p className="ml-10 mt-[0.1rem] text-xl mb-3 font-thin">
Manage Preserved Formats
Preserved Formats
</p>
<PreservedFormats />
</>