added seed script + renamed table fields + added field

This commit is contained in:
daniel31x13
2023-12-22 13:13:43 -05:00
parent 385bdc2343
commit 98106b9f25
15 changed files with 957 additions and 370 deletions
+4 -3
View File
@@ -25,9 +25,10 @@ export default function NewLinkModal({ onClose }: Props) {
description: "",
type: "url",
tags: [],
screenshotPath: "",
pdfPath: "",
readabilityPath: "",
preview: "",
image: "",
pdf: "",
readable: "",
textContent: "",
collection: {
name: "",
@@ -70,12 +70,12 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
const isReady = () => {
return (
collectionOwner.archiveAsScreenshot ===
(link && link.pdfPath && link.pdfPath !== "pending") &&
(link && link.pdf && link.pdf !== "pending") &&
collectionOwner.archiveAsPDF ===
(link && link.pdfPath && link.pdfPath !== "pending") &&
(link && link.pdf && link.pdf !== "pending") &&
link &&
link.readabilityPath &&
link.readabilityPath !== "pending"
link.readable &&
link.readable !== "pending"
);
};
@@ -107,7 +107,7 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
clearInterval(interval);
}
};
}, [link?.screenshotPath, link?.pdfPath, link?.readabilityPath]);
}, [link?.image, link?.pdf, link?.readable]);
const updateArchive = async () => {
const load = toast.loading("Sending request...");
@@ -154,7 +154,7 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
name={"Screenshot"}
icon={"bi-file-earmark-image"}
format={
link?.screenshotPath?.endsWith("png")
link?.image?.endsWith("png")
? ArchivedFormat.png
: ArchivedFormat.jpeg
}
+4 -3
View File
@@ -27,9 +27,10 @@ export default function UploadFileModal({ onClose }: Props) {
description: "",
type: "url",
tags: [],
screenshotPath: "",
pdfPath: "",
readabilityPath: "",
preview: "",
image: "",
pdf: "",
readable: "",
textContent: "",
collection: {
name: "",
+2 -2
View File
@@ -43,7 +43,7 @@ export default function PreservedFormatRow({
})();
let interval: any;
if (link?.screenshotPath === "pending" || link?.pdfPath === "pending") {
if (link?.image === "pending" || link?.pdf === "pending") {
interval = setInterval(async () => {
const data = await getLink(link.id as number, isPublic);
setLink(
@@ -61,7 +61,7 @@ export default function PreservedFormatRow({
clearInterval(interval);
}
};
}, [link?.screenshotPath, link?.pdfPath, link?.readabilityPath]);
}, [link?.image, link?.pdf, link?.readable]);
const handleDownload = () => {
const path = `/api/v1/archives/${link?.id}?format=${format}`;
+9 -11
View File
@@ -62,12 +62,12 @@ export default function ReadableView({ link }: Props) {
let interval: any;
if (
link &&
(link?.screenshotPath === "pending" ||
link?.pdfPath === "pending" ||
link?.readabilityPath === "pending" ||
!link?.screenshotPath ||
!link?.pdfPath ||
!link?.readabilityPath)
(link?.image === "pending" ||
link?.pdf === "pending" ||
link?.readable === "pending" ||
!link?.image ||
!link?.pdf ||
!link?.readable)
) {
interval = setInterval(() => getLink(link.id as number), 5000);
} else {
@@ -81,7 +81,7 @@ export default function ReadableView({ link }: Props) {
clearInterval(interval);
}
};
}, [link?.screenshotPath, link?.pdfPath, link?.readabilityPath]);
}, [link?.image, link?.pdf, link?.readable]);
const rgbToHex = (r: number, g: number, b: number): string =>
"#" +
@@ -225,7 +225,7 @@ export default function ReadableView({ link }: Props) {
</div>
<div className="flex flex-col gap-5 h-full">
{link?.readabilityPath?.startsWith("archives") ? (
{link?.readable?.startsWith("archives") ? (
<div
className="line-break px-1 reader-view"
dangerouslySetInnerHTML={{
@@ -235,9 +235,7 @@ export default function ReadableView({ link }: Props) {
) : (
<div
className={`w-full h-full flex flex-col justify-center p-10 ${
link?.readabilityPath === "pending" || !link?.readabilityPath
? "skeleton"
: ""
link?.readable === "pending" || !link?.readable ? "skeleton" : ""
}`}
>
<svg