From f8811a49c0cc7c6f684b1fc1de044e93ab691486 Mon Sep 17 00:00:00 2001 From: daniel31x13 Date: Tue, 5 Dec 2023 15:17:36 -0500 Subject: [PATCH] improved UI --- .vscode/settings.json | 1 + components/CollectionCard.tsx | 2 +- components/LinkCard.tsx | 109 ++++++++++-------- .../ModalContent/DeleteCollectionModal.tsx | 2 +- components/ModalContent/DeleteLinkModal.tsx | 2 +- .../ModalContent/EditCollectionModal.tsx | 2 +- .../EditCollectionSharingModal.tsx | 4 +- components/ModalContent/EditLinkModal.tsx | 2 +- .../ModalContent/NewCollectionModal.tsx | 2 +- components/ModalContent/NewLinkModal.tsx | 2 +- components/ModalContent/UploadFileModal.tsx | 23 +++- pages/collections/index.tsx | 2 +- 12 files changed, 92 insertions(+), 61 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1 @@ +{} diff --git a/components/CollectionCard.tsx b/components/CollectionCard.tsx index d2f59b5..97e0b63 100644 --- a/components/CollectionCard.tsx +++ b/components/CollectionCard.tsx @@ -65,7 +65,7 @@ export default function CollectionCard({ collection, className }: Props) { return (
-
+
router.push("/links/" + link.id)} - className="flex items-start cursor-pointer gap-5 sm:gap-10 h-full w-full p-4" + className="flex flex-col justify-between cursor-pointer h-full w-full gap-1 p-3" > - {url && ( + {link.url && url ? ( { const target = e.target as HTMLElement; target.style.display = "none"; }} /> + ) : link.type === "pdf" ? ( + + ) : link.type === "image" ? ( + + ) : undefined} + +
+

{count + 1}

+

+ {unescapeString(link.name || link.description) || shortendURL} +

+
+ + {link.type === "url" ? ( + { + e.stopPropagation(); + }} + className="flex items-center gap-1 max-w-full w-fit text-neutral hover:opacity-70 duration-100" + > + +

{shortendURL}

+ + ) : ( +
{link.type}
)} -
-
-
-

{count + 1}

-

- {unescapeString(link.name || link.description)} -

-
- { - e.stopPropagation(); - }} - className="flex items-center gap-1 max-w-full w-fit my-1 hover:opacity-70 duration-100" - > - -

{collection?.name}

- + { + e.stopPropagation(); + }} + className="flex items-center gap-1 max-w-full w-fit hover:opacity-70 duration-100" + > + +

{collection?.name}

+ - { - e.stopPropagation(); - }} - className="flex items-center gap-1 max-w-full w-fit text-neutral hover:opacity-70 duration-100" - > - -

{shortendURL}

- -
- -

{formattedDate}

-
- {link.tags[0] ? ( +
+ +

{formattedDate}

+
+ {/* {link.tags[0] ? (
{link.tags.map((e, i) => ( @@ -285,9 +306,7 @@ export default function LinkCard({ link, count, className }: Props) {
) : (

No Tags

- )} -
-
+ )} */}
{editLinkModal ? ( -
+
{permissions === true ? ( diff --git a/components/ModalContent/DeleteLinkModal.tsx b/components/ModalContent/DeleteLinkModal.tsx index 21ccc94..bb78396 100644 --- a/components/ModalContent/DeleteLinkModal.tsx +++ b/components/ModalContent/DeleteLinkModal.tsx @@ -44,7 +44,7 @@ export default function DeleteLinkModal({ onClose, activeLink }: Props) {

Delete Link

-
+

Are you sure you want to delete this Link?

diff --git a/components/ModalContent/EditCollectionModal.tsx b/components/ModalContent/EditCollectionModal.tsx index 96ddf71..34d2502 100644 --- a/components/ModalContent/EditCollectionModal.tsx +++ b/components/ModalContent/EditCollectionModal.tsx @@ -51,7 +51,7 @@ export default function EditCollectionModal({

Edit Collection Info

-
+
diff --git a/components/ModalContent/EditCollectionSharingModal.tsx b/components/ModalContent/EditCollectionSharingModal.tsx index a3fd163..2bd7a41 100644 --- a/components/ModalContent/EditCollectionSharingModal.tsx +++ b/components/ModalContent/EditCollectionSharingModal.tsx @@ -99,7 +99,7 @@ export default function EditCollectionSharingModal({ {permissions === true ? "Share and Collaborate" : "Team"}

-
+
{permissions === true && ( @@ -203,7 +203,7 @@ export default function EditCollectionSharingModal({
diff --git a/components/ModalContent/EditLinkModal.tsx b/components/ModalContent/EditLinkModal.tsx index 27157c8..d626e70 100644 --- a/components/ModalContent/EditLinkModal.tsx +++ b/components/ModalContent/EditLinkModal.tsx @@ -80,7 +80,7 @@ export default function EditLinkModal({ onClose, activeLink }: Props) {

Edit Link

-
+
{link.url ? (

Create a New Collection

-
+
diff --git a/components/ModalContent/NewLinkModal.tsx b/components/ModalContent/NewLinkModal.tsx index 307339d..afca87d 100644 --- a/components/ModalContent/NewLinkModal.tsx +++ b/components/ModalContent/NewLinkModal.tsx @@ -120,7 +120,7 @@ export default function NewLinkModal({ onClose }: Props) {

Create a New Link

-
+
diff --git a/components/ModalContent/UploadFileModal.tsx b/components/ModalContent/UploadFileModal.tsx index 42faf6d..887ce67 100644 --- a/components/ModalContent/UploadFileModal.tsx +++ b/components/ModalContent/UploadFileModal.tsx @@ -104,20 +104,31 @@ export default function UploadFileModal({ onClose }: Props) { const submit = async () => { if (!submitLoader && file) { let fileType: ArchivedFormat | null = null; + let linkType: "url" | "image" | "pdf" | null = null; - if (file?.type === "image/jpg" || file.type === "image/jpeg") + if (file?.type === "image/jpg" || file.type === "image/jpeg") { fileType = ArchivedFormat.jpeg; - else if (file.type === "image/png") fileType = ArchivedFormat.png; - else if (file.type === "application/pdf") fileType = ArchivedFormat.pdf; + linkType = "image"; + } else if (file.type === "image/png") { + fileType = ArchivedFormat.png; + linkType = "image"; + } else if (file.type === "application/pdf") { + fileType = ArchivedFormat.pdf; + linkType = "pdf"; + } - if (fileType !== null) { + if (fileType !== null && linkType !== null) { setSubmitLoader(true); let response; const load = toast.loading("Creating..."); - response = await addLink(link); + response = await addLink({ + ...link, + type: linkType, + name: link.name ? link.name : file.name.replace(/\.[^/.]+$/, ""), + }); toast.dismiss(load); @@ -150,7 +161,7 @@ export default function UploadFileModal({ onClose }: Props) {

Upload File

-
+

File

diff --git a/pages/collections/index.tsx b/pages/collections/index.tsx index ca3fd4a..16795fc 100644 --- a/pages/collections/index.tsx +++ b/pages/collections/index.tsx @@ -57,7 +57,7 @@ export default function Collections() { className="w-5 h-5" />
-
    +