Skip to content

Commit

Permalink
Allow POD card display if at least one of title/description/image is …
Browse files Browse the repository at this point in the history
…set (#2152)

Logic changed since the original version of the POD card display so I've
been misinforming devs that they can make a collectable POD without an
image.

I tested and the UI code seems to work fine for text-only PODs, so this
PR loosens the check so that the collectable display can trigger if at
least one of the title/description/image entries are set to a non-empty
value.
  • Loading branch information
artwyman authored Nov 11, 2024
1 parent c8edf42 commit 53fd9dd
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions packages/ui/pod-pcd-ui/src/CardBody.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { ErrorContainer, SlidingTabs, styled, VIcon } from "@pcd/passport-ui";
import { PCDUI } from "@pcd/pcd-types";
import { getImageUrlEntry, PODPCD, PODPCDPackage } from "@pcd/pod-pcd";
import {
getDescriptionEntry,
getImageUrlEntry,
getTitleEntry,
PODPCD,
PODPCDPackage
} from "@pcd/pod-pcd";
import { getErrorMessage } from "@pcd/util";
import { useMemo, useState } from "react";
import { CollectablePODPCDCardBody } from "./renderers/CollectablePODPCDCardBody";
Expand Down Expand Up @@ -41,7 +47,13 @@ function PODPCDCardBody({

const hasCollectableContent = useMemo(() => {
const imageUrlEntry = getImageUrlEntry(pcd);
return imageUrlEntry?.type === "string" && imageUrlEntry.value !== "";
const titleEntry = getTitleEntry(pcd);
const descriptionEntry = getDescriptionEntry(pcd);
return (
(imageUrlEntry?.type === "string" && imageUrlEntry.value !== "") ||
(titleEntry?.type === "string" && titleEntry.value !== "") ||
(descriptionEntry?.type === "string" && descriptionEntry.value !== "")
);
}, [pcd]);

const availableDisplayFormat = getPreferredDisplayFormat(pcd);
Expand Down

0 comments on commit 53fd9dd

Please sign in to comment.