diff --git a/pages/collections/[id].tsx b/pages/collections/[id].tsx index 920a834..1a7ce62 100644 --- a/pages/collections/[id].tsx +++ b/pages/collections/[id].tsx @@ -14,7 +14,7 @@ import { } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { useRouter } from "next/router"; -import { useEffect, useState } from "react"; +import { ChangeEvent, useEffect, useState } from "react"; import MainLayout from "@/layouts/MainLayout"; import { useSession } from "next-auth/react"; import ProfilePhoto from "@/components/ProfilePhoto"; @@ -58,6 +58,10 @@ export default function () { setDeleteCollectionModal(!deleteCollectionModal); }; + const handleSortChange = (event: ChangeEvent) => { + setSortBy(event.target.value); + }; + useEffect(() => { setActiveCollection( collections.find((e) => e.id === Number(router.query.id)) @@ -120,7 +124,7 @@ export default function () { >
setSortBy(e.target.value)} + handleSortChange={handleSortChange} sortBy={sortBy} toggleSortDropdown={() => setSortDropdown(!sortDropdown)} /> diff --git a/pages/collections/index.tsx b/pages/collections/index.tsx index 234e985..114e0b8 100644 --- a/pages/collections/index.tsx +++ b/pages/collections/index.tsx @@ -81,10 +81,15 @@ export default function () {
-
-
- -

All Collections

+
+
+ +

+ All Collections +

b.linkCount - a.linkCount) as any ); + + // console.log(links.length); }, [collections]); return ( @@ -34,30 +36,33 @@ export default function () {
-
+
-

Dashboard

+

+ Dashboard +

-
+
-

{links.length}

-

Links

+

{links.length}

+

+ Links + {/* {links.length == 1 ? "Links" : "Link"} */} +

-

- {collections.length} -

+

{collections.length}

Collections

-

{tags.length}

+

{tags.length}

Tags

diff --git a/pages/links.tsx b/pages/links.tsx index e72a586..b020775 100644 --- a/pages/links.tsx +++ b/pages/links.tsx @@ -52,12 +52,14 @@ export default function Links() {
-
+
-

All Links

+

+ All Links +

@@ -75,7 +77,7 @@ export default function Links() { {sortDropdown ? ( setSortBy(e.target.value)} + handleSortChange={handleSortChange} sortBy={sortBy} toggleSortDropdown={() => setSortDropdown(!sortDropdown)} /> diff --git a/pages/search.tsx b/pages/search.tsx index fdf9371..2f2b54d 100644 --- a/pages/search.tsx +++ b/pages/search.tsx @@ -2,6 +2,7 @@ import Checkbox from "@/components/Checkbox"; import ClickAwayHandler from "@/components/ClickAwayHandler"; import LinkList from "@/components/LinkList"; import RadioButton from "@/components/RadioButton"; +import SortLinkDropdown from "@/components/SortLinkDropdown"; import MainLayout from "@/layouts/MainLayout"; import useLinkStore from "@/store/links"; import useSearchSettingsStore from "@/store/search"; @@ -148,54 +149,11 @@ export default function Links() {
{sortDropdown ? ( - { - const target = e.target as HTMLInputElement; - if (target.id !== "sort-dropdown") setSortDropdown(false); - }} - className="absolute top-8 right-0 shadow-md bg-gray-50 rounded-md p-2 z-10 border border-sky-100 w-48" - > -

- Sort by -

-
- - - - - - - - - - - -
-
+ setSortDropdown(!sortDropdown)} + /> ) : null}
diff --git a/pages/tags/[id].tsx b/pages/tags/[id].tsx index 8c862ef..57d677e 100644 --- a/pages/tags/[id].tsx +++ b/pages/tags/[id].tsx @@ -5,8 +5,6 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { useRouter } from "next/router"; import { ChangeEvent, useEffect, useState } from "react"; import MainLayout from "@/layouts/MainLayout"; -import RadioButton from "@/components/RadioButton"; -import ClickAwayHandler from "@/components/ClickAwayHandler"; import { Tag } from "@prisma/client"; import useTagStore from "@/store/tags"; import SortLinkDropdown from "@/components/SortLinkDropdown"; @@ -70,12 +68,14 @@ export default function () {
-
+
-

{activeTag?.name}

+

+ {activeTag?.name} +

@@ -94,7 +94,7 @@ export default function () { {sortDropdown ? ( setSortBy(e.target.value)} + handleSortChange={handleSortChange} sortBy={sortBy} toggleSortDropdown={() => setSortDropdown(!sortDropdown)} />