improvements

This commit is contained in:
daniel31x13
2023-12-13 06:59:36 -05:00
parent ca3eb29c48
commit a001f70b9d
11 changed files with 138 additions and 69 deletions
@@ -103,12 +103,9 @@ export default function DeleteCollectionModal({
/>
</svg>
<span>
<b>
Warning: Deleting this collection will permanently erase all
its contents
</b>
, and it will become inaccessible to everyone, including members
with previous access.
<b>Warning:</b> Deleting this collection will permanently erase
all its contents, and it will become inaccessible to everyone,
including members with previous access.
</span>
</div>
</>
+3 -1
View File
@@ -70,7 +70,9 @@ export default function DeleteLinkModal({ onClose, activeLink }: Props) {
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
/>
</svg>
<span>Warning: This action is irreversible!</span>
<span>
<b>Warning:</b> This action is irreversible!
</span>
</div>
<p>
@@ -1,9 +1,4 @@
import React, { useEffect, useState } from "react";
import { Toaster } from "react-hot-toast";
import CollectionSelection from "@/components/InputSelect/CollectionSelection";
import TagSelection from "@/components/InputSelect/TagSelection";
import TextInput from "@/components/TextInput";
import unescapeString from "@/lib/client/unescapeString";
import useLinkStore from "@/store/links";
import {
ArchivedFormat,
@@ -23,6 +18,10 @@ import Modal from "../Modal";
import { faFileImage, faFilePdf } from "@fortawesome/free-regular-svg-icons";
import { useRouter } from "next/router";
import { useSession } from "next-auth/react";
import {
pdfAvailable,
screenshotAvailable,
} from "@/lib/shared/getArchiveValidity";
type Props = {
onClose: Function;
@@ -114,7 +113,7 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
<div className="divider mb-3 mt-1"></div>
<div className={`flex flex-col gap-3`}>
{link?.screenshotPath && link?.screenshotPath !== "pending" ? (
{screenshotAvailable(link) ? (
<div className="flex justify-between items-center pr-1 border border-neutral-content rounded-md">
<div className="flex gap-2 items-center">
<div className="bg-primary text-primary-content p-2 rounded-l-md">
@@ -137,7 +136,7 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
<Link
href={`/api/v1/archives/${link?.id}?format=${
link.screenshotPath.endsWith("png")
link.screenshotPath?.endsWith("png")
? ArchivedFormat.png
: ArchivedFormat.jpeg
}`}
@@ -192,12 +191,7 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
{link?.collection.ownerId === session.data?.user.id ? (
<div
className={`btn btn-accent w-1/2 dark:border-violet-400 text-white ${
link?.pdfPath &&
link?.screenshotPath &&
link?.pdfPath !== "pending" &&
link?.screenshotPath !== "pending"
? "mt-3"
: ""
screenshotAvailable(link) && pdfAvailable(link) ? "mt-3" : ""
}`}
onClick={() => updateArchive()}
>
@@ -214,12 +208,7 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
)}`}
target="_blank"
className={`text-neutral duration-100 hover:opacity-60 flex gap-2 w-1/2 justify-center items-center text-sm ${
link?.pdfPath &&
link?.screenshotPath &&
link?.pdfPath !== "pending" &&
link?.screenshotPath !== "pending"
? "sm:mt-3"
: ""
screenshotAvailable(link) && pdfAvailable(link) ? "sm:mt-3" : ""
}`}
>
<p className="whitespace-nowrap">