improved user experience

This commit is contained in:
daniel31x13 2023-10-24 17:03:33 -04:00
parent cb8c2d5f10
commit c38c5b2cc5
5 changed files with 82 additions and 25 deletions

View File

@ -1,5 +1,5 @@
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faEllipsis, faLink } from "@fortawesome/free-solid-svg-icons"; import { faEllipsis, faGlobe, faLink } from "@fortawesome/free-solid-svg-icons";
import Link from "next/link"; import Link from "next/link";
import { CollectionIncludingMembersAndLinkCount } from "@/types/global"; import { CollectionIncludingMembersAndLinkCount } from "@/types/global";
import Dropdown from "./Dropdown"; import Dropdown from "./Dropdown";
@ -82,6 +82,13 @@ export default function CollectionCard({ collection, className }: Props) {
</div> </div>
<div className="text-right w-40"> <div className="text-right w-40">
<div className="text-black dark:text-white font-bold text-sm flex justify-end gap-1 items-center"> <div className="text-black dark:text-white font-bold text-sm flex justify-end gap-1 items-center">
{collection.isPublic ? (
<FontAwesomeIcon
icon={faGlobe}
title="This collection is being shared publicly."
className="w-4 h-4 drop-shadow text-gray-500 dark:text-gray-300"
/>
) : undefined}
<FontAwesomeIcon <FontAwesomeIcon
icon={faLink} icon={faLink}
className="w-5 h-5 text-gray-500 dark:text-gray-300" className="w-5 h-5 text-gray-500 dark:text-gray-300"

View File

@ -6,6 +6,7 @@ import {
faChartSimple, faChartSimple,
faChevronDown, faChevronDown,
faLink, faLink,
faGlobe,
} from "@fortawesome/free-solid-svg-icons"; } from "@fortawesome/free-solid-svg-icons";
import useTagStore from "@/store/tags"; import useTagStore from "@/store/tags";
import Link from "next/link"; import Link from "next/link";
@ -151,10 +152,17 @@ export default function Sidebar({ className }: { className?: string }) {
className="w-6 h-6 drop-shadow" className="w-6 h-6 drop-shadow"
style={{ color: e.color }} style={{ color: e.color }}
/> />
<p className="text-black dark:text-white truncate w-full">
<p className="text-black dark:text-white truncate w-full pr-7">
{e.name} {e.name}
</p> </p>
{e.isPublic ? (
<FontAwesomeIcon
icon={faGlobe}
title="This collection is being shared publicly."
className="w-4 h-4 drop-shadow text-gray-500 dark:text-gray-300"
/>
) : undefined}
</div> </div>
</Link> </Link>
); );

View File

@ -220,7 +220,7 @@ export default function Index() {
if (target.id !== "expand-dropdown") if (target.id !== "expand-dropdown")
setExpandDropdown(false); setExpandDropdown(false);
}} }}
className="absolute top-8 right-0 z-10 w-fit" className="absolute top-8 right-0 z-10 w-40"
/> />
) : null} ) : null}
</div> </div>

View File

@ -26,7 +26,7 @@ export default function Collections() {
const [sortBy, setSortBy] = useState<Sort>(Sort.DateNewestFirst); const [sortBy, setSortBy] = useState<Sort>(Sort.DateNewestFirst);
const [sortedCollections, setSortedCollections] = useState(collections); const [sortedCollections, setSortedCollections] = useState(collections);
const session = useSession(); const { data } = useSession();
const { setModal } = useModalStore(); const { setModal } = useModalStore();
@ -35,18 +35,24 @@ export default function Collections() {
return ( return (
<MainLayout> <MainLayout>
<div className="p-5"> <div className="p-5">
<div className="flex gap-3 items-center justify-between mb-5"> <div className="flex gap-3 justify-between mb-5">
<div className="flex gap-3 items-end"> <div className="flex gap-3">
<div className="flex gap-2"> <div className="flex items-center gap-3">
<FontAwesomeIcon <FontAwesomeIcon
icon={faFolder} icon={faFolder}
className="sm:w-8 sm:h-8 w-6 h-6 mt-2 text-sky-500 dark:text-sky-500 drop-shadow" className="sm:w-10 sm:h-10 w-6 h-6 text-sky-500 dark:text-sky-500 drop-shadow"
/> />
<p className="sm:text-4xl text-3xl capitalize text-black dark:text-white font-thin"> <div>
All Collections <p className="text-3xl capitalize text-black dark:text-white font-thin">
</p> Your Collections
</p>
<p className="capitalize text-black dark:text-white">
Collections you own
</p>
</div>
</div> </div>
<div className="relative"> <div className="relative mt-2">
<div <div
onClick={() => setExpandDropdown(!expandDropdown)} onClick={() => setExpandDropdown(!expandDropdown)}
id="expand-dropdown" id="expand-dropdown"
@ -79,13 +85,13 @@ export default function Collections() {
if (target.id !== "expand-dropdown") if (target.id !== "expand-dropdown")
setExpandDropdown(false); setExpandDropdown(false);
}} }}
className="absolute top-8 left-0 w-36" className="absolute top-8 sm:left-0 right-0 sm:right-auto w-36"
/> />
) : null} ) : null}
</div> </div>
</div> </div>
<div className="relative"> <div className="relative mt-2">
<div <div
onClick={() => setSortDropdown(!sortDropdown)} onClick={() => setSortDropdown(!sortDropdown)}
id="sort-dropdown" id="sort-dropdown"
@ -109,9 +115,11 @@ export default function Collections() {
</div> </div>
<div className="grid xl:grid-cols-3 sm:grid-cols-2 grid-cols-1 gap-5"> <div className="grid xl:grid-cols-3 sm:grid-cols-2 grid-cols-1 gap-5">
{sortedCollections.map((e, i) => { {sortedCollections
return <CollectionCard key={i} collection={e} />; .filter((e) => e.ownerId !== data?.user.id)
})} .map((e, i) => {
return <CollectionCard key={i} collection={e} />;
})}
<div <div
className="p-5 bg-gray-50 dark:bg-neutral-800 self-stretch border border-solid border-sky-100 dark:border-neutral-700 min-h-[12rem] rounded-2xl cursor-pointer shadow duration-100 hover:shadow-none flex flex-col gap-4 justify-center items-center group" className="p-5 bg-gray-50 dark:bg-neutral-800 self-stretch border border-solid border-sky-100 dark:border-neutral-700 min-h-[12rem] rounded-2xl cursor-pointer shadow duration-100 hover:shadow-none flex flex-col gap-4 justify-center items-center group"
@ -132,6 +140,34 @@ export default function Collections() {
/> />
</div> </div>
</div> </div>
{sortedCollections.filter((e) => e.ownerId !== data?.user.id)[0] ? (
<>
<div className="flex items-center gap-3 my-5">
<FontAwesomeIcon
icon={faFolder}
className="sm:w-10 sm:h-10 w-6 h-6 text-sky-500 dark:text-sky-500 drop-shadow"
/>
<div>
<p className="text-3xl capitalize text-black dark:text-white font-thin">
Other Collections
</p>
<p className="capitalize text-black dark:text-white">
Shared collections you're a member of
</p>
</div>
</div>
<div className="grid xl:grid-cols-3 sm:grid-cols-2 grid-cols-1 gap-5">
{sortedCollections
.filter((e) => e.ownerId !== data?.user.id)
.map((e, i) => {
return <CollectionCard key={i} collection={e} />;
})}
</div>
</>
) : undefined}
</div> </div>
</MainLayout> </MainLayout>
); );

View File

@ -20,18 +20,24 @@ export default function Links() {
return ( return (
<MainLayout> <MainLayout>
<div className="p-5 flex flex-col gap-5 w-full h-full"> <div className="p-5 flex flex-col gap-5 w-full h-full">
<div className="flex gap-3 justify-between items-center"> <div className="flex gap-3 justify-between">
<div className="flex gap-2"> <div className="flex items-center gap-3">
<FontAwesomeIcon <FontAwesomeIcon
icon={faLink} icon={faLink}
className="sm:w-8 sm:h-8 w-6 h-6 mt-2 text-sky-500 dark:text-sky-500 drop-shadow" className="sm:w-10 sm:h-10 w-6 h-6 text-sky-500 dark:text-sky-500 drop-shadow"
/> />
<p className="sm:text-4xl text-3xl capitalize text-black dark:text-white font-thin"> <div>
All Links <p className="text-3xl capitalize text-black dark:text-white font-thin">
</p> All Links
</p>
<p className="capitalize text-black dark:text-white">
All Links from every Collections
</p>
</div>
</div> </div>
<div className="relative"> <div className="relative mt-2">
<div <div
onClick={() => setSortDropdown(!sortDropdown)} onClick={() => setSortDropdown(!sortDropdown)}
id="sort-dropdown" id="sort-dropdown"