+ );
+}
diff --git a/components/Search.tsx b/components/SearchBar.tsx
similarity index 82%
rename from components/Search.tsx
rename to components/SearchBar.tsx
index 842b205..df0b9a4 100644
--- a/components/Search.tsx
+++ b/components/SearchBar.tsx
@@ -4,24 +4,17 @@ import { useState } from "react";
import { useRouter } from "next/router";
import { toast } from "react-hot-toast";
-export default function Search() {
+export default function SearchBar() {
const router = useRouter();
- const routeQuery = router.query.query;
+ const routeQuery = router.query.q;
const [searchQuery, setSearchQuery] = useState(
routeQuery ? decodeURIComponent(routeQuery as string) : ""
);
- const [searchBox, setSearchBox] = useState(
- router.pathname.startsWith("/search") || false
- );
-
return (
-
setSearchBox(true)}
- >
+
diff --git a/components/ToggleDarkMode.tsx b/components/ToggleDarkMode.tsx
index 0ba36b8..cff56c0 100644
--- a/components/ToggleDarkMode.tsx
+++ b/components/ToggleDarkMode.tsx
@@ -2,7 +2,11 @@ import { useTheme } from "next-themes";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faSun, faMoon } from "@fortawesome/free-solid-svg-icons";
-export default function ToggleDarkMode() {
+type Props = {
+ className?: string;
+};
+
+export default function ToggleDarkMode({ className }: Props) {
const { theme, setTheme } = useTheme();
const handleToggle = () => {
@@ -15,15 +19,13 @@ export default function ToggleDarkMode() {
return (
);
}
diff --git a/lib/client/getPublicCollectionData.ts b/lib/client/getPublicCollectionData.ts
index d7452c4..283733b 100644
--- a/lib/client/getPublicCollectionData.ts
+++ b/lib/client/getPublicCollectionData.ts
@@ -11,8 +11,6 @@ const getPublicCollectionData = async (
const data = await res.json();
- console.log(data);
-
setData(data.response);
return data;
diff --git a/package.json b/package.json
index a77e211..0078a7b 100644
--- a/package.json
+++ b/package.json
@@ -22,7 +22,6 @@
"@fortawesome/react-fontawesome": "^0.2.0",
"@headlessui/react": "^1.7.15",
"@mozilla/readability": "^0.4.4",
- "@next/font": "13.4.9",
"@prisma/client": "^4.16.2",
"@stripe/stripe-js": "^1.54.1",
"@types/crypto-js": "^4.1.1",
@@ -40,6 +39,7 @@
"eslint-config-next": "13.4.9",
"framer-motion": "^10.16.4",
"jsdom": "^22.1.0",
+ "lottie-web": "^5.12.2",
"micro": "^10.0.1",
"next": "13.4.12",
"next-auth": "^4.22.1",
diff --git a/pages/public/collections/[id].tsx b/pages/public/collections/[id].tsx
index 3317cfc..ab31b87 100644
--- a/pages/public/collections/[id].tsx
+++ b/pages/public/collections/[id].tsx
@@ -11,6 +11,16 @@ import useLinkStore from "@/store/links";
import ProfilePhoto from "@/components/ProfilePhoto";
import useModalStore from "@/store/modals";
import ModalManagement from "@/components/ModalManagement";
+import ToggleDarkMode from "@/components/ToggleDarkMode";
+import { useTheme } from "next-themes";
+import getPublicUserData from "@/lib/client/getPublicUserData";
+import Image from "next/image";
+import Link from "next/link";
+import PublicSearchBar from "@/components/PublicSearchBar";
+import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { faFilter, faSort } from "@fortawesome/free-solid-svg-icons";
+import FilterSearchDropdown from "@/components/FilterSearchDropdown";
+import SortDropdown from "@/components/SortDropdown";
const cardVariants: Variants = {
offscreen: {
@@ -28,10 +38,27 @@ const cardVariants: Variants = {
export default function PublicCollections() {
const { links } = useLinkStore();
- const { setModal } = useModalStore();
+ const { modal, setModal } = useModalStore();
+
+ useEffect(() => {
+ modal
+ ? (document.body.style.overflow = "hidden")
+ : (document.body.style.overflow = "auto");
+ }, [modal]);
+
+ const { theme } = useTheme();
const router = useRouter();
+ const [collectionOwner, setCollectionOwner] = useState({
+ id: null,
+ name: "",
+ username: "",
+ image: "",
+ });
+
+ useEffect(() => {}, []);
+
const [searchFilter, setSearchFilter] = useState({
name: true,
url: true,
@@ -59,31 +86,34 @@ export default function PublicCollections() {
const [collection, setCollection] =
useState
();
- document.body.style.background = "white";
-
useEffect(() => {
if (router.query.id) {
getPublicCollectionData(Number(router.query.id), setCollection);
}
-
- // document
- // .querySelector("body")
- // ?.classList.add(
- // "bg-gradient-to-br",
- // "from-slate-50",
- // "to-sky-50",
- // "min-h-screen"
- // );
}, []);
+ useEffect(() => {
+ const fetchOwner = async () => {
+ if (collection) {
+ const owner = await getPublicUserData(collection.ownerId as number);
+ setCollectionOwner(owner);
+ }
+ };
+
+ fetchOwner();
+ }, [collection]);
+
return collection ? (
+
{collection ? (
{collection.name} | Linkwarden
@@ -96,14 +126,26 @@ export default function PublicCollections() {
) : undefined}
-
+
{collection.name}
-
[Logo]
+
+
+
+
+
+
-
+
setModal({
@@ -115,8 +157,16 @@ export default function PublicCollections() {
defaultIndex: 0,
})
}
- className="hover:opacity-80 duration-100 flex justify-center sm:justify-end items-center w-fit sm:mr-0 sm:ml-auto cursor-pointer"
+ className="hover:opacity-80 duration-100 flex justify-center sm:justify-end items-center w-fit cursor-pointer"
>
+ {collectionOwner.id ? (
+
+ ) : undefined}
{collection.members
.sort((a, b) => (a.userId as number) - (b.userId as number))
.map((e, i) => {
@@ -124,49 +174,106 @@ export default function PublicCollections() {
);
})
- .slice(0, 4)}
+ .slice(0, 3)}
{collection?.members.length &&
- collection.members.length - 4 > 0 ? (
-
- +{collection?.members?.length - 4}
+ collection.members.length - 3 > 0 ? (
+
+ +{collection?.members?.length - 3}
) : null}
+
+
+ By {collectionOwner.name} and {collection.members.length}{" "}
+ others.
+
-
{collection.description}
+
{collection.description}
-
+
-
- {links
- ?.filter((e) => e.collectionId === Number(router.query.id))
- .map((e, i) => {
- return (
-
+
+
+
+
+
+
setFilterDropdown(!filterDropdown)}
+ id="filter-dropdown"
+ className="inline-flex rounded-md cursor-pointer hover:bg-neutral-500 hover:bg-opacity-40 duration-100 p-1"
>
-
-
-
-
- );
- })}
-
+
+
- {/*
- List created with Linkwarden.
-
*/}
+ {filterDropdown ? (
+
+ ) : null}
+
+
+
+
setSortDropdown(!sortDropdown)}
+ id="sort-dropdown"
+ className="inline-flex rounded-md cursor-pointer hover:bg-neutral-500 hover:bg-opacity-40 duration-100 p-1"
+ >
+
+
+
+ {sortDropdown ? (
+
setSortDropdown(!sortDropdown)}
+ />
+ ) : null}
+
+
+
+
+
+ {links
+ ?.filter((e) => e.collectionId === Number(router.query.id))
+ .map((e, i) => {
+ return (
+
+
+
+
+
+ );
+ })}
+
+
+ {/*
+ List created with Linkwarden.
+
*/}
+
) : (
diff --git a/public/icon.png b/public/icon.png
new file mode 100644
index 0000000..ac6d7e9
Binary files /dev/null and b/public/icon.png differ
diff --git a/yarn.lock b/yarn.lock
index 024191a..57493d9 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -919,11 +919,6 @@
dependencies:
glob "7.1.7"
-"@next/font@13.4.9":
- version "13.4.9"
- resolved "https://registry.yarnpkg.com/@next/font/-/font-13.4.9.tgz#5540e69a1a5fbd1113d622a89cdd21c0ab3906c8"
- integrity sha512-aR0XEyd1cxqaKuelQFDGwUBYV0wyZfJTNiRoSk1XsECTyMhiSMmCOY7yOPMuPlw+6cctca0GyZXGGFb5EVhiRw==
-
"@next/swc-darwin-arm64@13.4.12":
version "13.4.12"
resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.4.12.tgz#326c830b111de8a1a51ac0cbc3bcb157c4c4f92c"
@@ -3627,6 +3622,11 @@ loose-envify@^1.1.0, loose-envify@^1.4.0:
dependencies:
js-tokens "^3.0.0 || ^4.0.0"
+lottie-web@^5.12.2:
+ version "5.12.2"
+ resolved "https://registry.yarnpkg.com/lottie-web/-/lottie-web-5.12.2.tgz#579ca9fe6d3fd9e352571edd3c0be162492f68e5"
+ integrity sha512-uvhvYPC8kGPjXT3MyKMrL3JitEAmDMp30lVkuq/590Mw9ok6pWcFCwXJveo0t5uqYw1UREQHofD+jVpdjBv8wg==
+
lru-cache@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"