Other Collections
diff --git a/pages/links/index.tsx b/pages/links/index.tsx
index 6364e40..dfade81 100644
--- a/pages/links/index.tsx
+++ b/pages/links/index.tsx
@@ -5,9 +5,8 @@ import useLinks from "@/hooks/useLinks";
import MainLayout from "@/layouts/MainLayout";
import useLinkStore from "@/store/links";
import { Sort } from "@/types/global";
-import { faLink } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { useState } from "react";
+import React, { useState } from "react";
+import PageHeader from "@/components/PageHeader";
export default function Links() {
const { links } = useLinkStore();
@@ -19,23 +18,18 @@ export default function Links() {
return (
-
-
-
-
-
All Links
-
-
Links from every Collections
-
-
+
+
+
{links[0] ? (
{links.map((e, i) => {
diff --git a/pages/links/pinned.tsx b/pages/links/pinned.tsx
index ac52af2..a4a70f8 100644
--- a/pages/links/pinned.tsx
+++ b/pages/links/pinned.tsx
@@ -4,9 +4,8 @@ import useLinks from "@/hooks/useLinks";
import MainLayout from "@/layouts/MainLayout";
import useLinkStore from "@/store/links";
import { Sort } from "@/types/global";
-import { faThumbTack } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { useState } from "react";
+import React, { useState } from "react";
+import PageHeader from "@/components/PageHeader";
export default function PinnedLinks() {
const { links } = useLinkStore();
@@ -18,19 +17,12 @@ export default function PinnedLinks() {
return (
-
-
-
-
-
Pinned Links
-
-
Pinned Links from your Collections
-
-
-
+
+
From d906391ae2fee33eeedf28448c69364754913c1c Mon Sep 17 00:00:00 2001
From: Yee Jia Wei
Date: Sun, 17 Dec 2023 15:35:09 +0800
Subject: [PATCH 07/30] minor fix
---
components/SortDropdown.tsx | 2 --
pages/dashboard.tsx | 17 +++++++++--------
pages/links/index.tsx | 19 ++++++-------------
pages/links/pinned.tsx | 12 +++---------
4 files changed, 18 insertions(+), 32 deletions(-)
diff --git a/components/SortDropdown.tsx b/components/SortDropdown.tsx
index e125e6b..3f57e9f 100644
--- a/components/SortDropdown.tsx
+++ b/components/SortDropdown.tsx
@@ -1,7 +1,5 @@
import React, { Dispatch, SetStateAction } from "react";
import { Sort } from "@/types/global";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { faSort } from "@fortawesome/free-solid-svg-icons";
type Props = {
sortBy: Sort;
diff --git a/pages/dashboard.tsx b/pages/dashboard.tsx
index 352cff9..1c65f33 100644
--- a/pages/dashboard.tsx
+++ b/pages/dashboard.tsx
@@ -2,7 +2,6 @@ import useLinkStore from "@/store/links";
import useCollectionStore from "@/store/collections";
import useTagStore from "@/store/tags";
import MainLayout from "@/layouts/MainLayout";
-import LinkCard from "@/components/LinkCard";
import LinkCard from "@/components/LinkViews/LinkComponents/LinkCard";
import { useEffect, useState } from "react";
import useLinks from "@/hooks/useLinks";
@@ -95,9 +94,10 @@ export default function Dashboard() {
return (
-
+
-
+
- {false && links[0] ? (
+ {links[0] ? (
{links.slice(0, showLinks).map((e, i) => (
-
+
))}
@@ -186,7 +186,8 @@ export default function Dashboard() {
Import From
-
+
{links
.filter((e) => e.pinnedBy && e.pinnedBy[0])
- .map((e, i) => )
+ .map((e, i) => )
.slice(0, showLinks)}
@@ -281,7 +282,7 @@ export default function Dashboard() {
{newLinkModal ? (
-
setNewLinkModal(false)} />
+ setNewLinkModal(false)}/>
) : undefined}
);
diff --git a/pages/links/index.tsx b/pages/links/index.tsx
index 72e455f..873bb6f 100644
--- a/pages/links/index.tsx
+++ b/pages/links/index.tsx
@@ -1,19 +1,13 @@
-import LinkCard from "@/components/LinkViews/LinkComponents/LinkCard";
import NoLinksFound from "@/components/NoLinksFound";
import SortDropdown from "@/components/SortDropdown";
import useLinks from "@/hooks/useLinks";
import MainLayout from "@/layouts/MainLayout";
import useLinkStore from "@/store/links";
-import { Sort } from "@/types/global";
import React, { useState } from "react";
import PageHeader from "@/components/PageHeader";
import { Sort, ViewMode } from "@/types/global";
-import { faLink } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { useState } from "react";
import ViewDropdown from "@/components/ViewDropdown";
import DefaultView from "@/components/LinkViews/DefaultView";
-import GridView from "@/components/LinkViews/GridView";
import ListView from "@/components/LinkViews/ListView";
@@ -44,17 +38,16 @@ export default function Links() {
title={"All Links"}
description={"Links from every Collections"}
/>
-
-
-
-
-
+
+
+
+
{links[0] ? (
-
+
) : (
-
+
)}
diff --git a/pages/links/pinned.tsx b/pages/links/pinned.tsx
index 81a7252..4d8cb15 100644
--- a/pages/links/pinned.tsx
+++ b/pages/links/pinned.tsx
@@ -1,18 +1,12 @@
-import LinkCard from "@/components/LinkViews/LinkComponents/LinkCard";
import SortDropdown from "@/components/SortDropdown";
import useLinks from "@/hooks/useLinks";
import MainLayout from "@/layouts/MainLayout";
import useLinkStore from "@/store/links";
-import { Sort } from "@/types/global";
import React, { useState } from "react";
import PageHeader from "@/components/PageHeader";
import { Sort, ViewMode } from "@/types/global";
-import { faThumbTack } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { useState } from "react";
import ViewDropdown from "@/components/ViewDropdown";
import DefaultView from "@/components/LinkViews/DefaultView";
-import GridView from "@/components/LinkViews/GridView";
import ListView from "@/components/LinkViews/ListView";
export default function PinnedLinks() {
@@ -44,12 +38,12 @@ export default function PinnedLinks() {
/>
{links.some((e) => e.pinnedBy && e.pinnedBy[0]) ? (
-
+
) : (
Date: Sun, 17 Dec 2023 16:22:08 +0800
Subject: [PATCH 08/30] update link action icons
---
.../LinkViews/LinkComponents/LinkActions.tsx | 24 +--
components/ModalContent/DeleteLinkModal.tsx | 24 +--
components/ModalContent/EditLinkModal.tsx | 20 +--
.../ModalContent/PreservedFormatsModal.tsx | 155 ++----------------
components/PreserverdFormatRow.tsx | 137 ++++++++++++++++
5 files changed, 164 insertions(+), 196 deletions(-)
create mode 100644 components/PreserverdFormatRow.tsx
diff --git a/components/LinkViews/LinkComponents/LinkActions.tsx b/components/LinkViews/LinkComponents/LinkActions.tsx
index 9f53a05..5bd18c0 100644
--- a/components/LinkViews/LinkComponents/LinkActions.tsx
+++ b/components/LinkViews/LinkComponents/LinkActions.tsx
@@ -4,8 +4,6 @@ import {
LinkIncludingShortenedCollectionAndTags,
} from "@/types/global";
import usePermissions from "@/hooks/usePermissions";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { faEllipsis } from "@fortawesome/free-solid-svg-icons";
import EditLinkModal from "@/components/ModalContent/EditLinkModal";
import DeleteLinkModal from "@/components/ModalContent/DeleteLinkModal";
import PreservedFormatsModal from "@/components/ModalContent/PreservedFormatsModal";
@@ -13,15 +11,13 @@ import useLinkStore from "@/store/links";
import { toast } from "react-hot-toast";
import useAccountStore from "@/store/account";
-export default function LinkActions({
- link,
- collection,
- position,
-}: {
+type Props = {
link: LinkIncludingShortenedCollectionAndTags;
collection: CollectionIncludingMembersAndLinkCount;
position?: string;
-}) {
+}
+
+export default function LinkActions({ link, collection, position }: Props) {
const permissions = usePermissions(link.collection.id as number);
const [editLinkModal, setEditLinkModal] = useState(false);
@@ -46,7 +42,7 @@ export default function LinkActions({
toast.dismiss(load);
response.ok &&
- toast.success(`Link ${isAlreadyPinned ? "Unpinned!" : "Pinned!"}`);
+ toast.success(`Link ${isAlreadyPinned ? "Unpinned!" : "Pinned!"}`);
};
const deleteLink = async () => {
@@ -74,14 +70,10 @@ export default function LinkActions({
role="button"
className="btn btn-ghost btn-sm btn-square text-neutral"
>
-
+
-
+
{permissions === true ? (
Are you sure you want to delete this Link?
-
-
-
+
Warning: This action is irreversible!
@@ -84,7 +64,7 @@ export default function DeleteLinkModal({ onClose, activeLink }: Props) {
className={`ml-auto btn w-fit text-white flex items-center gap-2 duration-100 bg-red-500 hover:bg-red-400 hover:dark:bg-red-600 cursor-pointer`}
onClick={deleteLink}
>
-
+
Delete
diff --git a/components/ModalContent/EditLinkModal.tsx b/components/ModalContent/EditLinkModal.tsx
index 94e2ce8..bb43efd 100644
--- a/components/ModalContent/EditLinkModal.tsx
+++ b/components/ModalContent/EditLinkModal.tsx
@@ -1,5 +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";
@@ -8,8 +7,6 @@ import useLinkStore from "@/store/links";
import { LinkIncludingShortenedCollectionAndTags } from "@/types/global";
import toast from "react-hot-toast";
import Link from "next/link";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { faLink } from "@fortawesome/free-solid-svg-icons";
import Modal from "../Modal";
type Props = {
@@ -89,10 +86,7 @@ export default function EditLinkModal({ onClose, activeLink }: Props) {
title={link.url}
target="_blank"
>
-
+
{shortendURL}
) : undefined}
@@ -122,13 +116,13 @@ export default function EditLinkModal({ onClose, activeLink }: Props) {
defaultValue={
link.collection.id
? {
- value: link.collection.id,
- label: link.collection.name,
- }
+ value: link.collection.id,
+ label: link.collection.name,
+ }
: {
- value: null as unknown as number,
- label: "Unorganized",
- }
+ value: null as unknown as number,
+ label: "Unorganized",
+ }
}
/>
) : null}
diff --git a/components/ModalContent/PreservedFormatsModal.tsx b/components/ModalContent/PreservedFormatsModal.tsx
index 964dab5..73f6cc8 100644
--- a/components/ModalContent/PreservedFormatsModal.tsx
+++ b/components/ModalContent/PreservedFormatsModal.tsx
@@ -1,32 +1,13 @@
import React, { useEffect, useState } from "react";
import useLinkStore from "@/store/links";
-import {
- ArchivedFormat,
- LinkIncludingShortenedCollectionAndTags,
-} from "@/types/global";
+import { ArchivedFormat, LinkIncludingShortenedCollectionAndTags, } from "@/types/global";
import toast from "react-hot-toast";
import Link from "next/link";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import {
- faArrowUpRightFromSquare,
- faCloudArrowDown,
- faLink,
- faTrashCan,
- faUpRightFromSquare,
-} from "@fortawesome/free-solid-svg-icons";
import Modal from "../Modal";
-import {
- faFileImage,
- faFileLines,
- faFilePdf,
-} from "@fortawesome/free-regular-svg-icons";
import { useRouter } from "next/router";
import { useSession } from "next-auth/react";
-import {
- pdfAvailable,
- readabilityAvailable,
- screenshotAvailable,
-} from "@/lib/shared/getArchiveValidity";
+import { pdfAvailable, readabilityAvailable, screenshotAvailable, } from "@/lib/shared/getArchiveValidity";
+import PreservedFormatRow from "@/components/PreserverdFormatRow";
type Props = {
onClose: Function;
@@ -92,25 +73,6 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
} else toast.error(data.response);
};
- const handleDownload = (format: ArchivedFormat) => {
- const path = `/api/v1/archives/${link?.id}?format=${format}`;
- fetch(path)
- .then((response) => {
- if (response.ok) {
- // Create a temporary link and click it to trigger the download
- const link = document.createElement("a");
- link.href = path;
- link.download = format === ArchivedFormat.png ? "Screenshot" : "PDF";
- link.click();
- } else {
- console.error("Failed to download file");
- }
- })
- .catch((error) => {
- console.error("Error:", error);
- });
- };
-
return (
Preserved Formats
@@ -129,112 +91,18 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
{readabilityAvailable(link) ? (
-
-
-
-
- {/*
handleDownload(ArchivedFormat.pdf)}
- className="cursor-pointer hover:opacity-60 duration-100 p-2 rounded-md"
- >
-
-
*/}
-
-
-
-
-
-
+
) : undefined}
{screenshotAvailable(link) ? (
-
-
-
-
-
handleDownload(ArchivedFormat.png)}
- className="cursor-pointer hover:opacity-60 duration-100 p-2 rounded-md"
- >
-
-
-
-
-
-
-
-
+
) : undefined}
{pdfAvailable(link) ? (
-
-
-
-
-
handleDownload(ArchivedFormat.pdf)}
- className="cursor-pointer hover:opacity-60 duration-100 p-2 rounded-md"
- >
-
-
-
-
-
-
-
-
+
) : undefined}
@@ -272,10 +140,7 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) {
View latest snapshot on archive.org
-
+
diff --git a/components/PreserverdFormatRow.tsx b/components/PreserverdFormatRow.tsx
new file mode 100644
index 0000000..499e448
--- /dev/null
+++ b/components/PreserverdFormatRow.tsx
@@ -0,0 +1,137 @@
+import React, { useEffect, useState } from "react";
+import useLinkStore from "@/store/links";
+import {
+ ArchivedFormat,
+ LinkIncludingShortenedCollectionAndTags,
+} from "@/types/global";
+import toast from "react-hot-toast";
+import Link from "next/link";
+import { useRouter } from "next/router";
+import { useSession } from "next-auth/react";
+
+type Props = {
+ name: string,
+ icon: string,
+ format: ArchivedFormat,
+ activeLink: LinkIncludingShortenedCollectionAndTags,
+ downloadable?: boolean,
+};
+
+export default function PreservedFormatRow({ name, icon, format, activeLink, downloadable }: Props) {
+ const session = useSession();
+ const { getLink } = useLinkStore();
+
+ const [link, setLink] =
+ useState(activeLink);
+
+ const router = useRouter();
+
+ useEffect(() => {
+ let isPublicRoute = router.pathname.startsWith("/public")
+ ? true
+ : undefined;
+
+ (async () => {
+ const data = await getLink(link.id as number, isPublicRoute);
+ setLink(
+ (data as any).response as LinkIncludingShortenedCollectionAndTags
+ );
+ })();
+
+ let interval: any;
+ if (link?.screenshotPath === "pending" || link?.pdfPath === "pending") {
+ interval = setInterval(async () => {
+ const data = await getLink(link.id as number, isPublicRoute);
+ setLink(
+ (data as any).response as LinkIncludingShortenedCollectionAndTags
+ );
+ }, 5000);
+ } else {
+ if (interval) {
+ clearInterval(interval);
+ }
+ }
+
+ return () => {
+ if (interval) {
+ clearInterval(interval);
+ }
+ };
+ }, [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)
+ .then((response) => {
+ if (response.ok) {
+ // Create a temporary link and click it to trigger the download
+ const link = document.createElement("a");
+ link.href = path;
+ link.download = format === ArchivedFormat.png ? "Screenshot" : "PDF";
+ link.click();
+ } else {
+ console.error("Failed to download file");
+ }
+ })
+ .catch((error) => {
+ console.error("Error:", error);
+ });
+ };
+
+ return (
+
+
+
+
+ {downloadable || false ? (
+
handleDownload()}
+ className="cursor-pointer hover:opacity-60 duration-100 p-2 rounded-md"
+ >
+
+
+ ) : undefined}
+
+
+
+
+
+
+ );
+}
From 500f7a338c3048aaefad17162c5de2094b7d99f8 Mon Sep 17 00:00:00 2001
From: Yee Jia Wei
Date: Sun, 17 Dec 2023 16:30:09 +0800
Subject: [PATCH 09/30] update link component icons
---
components/LinkViews/LinkComponents/LinkCard.tsx | 14 ++++++--------
.../LinkViews/LinkComponents/LinkCollection.tsx | 14 +++-----------
components/LinkViews/LinkComponents/LinkDate.tsx | 9 +++------
components/LinkViews/LinkComponents/LinkIcon.tsx | 12 ++++--------
4 files changed, 16 insertions(+), 33 deletions(-)
diff --git a/components/LinkViews/LinkComponents/LinkCard.tsx b/components/LinkViews/LinkComponents/LinkCard.tsx
index a1787d1..2336124 100644
--- a/components/LinkViews/LinkComponents/LinkCard.tsx
+++ b/components/LinkViews/LinkComponents/LinkCard.tsx
@@ -2,9 +2,7 @@ import {
CollectionIncludingMembersAndLinkCount,
LinkIncludingShortenedCollectionAndTags,
} from "@/types/global";
-import { faLink } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { useEffect, useState } from "react";
+import React, { useEffect, useState } from "react";
import useLinkStore from "@/store/links";
import useCollectionStore from "@/store/collections";
import isValidUrl from "@/lib/shared/isValidUrl";
@@ -62,7 +60,7 @@ export default function LinkCard({ link, count, className }: Props) {
className="flex flex-col justify-between cursor-pointer h-full w-full gap-1 p-3"
>
-
+
@@ -74,19 +72,19 @@ export default function LinkCard({ link, count, className }: Props) {
{link.url ? (
) : (
{link.type}
)}
-
+
-
+
-
+
);
}
diff --git a/components/LinkViews/LinkComponents/LinkCollection.tsx b/components/LinkViews/LinkComponents/LinkCollection.tsx
index 16c9bb5..4eafee7 100644
--- a/components/LinkViews/LinkComponents/LinkCollection.tsx
+++ b/components/LinkViews/LinkComponents/LinkCollection.tsx
@@ -2,14 +2,10 @@ import {
CollectionIncludingMembersAndLinkCount,
LinkIncludingShortenedCollectionAndTags,
} from "@/types/global";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { faFolder } from "@fortawesome/free-solid-svg-icons";
import { useRouter } from "next/router";
+import React from "react";
-export default function LinkCollection({
- link,
- collection,
-}: {
+export default function LinkCollection({ link, collection }: {
link: LinkIncludingShortenedCollectionAndTags;
collection: CollectionIncludingMembersAndLinkCount;
}) {
@@ -23,11 +19,7 @@ export default function LinkCollection({
}}
className="flex items-center gap-1 max-w-full w-fit hover:opacity-70 duration-100"
>
-
+
{collection?.name}
);
diff --git a/components/LinkViews/LinkComponents/LinkDate.tsx b/components/LinkViews/LinkComponents/LinkDate.tsx
index 282ab70..04f1a0d 100644
--- a/components/LinkViews/LinkComponents/LinkDate.tsx
+++ b/components/LinkViews/LinkComponents/LinkDate.tsx
@@ -1,10 +1,7 @@
import { LinkIncludingShortenedCollectionAndTags } from "@/types/global";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { faCalendarDays } from "@fortawesome/free-regular-svg-icons";
+import React from "react";
-export default function LinkDate({
- link,
-}: {
+export default function LinkDate({ link }: {
link: LinkIncludingShortenedCollectionAndTags;
}) {
const formattedDate = new Date(link.createdAt as string).toLocaleString(
@@ -18,7 +15,7 @@ export default function LinkDate({
return (
);
diff --git a/components/LinkViews/LinkComponents/LinkIcon.tsx b/components/LinkViews/LinkComponents/LinkIcon.tsx
index f09149c..4e423bf 100644
--- a/components/LinkViews/LinkComponents/LinkIcon.tsx
+++ b/components/LinkViews/LinkComponents/LinkIcon.tsx
@@ -1,13 +1,9 @@
import { LinkIncludingShortenedCollectionAndTags } from "@/types/global";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { faFileImage, faFilePdf } from "@fortawesome/free-regular-svg-icons";
import Image from "next/image";
import isValidUrl from "@/lib/shared/isValidUrl";
+import React from "react";
-export default function LinkIcon({
- link,
- width,
-}: {
+export default function LinkIcon({ link, width }: {
link: LinkIncludingShortenedCollectionAndTags;
width?: string;
}) {
@@ -35,9 +31,9 @@ export default function LinkIcon({
}}
/>
) : link.type === "pdf" ? (
-
+
) : link.type === "image" ? (
-
+
) : undefined}
);
From cf1306d2c436e3f6de3d1a1cdb3bd6f0f64f09b1 Mon Sep 17 00:00:00 2001
From: Yee Jia Wei
Date: Sun, 17 Dec 2023 16:46:21 +0800
Subject: [PATCH 10/30] update collection action icons
---
components/CollectionCard.tsx | 26 +++++++------------
.../ModalContent/DeleteCollectionModal.tsx | 24 ++---------------
.../ModalContent/EditCollectionModal.tsx | 13 +++-------
.../EditCollectionSharingModal.tsx | 2 +-
4 files changed, 16 insertions(+), 49 deletions(-)
diff --git a/components/CollectionCard.tsx b/components/CollectionCard.tsx
index 97e0b63..f3615e2 100644
--- a/components/CollectionCard.tsx
+++ b/components/CollectionCard.tsx
@@ -1,10 +1,7 @@
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { faEllipsis, faGlobe, faLink } from "@fortawesome/free-solid-svg-icons";
import Link from "next/link";
import { CollectionIncludingMembersAndLinkCount } from "@/types/global";
-import { useEffect, useState } from "react";
+import React, { useEffect, useState } from "react";
import ProfilePhoto from "./ProfilePhoto";
-import { faCalendarDays } from "@fortawesome/free-regular-svg-icons";
import usePermissions from "@/hooks/usePermissions";
import useLocalSettingsStore from "@/store/localSettings";
import getPublicUserData from "@/lib/client/getPublicUserData";
@@ -71,9 +68,10 @@ export default function CollectionCard({ collection, className }: Props) {
role="button"
className="btn btn-ghost btn-sm btn-square text-neutral"
>
-
+
-
+
{permissions === true ? (
{collection.isPublic ? (
-
+
) : undefined}
-
+
{collection._count && collection._count.links}
- {" "}
+
{formattedDate}
diff --git a/components/ModalContent/DeleteCollectionModal.tsx b/components/ModalContent/DeleteCollectionModal.tsx
index 29eb737..5407f68 100644
--- a/components/ModalContent/DeleteCollectionModal.tsx
+++ b/components/ModalContent/DeleteCollectionModal.tsx
@@ -2,11 +2,6 @@ import React, { useEffect, useState } from "react";
import TextInput from "@/components/TextInput";
import useCollectionStore from "@/store/collections";
import toast from "react-hot-toast";
-import {
- faRightFromBracket,
- faTrashCan,
-} from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { CollectionIncludingMembersAndLinkCount } from "@/types/global";
import { useRouter } from "next/router";
import usePermissions from "@/hooks/usePermissions";
@@ -89,19 +84,7 @@ export default function DeleteCollectionModal({
-
-
-
+
Warning: Deleting this collection will permanently erase
all its contents, and it will become inaccessible to everyone,
@@ -124,10 +107,7 @@ export default function DeleteCollectionModal({
}`}
onClick={submit}
>
-
+
{permissions === true ? "Delete" : "Leave"} Collection
diff --git a/components/ModalContent/EditCollectionModal.tsx b/components/ModalContent/EditCollectionModal.tsx
index 991f6af..8821f6f 100644
--- a/components/ModalContent/EditCollectionModal.tsx
+++ b/components/ModalContent/EditCollectionModal.tsx
@@ -1,10 +1,8 @@
-import React, { useEffect, useState } from "react";
+import React, { useState } from "react";
import TextInput from "@/components/TextInput";
import useCollectionStore from "@/store/collections";
-import toast, { Toaster } from "react-hot-toast";
-import { faFolder } from "@fortawesome/free-solid-svg-icons";
+import toast from "react-hot-toast";
import { HexColorPicker } from "react-colorful";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { CollectionIncludingMembersAndLinkCount } from "@/types/global";
import Modal from "../Modal";
@@ -70,12 +68,7 @@ export default function EditCollectionModal({
Color
-
-
-
+
diff --git a/components/ModalContent/EditCollectionSharingModal.tsx b/components/ModalContent/EditCollectionSharingModal.tsx
index 3b2eade..4bb41d0 100644
--- a/components/ModalContent/EditCollectionSharingModal.tsx
+++ b/components/ModalContent/EditCollectionSharingModal.tsx
@@ -182,7 +182,7 @@ export default function EditCollectionSharingModal({
}
className="btn btn-accent text-white btn-square btn-sm h-10 w-10"
>
-
+
>
From 5f095b563177c4d93e876a547cd02a403fe2af46 Mon Sep 17 00:00:00 2001
From: Yee Jia Wei
Date: Sun, 17 Dec 2023 16:47:32 +0800
Subject: [PATCH 11/30] minor fix
---
pages/links/pinned.tsx | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/pages/links/pinned.tsx b/pages/links/pinned.tsx
index 4d8cb15..48446f9 100644
--- a/pages/links/pinned.tsx
+++ b/pages/links/pinned.tsx
@@ -36,12 +36,11 @@ export default function PinnedLinks() {
title={"Pinned Links"}
description={"Pinned Links from your Collections"}
/>
-
-
-
-
-
+
+
+
+
{links.some((e) => e.pinnedBy && e.pinnedBy[0]) ? (
) : (
From 4210913277abf14704e8c261517ecd91aa338920 Mon Sep 17 00:00:00 2001
From: Yee Jia Wei
Date: Sun, 17 Dec 2023 16:57:05 +0800
Subject: [PATCH 12/30] update search page icons
---
components/FilterSearchDropdown.tsx | 10 +++-------
components/PageHeader.tsx | 2 +-
components/SortDropdown.tsx | 11 +++--------
pages/search.tsx | 20 ++++----------------
4 files changed, 11 insertions(+), 32 deletions(-)
diff --git a/components/FilterSearchDropdown.tsx b/components/FilterSearchDropdown.tsx
index a4cd804..1fa2634 100644
--- a/components/FilterSearchDropdown.tsx
+++ b/components/FilterSearchDropdown.tsx
@@ -1,6 +1,4 @@
import React from "react";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { faFilter } from "@fortawesome/free-solid-svg-icons";
type Props = {
setSearchFilter: Function;
@@ -24,11 +22,9 @@ export default function FilterSearchDropdown({
role="button"
className="btn btn-sm btn-square btn-ghost"
>
-
+
diff --git a/components/PageHeader.tsx b/components/PageHeader.tsx
index b169feb..e19b59c 100644
--- a/components/PageHeader.tsx
+++ b/components/PageHeader.tsx
@@ -6,7 +6,7 @@ export default function PageHeader({
icon,
}: {
title: string;
- description: string;
+ description?: string;
icon: string;
}) {
return (
diff --git a/components/SortDropdown.tsx b/components/SortDropdown.tsx
index 3f57e9f..046331c 100644
--- a/components/SortDropdown.tsx
+++ b/components/SortDropdown.tsx
@@ -14,14 +14,9 @@ export default function SortDropdown({ sortBy, setSort }: Props) {
role="button"
className="btn btn-sm btn-square btn-ghost"
>
-
-
-
+
diff --git a/pages/search.tsx b/pages/search.tsx
index 51bd539..5511ce0 100644
--- a/pages/search.tsx
+++ b/pages/search.tsx
@@ -1,18 +1,16 @@
import FilterSearchDropdown from "@/components/FilterSearchDropdown";
-import LinkCard from "@/components/LinkViews/LinkComponents/LinkCard";
import SortDropdown from "@/components/SortDropdown";
import useLinks from "@/hooks/useLinks";
import MainLayout from "@/layouts/MainLayout";
import useLinkStore from "@/store/links";
import { Sort, ViewMode } from "@/types/global";
-import { faFilter, faSearch, faSort } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useRouter } from "next/router";
-import { useState } from "react";
+import React, { useState } from "react";
import ViewDropdown from "@/components/ViewDropdown";
import DefaultView from "@/components/LinkViews/DefaultView";
import GridView from "@/components/LinkViews/GridView";
import ListView from "@/components/LinkViews/ListView";
+import PageHeader from "@/components/PageHeader";
export default function Search() {
const { links } = useLinkStore();
@@ -56,19 +54,9 @@ export default function Search() {
return (
-
-
+
+
Date: Sun, 17 Dec 2023 17:08:00 +0800
Subject: [PATCH 13/30] update announcement bar icon
---
components/AnnouncementBar.tsx | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/components/AnnouncementBar.tsx b/components/AnnouncementBar.tsx
index e20d3d9..839a438 100644
--- a/components/AnnouncementBar.tsx
+++ b/components/AnnouncementBar.tsx
@@ -1,5 +1,3 @@
-import { faClose } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import Link from "next/link";
import React, { MouseEventHandler } from "react";
@@ -24,10 +22,12 @@ export default function AnnouncementBar({ toggleAnnouncementBar }: Props) {
-
+
From 15c6213840a8314d9d0169b5d110bc843fc9bebe Mon Sep 17 00:00:00 2001
From: Yee Jia Wei
Date: Sun, 17 Dec 2023 17:08:12 +0800
Subject: [PATCH 14/30] update modal icons
---
components/Modal.tsx | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/components/Modal.tsx b/components/Modal.tsx
index 2ddf656..035b633 100644
--- a/components/Modal.tsx
+++ b/components/Modal.tsx
@@ -1,7 +1,5 @@
-import { MouseEventHandler, ReactNode, useEffect } from "react";
+import React, { MouseEventHandler, ReactNode } from "react";
import ClickAwayHandler from "@/components/ClickAwayHandler";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { faClose } from "@fortawesome/free-solid-svg-icons";
type Props = {
toggleModal: Function;
@@ -21,9 +19,11 @@ export default function Modal({ toggleModal, className, children }: Props) {
}
- className="absolute top-3 right-3 btn btn-sm outline-none btn-circle btn-ghost z-10"
+ className="absolute top-4 right-3 btn btn-sm outline-none btn-circle btn-ghost z-10"
>
-
+
{children}
From de13a109c6099e5f566fe080624a0d23c1f64419 Mon Sep 17 00:00:00 2001
From: Yee Jia Wei
Date: Sun, 17 Dec 2023 17:08:20 +0800
Subject: [PATCH 15/30] update readable view icons
---
components/ReadableView.tsx | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/components/ReadableView.tsx b/components/ReadableView.tsx
index 57a7c02..4828b75 100644
--- a/components/ReadableView.tsx
+++ b/components/ReadableView.tsx
@@ -6,8 +6,6 @@ import {
ArchivedFormat,
LinkIncludingShortenedCollectionAndTags,
} from "@/types/global";
-import { faFolder, faLink } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import ColorThief, { RGBColor } from "colorthief";
import DOMPurify from "dompurify";
import Image from "next/image";
@@ -174,7 +172,9 @@ export default function ReadableView({ link }: Props) {
target="_blank"
className="hover:opacity-60 duration-100 break-all text-sm flex items-center gap-1 text-neutral w-fit"
>
-
+
{isValidUrl(link?.url || "")
? new URL(link?.url as string).host
@@ -189,11 +189,10 @@ export default function ReadableView({ link }: Props) {
href={`/collections/${link?.collection.id}`}
className="flex items-center gap-1 cursor-pointer hover:opacity-60 duration-100 mr-2 z-10"
>
-
+ >
Date: Sun, 17 Dec 2023 17:08:34 +0800
Subject: [PATCH 16/30] update not link found icons
---
components/NoLinksFound.tsx | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/components/NoLinksFound.tsx b/components/NoLinksFound.tsx
index 4364ac7..b4ef8f7 100644
--- a/components/NoLinksFound.tsx
+++ b/components/NoLinksFound.tsx
@@ -1,5 +1,3 @@
-import { faPlus } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import React, { useState } from "react";
import NewLinkModal from "./ModalContent/NewLinkModal";
@@ -35,10 +33,9 @@ export default function NoLinksFound({ text }: Props) {
}}
className="inline-flex gap-1 relative w-[11rem] items-center btn btn-accent dark:border-violet-400 text-white group"
>
-
+
Create New Link
From dc6c17f8c4c1fb2107346aea09ade7eb4d0afb52 Mon Sep 17 00:00:00 2001
From: Yee Jia Wei
Date: Sun, 17 Dec 2023 17:18:31 +0800
Subject: [PATCH 17/30] update setting sidebar icons
---
components/SettingsSidebar.tsx | 77 ++++++++++++++--------------------
1 file changed, 31 insertions(+), 46 deletions(-)
diff --git a/components/SettingsSidebar.tsx b/components/SettingsSidebar.tsx
index 76ec12d..1649abf 100644
--- a/components/SettingsSidebar.tsx
+++ b/components/SettingsSidebar.tsx
@@ -1,15 +1,8 @@
import useCollectionStore from "@/store/collections";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import {
- faUser,
- faPalette,
- faBoxArchive,
- faKey,
- faLock,
-} from "@fortawesome/free-solid-svg-icons";
import Link from "next/link";
import { useRouter } from "next/router";
-import { useEffect, useState } from "react";
+import React, { useEffect, useState } from "react";
import {
faCircleQuestion,
faCreditCard,
@@ -48,7 +41,9 @@ export default function SettingsSidebar({ className }: { className?: string }) {
: "hover:bg-neutral/20"
} duration-100 py-5 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
>
-
+
Account
@@ -62,10 +57,9 @@ export default function SettingsSidebar({ className }: { className?: string }) {
: "hover:bg-neutral/20"
} duration-100 py-5 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
>
-
+
Appearance
@@ -79,11 +73,9 @@ export default function SettingsSidebar({ className }: { className?: string }) {
: "hover:bg-neutral/20"
} duration-100 py-5 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
>
-
-
+
Archive
@@ -96,8 +88,9 @@ export default function SettingsSidebar({ className }: { className?: string }) {
: "hover:bg-neutral/20"
} duration-100 py-5 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
>
-
-
+
API Keys
@@ -110,8 +103,9 @@ export default function SettingsSidebar({ className }: { className?: string }) {
: "hover:bg-neutral/20"
} duration-100 py-5 px-2 cursor-pointer flex items-center gap-2 w-full rounded-md h-8`}
>
-