From 7e9eae0ef2902677a4ded674de81234fe72035d9 Mon Sep 17 00:00:00 2001 From: Trey Gordon <41927921+treyg@users.noreply.github.com> Date: Fri, 29 Dec 2023 12:29:10 -0500 Subject: [PATCH] style: change to neutral to handle new themes --- pages/dashboard.tsx | 516 ++++++++++++++++++++++---------------------- 1 file changed, 258 insertions(+), 258 deletions(-) diff --git a/pages/dashboard.tsx b/pages/dashboard.tsx index 18973c7d..5987e042 100644 --- a/pages/dashboard.tsx +++ b/pages/dashboard.tsx @@ -19,293 +19,293 @@ import ViewDropdown from "@/components/ViewDropdown"; // import GridView from "@/components/LinkViews/Layouts/GridView"; export default function Dashboard() { - const { collections } = useCollectionStore(); - const { links } = useLinkStore(); - const { tags } = useTagStore(); + const { collections } = useCollectionStore(); + const { links } = useLinkStore(); + const { tags } = useTagStore(); - const [numberOfLinks, setNumberOfLinks] = useState(0); + const [numberOfLinks, setNumberOfLinks] = useState(0); - const [showLinks, setShowLinks] = useState(3); + const [showLinks, setShowLinks] = useState(3); - useLinks({ pinnedOnly: true, sort: 0 }); + useLinks({ pinnedOnly: true, sort: 0 }); - useEffect(() => { - setNumberOfLinks( - collections.reduce( - (accumulator, collection) => - accumulator + (collection._count as any).links, - 0 - ) - ); - }, [collections]); + useEffect(() => { + setNumberOfLinks( + collections.reduce( + (accumulator, collection) => + accumulator + (collection._count as any).links, + 0 + ) + ); + }, [collections]); - const handleNumberOfLinksToShow = () => { - if (window.innerWidth > 1900) { - setShowLinks(8); - } else if (window.innerWidth > 1280) { - setShowLinks(6); - } else if (window.innerWidth > 650) { - setShowLinks(4); - } else setShowLinks(3); - }; + const handleNumberOfLinksToShow = () => { + if (window.innerWidth > 1900) { + setShowLinks(8); + } else if (window.innerWidth > 1280) { + setShowLinks(6); + } else if (window.innerWidth > 650) { + setShowLinks(4); + } else setShowLinks(3); + }; - const { width } = useWindowDimensions(); + const { width } = useWindowDimensions(); - useEffect(() => { - handleNumberOfLinksToShow(); - }, [width]); + useEffect(() => { + handleNumberOfLinksToShow(); + }, [width]); - const importBookmarks = async (e: any, format: MigrationFormat) => { - const file: File = e.target.files[0]; + const importBookmarks = async (e: any, format: MigrationFormat) => { + const file: File = e.target.files[0]; - if (file) { - var reader = new FileReader(); - reader.readAsText(file, "UTF-8"); - reader.onload = async function (e) { - const load = toast.loading("Importing..."); + if (file) { + var reader = new FileReader(); + reader.readAsText(file, "UTF-8"); + reader.onload = async function (e) { + const load = toast.loading("Importing..."); - const request: string = e.target?.result as string; + const request: string = e.target?.result as string; - const body: MigrationRequest = { - format, - data: request, - }; + const body: MigrationRequest = { + format, + data: request, + }; - const response = await fetch("/api/v1/migration", { - method: "POST", - body: JSON.stringify(body), - }); + const response = await fetch("/api/v1/migration", { + method: "POST", + body: JSON.stringify(body), + }); - const data = await response.json(); + const data = await response.json(); - toast.dismiss(load); + toast.dismiss(load); - toast.success("Imported the Bookmarks! Reloading the page..."); + toast.success("Imported the Bookmarks! Reloading the page..."); - setTimeout(() => { - location.reload(); - }, 2000); - }; - reader.onerror = function (e) { - console.log("Error:", e); - }; - } - }; + setTimeout(() => { + location.reload(); + }, 2000); + }; + reader.onerror = function (e) { + console.log("Error:", e); + }; + } + }; - const [newLinkModal, setNewLinkModal] = useState(false); + const [newLinkModal, setNewLinkModal] = useState(false); - const [viewMode, setViewMode] = useState( - localStorage.getItem("viewMode") || ViewMode.Card - ); + const [viewMode, setViewMode] = useState( + localStorage.getItem("viewMode") || ViewMode.Card + ); - const linkView = { - [ViewMode.Card]: CardView, - // [ViewMode.Grid]: GridView, - [ViewMode.List]: ListView, - }; + const linkView = { + [ViewMode.Card]: CardView, + // [ViewMode.Grid]: GridView, + [ViewMode.List]: ListView, + }; - // @ts-ignore - const LinkComponent = linkView[viewMode]; + // @ts-ignore + const LinkComponent = linkView[viewMode]; - return ( - -
-
- - -
- -
-
- - -
- - - -
- - -
-
- -
-
- -
- - View All - - -
- -
- {links[0] ? ( -
- + return ( + +
+
+ +
- ) : ( + +
+
+ + +
+ + + +
+ + +
+
+ +
+
+ +
+ + View All + + +
+
-

- View Your Recently Added Links Here! -

-

- This section will view your latest added Links across every - Collections you have access to. -

- -
-
{ - setNewLinkModal(true); - }} - className="inline-flex items-center gap-2 text-sm btn btn-accent dark:border-violet-400 text-white" - > - - - Add New Link - -
- -
-
- -

Import From

+ {links[0] ? ( +
+
-
    -
  • - -
  • -
  • - -
  • -
-
-
-
- )} -
+ ) : ( +
+

+ View Your Recently Added Links Here! +

+

+ This section will view your latest added Links across every + Collections you have access to. +

-
-
- -
- - View All - - -
+
+
{ + setNewLinkModal(true); + }} + className="inline-flex items-center gap-2 text-sm btn btn-accent dark:border-violet-400 text-white" + > + + + Add New Link + +
-
- {links.some((e) => e.pinnedBy && e.pinnedBy[0]) ? ( -
-
- {links - .filter((e) => e.pinnedBy && e.pinnedBy[0]) - .map((e, i) => ) - .slice(0, showLinks)} -
+
+
+ +

Import From

+
+
    +
  • + +
  • +
  • + +
  • +
+
+
+
+ )}
- ) : ( + +
+
+ +
+ + View All + + +
+
-

- Pin Your Favorite Links Here! -

-

- You can Pin your favorite Links by clicking on the three dots on - each Link and clicking{" "} - Pin to Dashboard. -

+ {links.some((e) => e.pinnedBy && e.pinnedBy[0]) ? ( +
+
+ {links + .filter((e) => e.pinnedBy && e.pinnedBy[0]) + .map((e, i) => ) + .slice(0, showLinks)} +
+
+ ) : ( +
+

+ Pin Your Favorite Links Here! +

+

+ You can Pin your favorite Links by clicking on the three dots on + each Link and clicking{" "} + Pin to Dashboard. +

+
+ )}
- )} -
-
- {newLinkModal ? ( - setNewLinkModal(false)} /> - ) : undefined} -
- ); +
+ {newLinkModal ? ( + setNewLinkModal(false)} /> + ) : undefined} + + ); }