⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.
TypeScript bookmarkbookmark-managercollaborationnextjsreact-nativeread-it-laterself-hostedtypescript
improvements
daniel31x135b87799fdd95
diff --git a/components/CollectionCard.tsx b/components/CollectionCard.tsxindex 4d4f5aa3..4ff96774 100644--- a/components/CollectionCard.tsx+++ b/components/CollectionCard.tsx@@ -166,7 +166,7 @@ export default function CollectionCard({}}className="card card-compact shadow-md hover:shadow-none duration-200 border border-neutral-content">- <div className="card-body flex flex-col justify-between min-h-[12rem] min-w-[12rem]">+ <div className="card-body flex flex-col justify-between min-h-[12rem]"><div className="flex justify-between"><p className="card-title break-words line-clamp-2 w-full">{collection.name}diff --git a/components/CollectionListing.tsx b/components/CollectionListing.tsxindex 841ab0e3..815908fe 100644--- a/components/CollectionListing.tsx+++ b/components/CollectionListing.tsx@@ -333,7 +333,7 @@ const buildTreeFromCollections = (return 0;}- let totalLinkCount = collection.data._count?.links || 0;+ let totalLinkCount = (collection.data as any)._count?.links || 0;if (collection.hasChildren) {collection.children.forEach((childId) => {@@ -401,7 +401,7 @@ const buildTreeFromCollections = (const collectionId = collection.id;if (items[collectionId as number] && collection.id) {const linkCount = getTotalLinkCount(collectionId as number);- items[collectionId as number].data._count.links = linkCount;+ (items[collectionId as number].data as any)._count.links = linkCount;}});diff --git a/components/LinkViews/LinkComponents/LinkCollection.tsx b/components/LinkViews/LinkComponents/LinkCollection.tsxindex 24698843..885a0159 100644--- a/components/LinkViews/LinkComponents/LinkCollection.tsx+++ b/components/LinkViews/LinkComponents/LinkCollection.tsx@@ -9,8 +9,10 @@ import { useRouter } from "next/router";import React from "react";export default function LinkCollection({+ link,collection,}: {+ link: LinkIncludingShortenedCollectionAndTags;collection: CollectionIncludingMembersAndLinkCount;}) {const router = useRouter();@@ -20,24 +22,24 @@ export default function LinkCollection({return !isPublicRoute && collection?.name ? (<><Link- href={`/collections/${collection.id}`}+ href={`/collections/${link.collection.id}`}onClick={(e) => {e.stopPropagation();}}className="flex items-center gap-1 max-w-full w-fit hover:opacity-70 duration-100 select-none"title={collection?.name}>- {collection.icon ? (+ {link.collection.icon ? (<Icon- icon={collection.icon}+ icon={link.collection.icon}size={20}- weight={(collection.iconWeight || "regular") as IconWeight}- color={collection.color}+ weight={(link.collection.iconWeight || "regular") as IconWeight}+ color={link.collection.color}/>) : (<iclassName="bi-folder-fill text-lg"- style={{ color: collection.color }}+ style={{ color: link.collection.color }}></i>)}<p className="truncate capitalize">{collection?.name}</p>diff --git a/components/PageHeader.tsx b/components/PageHeader.tsxindex d4f78504..2442adae 100644--- a/components/PageHeader.tsx+++ b/components/PageHeader.tsx@@ -1,16 +1,19 @@+import clsx from "clsx";import React from "react";export default function PageHeader({title,description,icon,+ className,}: {title: string;description?: string;icon: string;+ className?: string;}) {return (- <div className="flex items-center gap-3">+ <div className={clsx("flex items-center gap-3", className)}><iclassName={`${icon} text-primary sm:text-3xl text-2xl drop-shadow`}></i>diff --git a/pages/collections/[id].tsx b/pages/collections/[id].tsxindex 11c1204a..a19d6936 100644--- a/pages/collections/[id].tsx+++ b/pages/collections/[id].tsx@@ -26,6 +26,8 @@ import { useLinks } from "@/hooks/store/links";import Links from "@/components/LinkViews/Links";import Icon from "@/components/Icon";import CollectionCard from "@/components/CollectionCard";+import { IconWeight } from "@phosphor-icons/react";+import PageHeader from "@/components/PageHeader";export default function Index() {const { t } = useTranslation();@@ -283,21 +285,39 @@ export default function Index() {<p>{activeCollection?.description}</p>)}+ <div className="divider my-0"></div>+{collections.some((e) => e.parentId === activeCollection?.id) ? (- <fieldset className="rounded-md p-2 border-neutral-content">- <legend className="text-sm ml-2">Sub-Collections</legend>- <div className="grid-cols-8 grid gap-5">+ <>+ <PageHeader+ icon={"bi-folder"}+ title={t("collections")}+ description={+ collections.filter((e) => e.parentId === activeCollection?.id)+ .length === 1+ ? t("showing_count_result", {+ count: collections.filter(+ (e) => e.parentId === activeCollection?.id+ ).length,+ })+ : t("showing_count_results", {+ count: collections.filter(+ (e) => e.parentId === activeCollection?.id+ ).length,+ })+ }+ className="scale-90 w-fit"+ />+ <div className="grid 2xl:grid-cols-4 xl:grid-cols-3 sm:grid-cols-2 grid-cols-1 gap-5">{collections.filter((e) => e.parentId === activeCollection?.id).map((e, i) => {return <CollectionCard key={i} collection={e} />;})}</div>- </fieldset>+ </>) : undefined}- <div className="divider my-0"></div>-<LinkListOptionst={t}viewMode={viewMode}@@ -319,15 +339,32 @@ export default function Index() {: undefined}>- <p>- {activeCollection?._count?.links === 1- ? t("showing_count_result", {- count: activeCollection?._count?.links,- })- : t("showing_count_results", {- count: activeCollection?._count?.links,- })}- </p>+ {collections.some((e) => e.parentId === activeCollection?.id) ? (+ <PageHeader+ icon={"bi-link-45deg"}+ title={t("links")}+ description={+ activeCollection?._count?.links === 1+ ? t("showing_count_result", {+ count: activeCollection?._count?.links,+ })+ : t("showing_count_results", {+ count: activeCollection?._count?.links,+ })+ }+ className="scale-90 w-fit"+ />+ ) : (+ <p>+ {activeCollection?._count?.links === 1+ ? t("showing_count_result", {+ count: activeCollection?._count?.links,+ })+ : t("showing_count_results", {+ count: activeCollection?._count?.links,+ })}+ </p>+ )}</LinkListOptions><Linksdiff --git a/pages/collections/index.tsx b/pages/collections/index.tsxindex b1dbb8b0..c5db6770 100644--- a/pages/collections/index.tsx+++ b/pages/collections/index.tsx@@ -68,7 +68,7 @@ export default function Collections() {</div></div>- <div className="grid min-[1900px]:grid-cols-4 2xl:grid-cols-3 sm:grid-cols-2 grid-cols-1 gap-5">+ <div className="grid 2xl:grid-cols-4 xl:grid-cols-3 sm:grid-cols-2 grid-cols-1 gap-5">{sortedCollections.filter((e) => e.ownerId === data?.user.id && e.parentId === null).map((e, i) => {@@ -94,7 +94,7 @@ export default function Collections() {description={t("other_collections_desc")}/>- <div className="grid min-[1900px]:grid-cols-4 2xl:grid-cols-3 sm:grid-cols-2 grid-cols-1 gap-5">+ <div className="grid 2xl:grid-cols-4 xl:grid-cols-3 sm:grid-cols-2 grid-cols-1 gap-5">{sortedCollections.filter((e) => e.ownerId !== data?.user.id).map((e, i) => {