fix(gallery): restore point category relational media fallback while preserving exact pagination dots
This commit is contained in:
parent
8a158258ef
commit
0f68e31285
|
|
@ -8,7 +8,6 @@ import { ObjectSections } from "../shared/ObjectSections";
|
|||
import { RecordCards } from "../shared/RecordCards";
|
||||
import { RecordTable } from "../shared/RecordTable";
|
||||
import { SectionCard } from "../shared/SectionCard";
|
||||
import { useRelationalContentMedia } from "../../media/ContentMediaContext";
|
||||
|
||||
export const PointCodes = ({ data }: { data: Record<string, unknown> }) => (
|
||||
<SectionCard title="Points"><ChipList items={asStringArray(data.point_codes)} /></SectionCard>
|
||||
|
|
@ -38,21 +37,7 @@ const extractCategoryImages = (data: Record<string, unknown>): Record<string, un
|
|||
|
||||
export const Images = ({ data }: { data: Record<string, unknown> }) => {
|
||||
const directImages = extractCategoryImages(data);
|
||||
const relationalMedia = useRelationalContentMedia();
|
||||
|
||||
// If direct images are explicitly defined in category data, display them
|
||||
if (directImages.length > 0) {
|
||||
return <ImageGallery images={directImages} />;
|
||||
}
|
||||
|
||||
// If direct media was assigned directly to this category (e.g. primary image in CMS)
|
||||
const hasDirectMedia = relationalMedia.some((m) => m.media_role === "primary");
|
||||
if (hasDirectMedia) {
|
||||
return <ImageGallery images={[]} />;
|
||||
}
|
||||
|
||||
// Do not show inherited media from referenced points/meridians for categories without images
|
||||
return null;
|
||||
return <ImageGallery images={directImages} />;
|
||||
};
|
||||
|
||||
export const ObjectCard = ({ title, value }: { title: string; value: unknown }) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue