diff --git a/.env.sample b/.env.sample index c3174e6..270538e 100644 --- a/.env.sample +++ b/.env.sample @@ -16,6 +16,7 @@ NEXT_PUBLIC_CREDENTIALS_ENABLED= DISABLE_NEW_SSO_USERS= RE_ARCHIVE_LIMIT= NEXT_PUBLIC_MAX_FILE_SIZE= +MAX_LINKS_PER_USER= # AWS S3 Settings SPACES_KEY= diff --git a/components/LinkViews/LinkComponents/LinkActions.tsx b/components/LinkViews/LinkComponents/LinkActions.tsx index 5bd18c0..015e32d 100644 --- a/components/LinkViews/LinkComponents/LinkActions.tsx +++ b/components/LinkViews/LinkComponents/LinkActions.tsx @@ -15,7 +15,7 @@ type Props = { link: LinkIncludingShortenedCollectionAndTags; collection: CollectionIncludingMembersAndLinkCount; position?: string; -} +}; export default function LinkActions({ link, collection, position }: Props) { const permissions = usePermissions(link.collection.id as number); @@ -23,7 +23,6 @@ export default function LinkActions({ link, collection, position }: Props) { const [editLinkModal, setEditLinkModal] = useState(false); const [deleteLinkModal, setDeleteLinkModal] = useState(false); const [preservedFormatsModal, setPreservedFormatsModal] = useState(false); - const [expandedLink, setExpandedLink] = useState(false); const { account } = useAccountStore(); @@ -42,7 +41,7 @@ export default function LinkActions({ link, collection, position }: Props) { toast.dismiss(load); response.ok && - toast.success(`Link ${isAlreadyPinned ? "Unpinned!" : "Pinned!"}`); + toast.success(`Link ${isAlreadyPinned ? "Unpinned!" : "Pinned!"}`); }; const deleteLink = async () => { @@ -57,85 +56,82 @@ export default function LinkActions({ link, collection, position }: Props) { return (
- The Link preservation is in the queue + Link preservation is in the queue
Please check back later to see the result diff --git a/components/PreserverdFormatRow.tsx b/components/PreserverdFormatRow.tsx index e470829..393bee8 100644 --- a/components/PreserverdFormatRow.tsx +++ b/components/PreserverdFormatRow.tsx @@ -32,13 +32,11 @@ export default function PreservedFormatRow({ const router = useRouter(); - useEffect(() => { - let isPublicRoute = router.pathname.startsWith("/public") - ? true - : undefined; + let isPublic = router.pathname.startsWith("/public") ? true : undefined; + useEffect(() => { (async () => { - const data = await getLink(link.id as number, isPublicRoute); + const data = await getLink(link.id as number, isPublic); setLink( (data as any).response as LinkIncludingShortenedCollectionAndTags ); @@ -47,7 +45,7 @@ export default function PreservedFormatRow({ let interval: any; if (link?.screenshotPath === "pending" || link?.pdfPath === "pending") { interval = setInterval(async () => { - const data = await getLink(link.id as number, isPublicRoute); + const data = await getLink(link.id as number, isPublic); setLink( (data as any).response as LinkIncludingShortenedCollectionAndTags ); @@ -65,23 +63,6 @@ export default function PreservedFormatRow({ }; }, [link?.screenshotPath, link?.pdfPath, link?.readabilityPath]); - const updateArchive = async () => { - const load = toast.loading("Sending request..."); - - const response = await fetch(`/api/v1/links/${link?.id}/archive`, { - method: "PUT", - }); - - const data = await response.json(); - - toast.dismiss(load); - - if (response.ok) { - toast.success(`Link is being archived...`); - getLink(link?.id as number); - } else toast.error(data.response); - }; - const handleDownload = () => { const path = `/api/v1/archives/${link?.id}?format=${format}`; fetch(path) @@ -121,7 +102,9 @@ export default function PreservedFormatRow({ ) : undefined} diff --git a/components/PublicPage/PublicLinkCard.tsx b/components/PublicPage/PublicLinkCard.tsx index f683061..97c9586 100644 --- a/components/PublicPage/PublicLinkCard.tsx +++ b/components/PublicPage/PublicLinkCard.tsx @@ -4,6 +4,8 @@ import isValidUrl from "@/lib/shared/isValidUrl"; import unescapeString from "@/lib/client/unescapeString"; import { TagIncludingLinkCount } from "@/types/global"; import Link from "next/link"; +import { useState } from "react"; +import PreservedFormatsModal from "../ModalContent/PreservedFormatsModal"; interface LinksIncludingTags extends LinkType { tags: TagIncludingLinkCount[]; @@ -25,6 +27,8 @@ export default function LinkCard({ link, count }: Props) { day: "numeric", }); + const [preservedFormatsModal, setPreservedFormatsModal] = useState(false); + return (
Read
+Visit