From 8e73bcad738e0dfedb6b40cc96e5cecea1684a0e Mon Sep 17 00:00:00 2001 From: ShivaniKhaire Date: Sat, 24 Oct 2026 14:54:29 +0530 Subject: [PATCH] feat(three-burners): render separate Treatment Principle and Treatment cards with updated display order --- .../details/ThreeBurnersDetailRenderer.tsx | 74 +++++++++++-------- 1 file changed, 42 insertions(+), 32 deletions(-) diff --git a/src/features/content/renderers/details/ThreeBurnersDetailRenderer.tsx b/src/features/content/renderers/details/ThreeBurnersDetailRenderer.tsx index 81720be..94b5bf1 100644 --- a/src/features/content/renderers/details/ThreeBurnersDetailRenderer.tsx +++ b/src/features/content/renderers/details/ThreeBurnersDetailRenderer.tsx @@ -18,6 +18,7 @@ interface PatternData { code?: string; clinicalManifestation?: string | string[]; pathology?: string; + treatmentPrinciple?: string | string[]; treatment?: string; } @@ -236,6 +237,11 @@ export function ThreeBurnersDetailRenderer({ const clinical = parseBullets(clinicalRaw); const pathology = asString(a.pathology); + const treatmentPrincipleRaw = + a.treatment_principle ?? + a["treatment principle"] ?? + a.treatmentPrinciple; + const treatmentPrinciple = parseBullets(treatmentPrincipleRaw); const treatment = asString(a.treatment); map.set(normalizeKey(name), { @@ -243,6 +249,7 @@ export function ThreeBurnersDetailRenderer({ code: asString(a.code) || undefined, clinicalManifestation: clinical.length > 0 ? clinical : undefined, pathology: pathology || undefined, + treatmentPrinciple: treatmentPrinciple.length > 0 ? treatmentPrinciple : undefined, treatment: treatment || undefined, }); } @@ -284,12 +291,18 @@ export function ThreeBurnersDetailRenderer({ data.clinical_manifestation; const clinical = parseBullets(clinicalRaw); + const treatmentPrincipleRaw = + data.treatment_principle ?? + data["treatment principle"] ?? + data.treatmentPrinciple; + const treatmentPrinciple = parseBullets(treatmentPrincipleRaw); return { name, code: asString(data.code) || undefined, clinicalManifestation: clinical.length > 0 ? clinical : undefined, pathology: asString(data.pathology) || undefined, + treatmentPrinciple: treatmentPrinciple.length > 0 ? treatmentPrinciple : undefined, treatment: asString(data.treatment) || undefined, }; } @@ -327,6 +340,20 @@ export function ThreeBurnersDetailRenderer({ activePatternData.treatment || "", ); + const rawPrinciples = + activePatternData.treatmentPrinciple && + (Array.isArray(activePatternData.treatmentPrinciple) + ? activePatternData.treatmentPrinciple + : parseBullets(activePatternData.treatmentPrinciple)); + + const allPrinciples = + rawPrinciples && rawPrinciples.length > 0 ? rawPrinciples : principles; + + const treatmentText = + acupuncture.length > 0 + ? acupuncture.join("\n") + : activePatternData.treatment; + return ( - {/* 1. Clinical Manifestations Card */} + {/* 1. Pathology Card */} + {activePatternData.pathology ? ( + + + + ) : null} + + {/* 2. Clinical Manifestations Card */} {activePatternData.clinicalManifestation ? ( ) : null} - {/* 2. Pathology Card */} - {activePatternData.pathology ? ( - - + {/* 3. Treatment Principle Card */} + {allPrinciples && allPrinciples.length > 0 ? ( + + ) : null} - {/* 3. Treatment Card */} - {activePatternData.treatment ? ( + {/* 4. Treatment Card */} + {treatmentText ? ( - {principles.length > 0 ? ( - - Treatment Principle: - {principles.map((p, i) => ( - - • {p} - - ))} - - ) : null} - - {acupuncture.length > 0 ? ( - 0 && styles.subSectionSpacing]}> - Acupuncture Points: - {acupuncture.map((a, i) => ( - - {a} - - ))} - - ) : null} - - {principles.length === 0 && acupuncture.length === 0 ? ( - - ) : null} + ) : null}