"use client"; import LinkCard from "@/components/PublicPage/LinkCard"; import getPublicCollectionData from "@/lib/client/getPublicCollectionData"; import { CollectionIncludingMembersAndLinkCount, Sort } from "@/types/global"; import { useRouter } from "next/router"; import React, { useEffect, useState } from "react"; import { motion, Variants } from "framer-motion"; import Head from "next/head"; import useLinks from "@/hooks/useLinks"; import useLinkStore from "@/store/links"; import ProfilePhoto from "@/components/ProfilePhoto"; import useModalStore from "@/store/modals"; import ModalManagement from "@/components/ModalManagement"; const cardVariants: Variants = { offscreen: { y: 50, opacity: 0, }, onscreen: { y: 0, opacity: 1, transition: { duration: 0.4, }, }, }; export default function PublicCollections() { const { links } = useLinkStore(); const { setModal } = useModalStore(); const router = useRouter(); const [searchFilter, setSearchFilter] = useState({ name: true, url: true, description: true, textContent: true, tags: true, }); const [filterDropdown, setFilterDropdown] = useState(false); const [sortDropdown, setSortDropdown] = useState(false); const [sortBy, setSortBy] = useState(Sort.DateNewestFirst); useLinks({ sort: sortBy, searchQueryString: router.query.q ? decodeURIComponent(router.query.q as string) : undefined, searchByName: searchFilter.name, searchByUrl: searchFilter.url, searchByDescription: searchFilter.description, searchByTextContent: searchFilter.textContent, searchByTags: searchFilter.tags, }); 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" // ); }, []); return collection ? (
{collection ? ( {collection.name} | Linkwarden ) : undefined}

{collection.name}

[Logo]
setModal({ modal: "COLLECTION", state: true, method: "VIEW_TEAM", isOwner: false, active: collection, 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" > {collection.members .sort((a, b) => (a.userId as number) - (b.userId as number)) .map((e, i) => { return ( ); }) .slice(0, 4)} {collection?.members.length && collection.members.length - 4 > 0 ? (
+{collection?.members?.length - 4}
) : null}

{collection.description}


{links ?.filter((e) => e.collectionId === Number(router.query.id)) .map((e, i) => { return ( ); })}
{/*

List created with Linkwarden.

*/}
) : ( <> ); }