diff --git a/demo/site/src/common/blocks/DamImageBlock.tsx b/demo/site/src/common/blocks/DamImageBlock.tsx index 7b3e73d038..f8ee6e8da0 100644 --- a/demo/site/src/common/blocks/DamImageBlock.tsx +++ b/demo/site/src/common/blocks/DamImageBlock.tsx @@ -1,6 +1,6 @@ "use client"; import { PixelImageBlock, PreviewSkeleton, PropsWithData, SvgImageBlock, withPreview } from "@comet/cms-site"; -import { DamImageBlockData, PixelImageBlockData, SvgImageBlockData } from "@src/blocks.generated"; +import { DamImageBlockData } from "@src/blocks.generated"; import { ImageProps as NextImageProps } from "next/image"; type DamImageProps = Omit & { @@ -9,14 +9,14 @@ type DamImageProps = Omit & export const DamImageBlock = withPreview( ({ data: { block }, aspectRatio, ...imageProps }: PropsWithData & DamImageProps) => { - if (!block) { + if (!block || !block.props.damFile) { return ; } - if (block.type === "pixelImage") { - return ; + if (block.type === "pixelImage" && "urlTemplate" in block.props) { + return ; } else if (block.type === "svgImage") { - return ; + return ; } else { return ( <> diff --git a/packages/api/cms-api/src/dam/blocks/pixel-image.block.ts b/packages/api/cms-api/src/dam/blocks/pixel-image.block.ts index 3be958987b..7d303eb72e 100644 --- a/packages/api/cms-api/src/dam/blocks/pixel-image.block.ts +++ b/packages/api/cms-api/src/dam/blocks/pixel-image.block.ts @@ -172,7 +172,7 @@ class Meta extends AnnotationBlockMeta { { name: "urlTemplate", kind: BlockMetaFieldKind.String, - nullable: false, + nullable: true, }, ); return ret;