diff --git a/packages/grant-explorer/src/features/collections/CollectionCard.tsx b/packages/grant-explorer/src/features/collections/CollectionCard.tsx index 124171d3f..c14e42912 100644 --- a/packages/grant-explorer/src/features/collections/CollectionCard.tsx +++ b/packages/grant-explorer/src/features/collections/CollectionCard.tsx @@ -11,8 +11,15 @@ export type CollectionCardProps = { const CollectionCard = ({ collection, size }: CollectionCardProps) => { const { cid, name, description } = collection; + const sliceLength = size === "small" ? 165 : 385; + + let desc = description; + if (description && description.length > sliceLength) { + desc = description.slice(0, sliceLength) + "..."; + } + return ( - + {
-
- {name} -
-

- {description} -

+
{name}
+

{desc}

diff --git a/packages/grant-explorer/src/features/collections/CollectionDetails.tsx b/packages/grant-explorer/src/features/collections/CollectionDetails.tsx index 0ef8b2288..c0f69ca4d 100644 --- a/packages/grant-explorer/src/features/collections/CollectionDetails.tsx +++ b/packages/grant-explorer/src/features/collections/CollectionDetails.tsx @@ -3,6 +3,7 @@ import { CheckIcon, LinkIcon } from "@heroicons/react/20/solid"; import { ShoppingCartIcon } from "@heroicons/react/24/outline"; import { useState } from "react"; import { CollectionV1 } from "./collections"; +import { useCollections } from "./hooks/useCollections"; type Props = { collection: CollectionV1; @@ -17,17 +18,21 @@ export function CollectionDetails({ projectsInView, onAddAllApplicationsToCart, }: Props) { + const collections = useCollections(); + + // filter collections by collection.href + const description = collections.data?.find( + (c) => c.cid && location.href.includes(c.cid) + )?.description; + return (
-

{`${ - collection.name ?? defaultCollectionName - } (${projectsInView})`}

-
-
- {collection.description} -
-
-
+
+
+

+ {`${collection.name ?? defaultCollectionName} (${projectsInView})`} +

+
+
+ {description ?? collection.description} +
); diff --git a/packages/grant-explorer/src/features/discovery/CardBanner.tsx b/packages/grant-explorer/src/features/discovery/CardBanner.tsx index efb94d38f..80752b311 100644 --- a/packages/grant-explorer/src/features/discovery/CardBanner.tsx +++ b/packages/grant-explorer/src/features/discovery/CardBanner.tsx @@ -117,7 +117,7 @@ export function CollectionBanner() { const [gradient] = useState(getRandomGradient()); return (