Merge pull request 'feat(renderers): add four levels detail renderer' (#8) from four-levels into main

Reviewed-on: https://10.10.0.4/AcuPedia/acupedia-mobile-ui/pulls/8
Reviewed-by: Amit Salunke <amit@noreply.localhost>
This commit is contained in:
Amit Salunke 2026-09-25 05:14:37 +00:00
commit 3b5199852f
1 changed files with 114 additions and 0 deletions

View File

@ -0,0 +1,114 @@
import React from "react";
import { ScrollView, StyleSheet } from "react-native";
import type { DetailRendererProps } from "../../types/renderer.types";
import { ContentLinkAttributeSections } from "../shared/ContentLinkAttributeSections";
import { Hero } from "../shared/Hero";
import { SectionCard } from "../shared/SectionCard";
import { Paragraphs } from "../shared/Paragraphs";
import { asString } from "../helpers/value";
export function FourLevelsDetailRenderer({
content,
data,
definitions,
presentationAttributes,
}: DetailRendererProps) {
const title =
asString(data.name) ||
asString(data.title) ||
content.title;
const overview = asString(data.overview);
const clinicalManifestations =
asString(data.clinical_menifestation) ||
asString(data.clinical_manifestations);
const tongue = asString(data.tongue);
const pulse = asString(data.pulse);
const pathology = asString(data.pathology);
const treatmentPrinciple =
asString(data.treatment_principle) ||
asString(data["treatment principle"]);
const treatment = asString(data.treatment);
const explanation = asString(data.explanation);
const contentText = asString(data.content);
return (
<ScrollView
contentContainerStyle={styles.content}
showsVerticalScrollIndicator={false}
>
<Hero title={title} />
{overview ? (
<SectionCard title="Overview">
<Paragraphs items={[overview]} />
</SectionCard>
) : null}
{clinicalManifestations ? (
<SectionCard title="Clinical Manifestations">
<Paragraphs items={[clinicalManifestations]} />
</SectionCard>
) : null}
{tongue ? (
<SectionCard title="Tongue">
<Paragraphs items={[tongue]} />
</SectionCard>
) : null}
{pulse ? (
<SectionCard title="Pulse">
<Paragraphs items={[pulse]} />
</SectionCard>
) : null}
{pathology ? (
<SectionCard title="Pathology">
<Paragraphs items={[pathology]} />
</SectionCard>
) : null}
{treatmentPrinciple ? (
<SectionCard title="Treatment Principle">
<Paragraphs items={[treatmentPrinciple]} />
</SectionCard>
) : null}
{treatment ? (
<SectionCard title="Treatment">
<Paragraphs items={[treatment]} />
</SectionCard>
) : null}
{explanation ? (
<SectionCard title="Explanation">
<Paragraphs items={[explanation]} />
</SectionCard>
) : null}
{contentText ? (
<SectionCard title="Content">
<Paragraphs items={[contentText]} />
</SectionCard>
) : null}
<ContentLinkAttributeSections
data={data}
definitions={definitions}
presentationAttributes={presentationAttributes}
/>
</ScrollView>
);
}
const styles = StyleSheet.create({
content: {
paddingHorizontal: 18,
paddingTop: 16,
paddingBottom: 40,
gap: 14,
},
});