redesigned link collection page

This commit is contained in:
daniel31x13 2023-11-30 06:55:37 -05:00
parent cfc308f521
commit 2fd21c8219

View File

@ -73,34 +73,34 @@ export default function Index() {
return ( return (
<MainLayout> <MainLayout>
<div className="p-5 flex flex-col gap-5 w-full h-full"> <div
<div style={{
style={{ backgroundImage: `linear-gradient(${activeCollection?.color}20 10%, ${
backgroundImage: `linear-gradient(-45deg, ${ settings.theme === "dark" ? "#262626" : "#f3f4f6"
activeCollection?.color } 50%, ${settings.theme === "dark" ? "#171717" : "#ffffff"} 100%)`,
}30 10%, ${ }}
settings.theme === "dark" ? "#262626" : "#f3f4f6" className="h-full p-5 flex gap-3 flex-col"
} 50%, ${settings.theme === "dark" ? "#262626" : "#f9fafb"} 100%)`, >
}} <div className="flex flex-col sm:flex-row gap-3 justify-between sm:items-start">
className="border border-solid border-neutral-content rounded-2xl shadow min-h-[10rem] p-5 flex gap-5 flex-col justify-between" {activeCollection && (
> <div className="flex gap-3 items-center">
<div className="flex flex-col sm:flex-row gap-3 justify-between sm:items-start"> <div className="flex gap-2">
{activeCollection && ( <FontAwesomeIcon
<div className="flex gap-3 items-center"> icon={faFolder}
<div className="flex gap-2"> style={{ color: activeCollection?.color }}
<FontAwesomeIcon className="sm:w-8 sm:h-8 w-6 h-6 mt-3 drop-shadow"
icon={faFolder} />
style={{ color: activeCollection?.color }} <p className="sm:text-4xl text-3xl capitalize w-full py-1 break-words hyphens-auto font-thin">
className="sm:w-8 sm:h-8 w-6 h-6 mt-3 drop-shadow" {activeCollection?.name}
/> </p>
<p className="sm:text-4xl text-3xl capitalize w-full py-1 break-words hyphens-auto font-thin">
{activeCollection?.name}
</p>
</div>
</div> </div>
)} </div>
)}
</div>
{activeCollection ? ( {activeCollection ? (
<div className={`min-w-[15rem]`}>
<div className="flex gap-1 justify-center sm:justify-end items-center w-fit">
<div <div
className="flex items-center btn px-2 btn-ghost rounded-full w-fit" className="flex items-center btn px-2 btn-ghost rounded-full w-fit"
onClick={() => onClick={() =>
@ -141,101 +141,115 @@ export default function Index() {
</div> </div>
) : null} ) : null}
</div> </div>
) : undefined} <p className="text-neutral text-xs">
By {collectionOwner.name}
{activeCollection.members.length > 0
? ` and ${activeCollection.members.length} others`
: undefined}
.
</p>
</div>
</div> </div>
) : undefined}
<div className="flex justify-between items-end gap-5"> {activeCollection?.description ? (
<p>{activeCollection?.description}</p> <p>{activeCollection?.description}</p>
<div className="flex items-center gap-2"> ) : undefined}
<SortDropdown sortBy={sortBy} setSort={setSortBy} />
<div className="relative"> <hr className="border-1 border-neutral" />
<div className="dropdown dropdown-bottom dropdown-end">
<div <div className="flex justify-between items-end gap-5">
tabIndex={0} <p>Listing {activeCollection?._count?.links} Bookmarks</p>
role="button" <div className="flex items-center gap-2">
className="btn btn-ghost btn-sm btn-square text-neutral" <SortDropdown sortBy={sortBy} setSort={setSortBy} />
> <div className="relative">
<FontAwesomeIcon <div className="dropdown dropdown-bottom dropdown-end">
icon={faEllipsis} <div
title="More" tabIndex={0}
className="w-5 h-5" role="button"
/> className="btn btn-ghost btn-sm btn-square text-neutral"
</div> >
<ul className="dropdown-content z-[30] menu p-1 shadow bg-base-200 border border-neutral-content rounded-xl w-44 mt-1"> <FontAwesomeIcon
{permissions === true ? ( icon={faEllipsis}
<li> title="More"
<div className="w-5 h-5"
className="px-2 py-1 rounded-lg" />
role="button"
tabIndex={0}
onClick={() => {
(document?.activeElement as HTMLElement)?.blur();
activeCollection &&
setModal({
modal: "COLLECTION",
state: true,
method: "UPDATE",
isOwner: permissions === true,
active: activeCollection,
});
}}
>
Edit Collection Info
</div>
</li>
) : undefined}
<li>
<div
className="px-2 py-1 rounded-lg"
role="button"
tabIndex={0}
onClick={() => {
(document?.activeElement as HTMLElement)?.blur();
activeCollection &&
setModal({
modal: "COLLECTION",
state: true,
method: "UPDATE",
isOwner: permissions === true,
active: activeCollection,
defaultIndex: permissions === true ? 1 : 0,
});
}}
>
{permissions === true
? "Share and Collaborate"
: "View Team"}
</div>
</li>
<li>
<div
className="px-2 py-1 rounded-lg"
role="button"
tabIndex={0}
onClick={() => {
(document?.activeElement as HTMLElement)?.blur();
activeCollection &&
setModal({
modal: "COLLECTION",
state: true,
method: "UPDATE",
isOwner: permissions === true,
active: activeCollection,
defaultIndex: permissions === true ? 2 : 1,
});
}}
>
{permissions === true
? "Delete Collection"
: "Leave Collection"}
</div>
</li>
</ul>
</div> </div>
<ul className="dropdown-content z-[30] menu p-1 shadow bg-base-200 border border-neutral-content rounded-xl w-44 mt-1">
{permissions === true ? (
<li>
<div
className="px-2 py-1 rounded-lg"
role="button"
tabIndex={0}
onClick={() => {
(document?.activeElement as HTMLElement)?.blur();
activeCollection &&
setModal({
modal: "COLLECTION",
state: true,
method: "UPDATE",
isOwner: permissions === true,
active: activeCollection,
});
}}
>
Edit Collection Info
</div>
</li>
) : undefined}
<li>
<div
className="px-2 py-1 rounded-lg"
role="button"
tabIndex={0}
onClick={() => {
(document?.activeElement as HTMLElement)?.blur();
activeCollection &&
setModal({
modal: "COLLECTION",
state: true,
method: "UPDATE",
isOwner: permissions === true,
active: activeCollection,
defaultIndex: permissions === true ? 1 : 0,
});
}}
>
{permissions === true
? "Share and Collaborate"
: "View Team"}
</div>
</li>
<li>
<div
className="px-2 py-1 rounded-lg"
role="button"
tabIndex={0}
onClick={() => {
(document?.activeElement as HTMLElement)?.blur();
activeCollection &&
setModal({
modal: "COLLECTION",
state: true,
method: "UPDATE",
isOwner: permissions === true,
active: activeCollection,
defaultIndex: permissions === true ? 2 : 1,
});
}}
>
{permissions === true
? "Delete Collection"
: "Leave Collection"}
</div>
</li>
</ul>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{links.some((e) => e.collectionId === Number(router.query.id)) ? ( {links.some((e) => e.collectionId === Number(router.query.id)) ? (
<div className="grid grid-cols-1 2xl:grid-cols-3 xl:grid-cols-2 gap-5"> <div className="grid grid-cols-1 2xl:grid-cols-3 xl:grid-cols-2 gap-5">
{links {links