From e21b8780dd247858103da8bf64dbc96591025075 Mon Sep 17 00:00:00 2001 From: ShivaniKhaire Date: Wed, 21 Oct 2026 12:48:38 +0530 Subject: [PATCH] fix six-stages clinical menifestation. --- .../content/renderers/shared/ContentValue.tsx | 59 +++++++++++++++++-- 1 file changed, 53 insertions(+), 6 deletions(-) diff --git a/src/features/content/renderers/shared/ContentValue.tsx b/src/features/content/renderers/shared/ContentValue.tsx index 76cb9cf..dec7f53 100644 --- a/src/features/content/renderers/shared/ContentValue.tsx +++ b/src/features/content/renderers/shared/ContentValue.tsx @@ -13,6 +13,7 @@ import { Spacing } from "@/theme/spacing"; import { ContentLink } from "../../components/navigation/ContentLink"; import { parseNavigableContentReference } from "../../utils/content-reference"; import { humanizeKey } from "../helpers/value"; +import { BulletList } from "./BulletList"; export interface ContentValueProps { value: unknown; @@ -20,6 +21,28 @@ export interface ContentValueProps { emptyText?: string | null; } +function parseBullets(text: string): string[] { + if (text.includes("\n")) { + return text + .split("\n") + .map((s) => s.replace(/^[•\-\*\d+\.]\s*/, "").trim()) + .filter((s) => s.length > 0); + } + if (text.includes(";")) { + return text + .split(";") + .map((s) => s.trim().replace(/^and\s+/i, "")) + .filter((s) => s.length > 0); + } + const parts = text.split(/,\s*(?![^()]*\))/); + if (parts.length > 1) { + return parts + .map((s) => s.trim().replace(/\.$/, "").replace(/^and\s+/i, "")) + .filter((s) => s.length > 0); + } + return [text]; +} + /** * Reference-aware fallback renderer for arbitrary nested attribute values. * @@ -54,6 +77,10 @@ export function ContentValue({ ) : null; } + if (visible.every((item) => typeof item === "string")) { + return ; + } + return ( {visible.map((item, index) => ( @@ -84,12 +111,32 @@ export function ContentValue({ return ( - {entries.map(([key, child]) => ( - - {humanizeKey(key)} - - - ))} + {entries.map(([key, child]) => { + const isClinical = + key.toLowerCase().includes("clinical") || + key.toLowerCase().includes("manifestation"); + + const renderChild = () => { + if ( + isClinical && + typeof child === "string" && + child.trim().length > 0 + ) { + const bullets = parseBullets(child); + if (bullets.length > 1) { + return ; + } + } + return ; + }; + + return ( + + {humanizeKey(key)} + {renderChild()} + + ); + })} ); }