import { useEffect, useState } from "react"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faCrown } from "@fortawesome/free-solid-svg-icons"; import { CollectionIncludingMembersAndLinkCount } from "@/types/global"; import ProfilePhoto from "@/components/ProfilePhoto"; import getPublicUserData from "@/lib/client/getPublicUserData"; type Props = { collection: CollectionIncludingMembersAndLinkCount; }; export default function ViewTeam({ collection }: Props) { const [collectionOwner, setCollectionOwner] = useState({ id: null, name: "", username: "", image: "", }); useEffect(() => { const fetchOwner = async () => { const owner = await getPublicUserData(collection.ownerId as number); setCollectionOwner(owner); }; fetchOwner(); }, []); return (

Team

Here's all the members that are collaborating in this collection.

{collectionOwner.name}

Admin

@{collectionOwner.username}

{collection?.members[0]?.user && ( <>
{collection.members .sort((a, b) => (a.userId as number) - (b.userId as number)) .map((e, i) => { return (

{e.user.name}

@{e.user.username}

); })}
)}
); }