use monolith instead of singlefile

This commit is contained in:
daniel31x13
2024-06-27 21:58:07 -04:00
parent 5b8e1d53cc
commit a71f42af6e
25 changed files with 90 additions and 88 deletions
@@ -68,7 +68,7 @@ export default function EditCollectionSharingModal({
username: "",
image: "",
archiveAsScreenshot: undefined as unknown as boolean,
archiveAsSinglefile: undefined as unknown as boolean,
archiveAsMonolith: undefined as unknown as boolean,
archiveAsPDF: undefined as unknown as boolean,
});
+1 -1
View File
@@ -30,7 +30,7 @@ export default function NewLinkModal({ onClose }: Props) {
image: "",
pdf: "",
readable: "",
singlefile: "",
monolith: "",
textContent: "",
collection: {
name: "",
@@ -12,7 +12,7 @@ import { useSession } from "next-auth/react";
import {
pdfAvailable,
readabilityAvailable,
singlefileAvailable,
monolithAvailable,
screenshotAvailable,
} from "@/lib/shared/getArchiveValidity";
import PreservedFormatRow from "@/components/PreserverdFormatRow";
@@ -43,7 +43,7 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
username: "",
image: "",
archiveAsScreenshot: undefined as unknown as boolean,
archiveAsSinglefile: undefined as unknown as boolean,
archiveAsMonolith: undefined as unknown as boolean,
archiveAsPDF: undefined as unknown as boolean,
});
@@ -61,7 +61,7 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
username: account.username as string,
image: account.image as string,
archiveAsScreenshot: account.archiveAsScreenshot as boolean,
archiveAsSinglefile: account.archiveAsScreenshot as boolean,
archiveAsMonolith: account.archiveAsScreenshot as boolean,
archiveAsPDF: account.archiveAsPDF as boolean,
});
}
@@ -76,8 +76,8 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
(collectionOwner.archiveAsScreenshot === true
? link.pdf && link.pdf !== "pending"
: true) &&
(collectionOwner.archiveAsSinglefile === true
? link.singlefile && link.singlefile !== "pending"
(collectionOwner.archiveAsMonolith === true
? link.monolith && link.monolith !== "pending"
: true) &&
(collectionOwner.archiveAsPDF === true
? link.pdf && link.pdf !== "pending"
@@ -92,7 +92,7 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
screenshotAvailable(link) ||
pdfAvailable(link) ||
readabilityAvailable(link) ||
singlefileAvailable(link)
monolithAvailable(link)
);
};
@@ -124,7 +124,7 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
clearInterval(interval);
}
};
}, [link?.singlefile]);
}, [link?.monolith]);
const updateArchive = async () => {
const load = toast.loading(t("sending_request"));
@@ -152,18 +152,18 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
{screenshotAvailable(link) ||
pdfAvailable(link) ||
readabilityAvailable(link) ||
singlefileAvailable(link) ? (
monolithAvailable(link) ? (
<p className="mb-3">{t("available_formats")}</p>
) : (
""
)}
<div className={`flex flex-col gap-3`}>
{singlefileAvailable(link) ? (
{monolithAvailable(link) ? (
<PreservedFormatRow
name={t("webpage")}
icon={"bi-filetype-html"}
format={ArchivedFormat.singlefile}
format={ArchivedFormat.monolith}
activeLink={link}
downloadable={true}
/>
+6 -5
View File
@@ -33,7 +33,7 @@ export default function UploadFileModal({ onClose }: Props) {
image: "",
pdf: "",
readable: "",
singlefile: "",
monolith: "",
textContent: "",
collection: {
name: "",
@@ -97,7 +97,7 @@ export default function UploadFileModal({ onClose }: Props) {
const submit = async () => {
if (!submitLoader && file) {
let fileType: ArchivedFormat | null = null;
let linkType: "url" | "image" | "singlefile" | "pdf" | null = null;
let linkType: "url" | "image" | "monolith" | "pdf" | null = null;
if (file?.type === "image/jpg" || file.type === "image/jpeg") {
fileType = ArchivedFormat.jpeg;
@@ -105,13 +105,14 @@ export default function UploadFileModal({ onClose }: Props) {
} else if (file.type === "image/png") {
fileType = ArchivedFormat.png;
linkType = "image";
} else if (file.type === "text/html") {
fileType = ArchivedFormat.singlefile;
linkType = "singlefile";
} else if (file.type === "application/pdf") {
fileType = ArchivedFormat.pdf;
linkType = "pdf";
}
// else if (file.type === "text/html") {
// fileType = ArchivedFormat.monolith;
// linkType = "monolith";
// }
setSubmitLoader(true);
const load = toast.loading(t("creating"));