diff --git a/components/LinkViews/LinkComponents/LinkActions.tsx b/components/LinkViews/LinkComponents/LinkActions.tsx
index 9f53a05..5bd18c0 100644
--- a/components/LinkViews/LinkComponents/LinkActions.tsx
+++ b/components/LinkViews/LinkComponents/LinkActions.tsx
@@ -4,8 +4,6 @@ import {
LinkIncludingShortenedCollectionAndTags,
} from "@/types/global";
import usePermissions from "@/hooks/usePermissions";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { faEllipsis } from "@fortawesome/free-solid-svg-icons";
import EditLinkModal from "@/components/ModalContent/EditLinkModal";
import DeleteLinkModal from "@/components/ModalContent/DeleteLinkModal";
import PreservedFormatsModal from "@/components/ModalContent/PreservedFormatsModal";
@@ -13,15 +11,13 @@ import useLinkStore from "@/store/links";
import { toast } from "react-hot-toast";
import useAccountStore from "@/store/account";
-export default function LinkActions({
- link,
- collection,
- position,
-}: {
+type Props = {
link: LinkIncludingShortenedCollectionAndTags;
collection: CollectionIncludingMembersAndLinkCount;
position?: string;
-}) {
+}
+
+export default function LinkActions({ link, collection, position }: Props) {
const permissions = usePermissions(link.collection.id as number);
const [editLinkModal, setEditLinkModal] = useState(false);
@@ -46,7 +42,7 @@ export default function LinkActions({
toast.dismiss(load);
response.ok &&
- toast.success(`Link ${isAlreadyPinned ? "Unpinned!" : "Pinned!"}`);
+ toast.success(`Link ${isAlreadyPinned ? "Unpinned!" : "Pinned!"}`);
};
const deleteLink = async () => {
@@ -74,14 +70,10 @@ export default function LinkActions({
role="button"
className="btn btn-ghost btn-sm btn-square text-neutral"
>
-
{shortendURL}
) : undefined} @@ -122,13 +116,13 @@ export default function EditLinkModal({ onClose, activeLink }: Props) { defaultValue={ link.collection.id ? { - value: link.collection.id, - label: link.collection.name, - } + value: link.collection.id, + label: link.collection.name, + } : { - value: null as unknown as number, - label: "Unorganized", - } + value: null as unknown as number, + label: "Unorganized", + } } /> ) : null} diff --git a/components/ModalContent/PreservedFormatsModal.tsx b/components/ModalContent/PreservedFormatsModal.tsx index 964dab5..73f6cc8 100644 --- a/components/ModalContent/PreservedFormatsModal.tsx +++ b/components/ModalContent/PreservedFormatsModal.tsx @@ -1,32 +1,13 @@ import React, { useEffect, useState } from "react"; import useLinkStore from "@/store/links"; -import { - ArchivedFormat, - LinkIncludingShortenedCollectionAndTags, -} from "@/types/global"; +import { ArchivedFormat, LinkIncludingShortenedCollectionAndTags, } from "@/types/global"; import toast from "react-hot-toast"; import Link from "next/link"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { - faArrowUpRightFromSquare, - faCloudArrowDown, - faLink, - faTrashCan, - faUpRightFromSquare, -} from "@fortawesome/free-solid-svg-icons"; import Modal from "../Modal"; -import { - faFileImage, - faFileLines, - faFilePdf, -} from "@fortawesome/free-regular-svg-icons"; import { useRouter } from "next/router"; import { useSession } from "next-auth/react"; -import { - pdfAvailable, - readabilityAvailable, - screenshotAvailable, -} from "@/lib/shared/getArchiveValidity"; +import { pdfAvailable, readabilityAvailable, screenshotAvailable, } from "@/lib/shared/getArchiveValidity"; +import PreservedFormatRow from "@/components/PreserverdFormatRow"; type Props = { onClose: Function; @@ -92,25 +73,6 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) { } else toast.error(data.response); }; - const handleDownload = (format: ArchivedFormat) => { - const path = `/api/v1/archives/${link?.id}?format=${format}`; - fetch(path) - .then((response) => { - if (response.ok) { - // Create a temporary link and click it to trigger the download - const link = document.createElement("a"); - link.href = path; - link.download = format === ArchivedFormat.png ? "Screenshot" : "PDF"; - link.click(); - } else { - console.error("Failed to download file"); - } - }) - .catch((error) => { - console.error("Error:", error); - }); - }; - return (Preserved Formats
@@ -129,112 +91,18 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {Readable
-Screenshot
-View latest snapshot on archive.org
-{name}
+