fix(renderers): add generic OverviewCard, fix missing info icon and redundant subtitle (issue #93)

- Create reusable OverviewCard component with default information-circle icon
- Replace inconsistent SectionCard in SixStagesCollectionRenderer with OverviewCard
- Standardize OverviewCard across collection and detail renderers
- Add icon prop support to AccordionSection and SectionCard with auto-resolution for Overview
- Remove redundant patterns subtitle under FourLevels and FiveElements cards
This commit is contained in:
ShivaniKhaire 2026-11-07 16:56:36 +05:30
parent 3273d74780
commit 45933ddca6
15 changed files with 220 additions and 465 deletions

View File

@ -6,6 +6,7 @@ import { moderateScale, verticalScale } from "react-native-size-matters";
import { Colors } from "@/theme";
import { asNumber, asString } from "../helpers/value";
import { CollectionScaffold } from "../shared/CollectionScaffold";
import { OverviewCard } from "../shared/OverviewCard";
import type {
CollectionItemRendererProps,
CollectionRendererProps,
@ -24,24 +25,15 @@ export function EightPrinciplesCollectionRenderer(
const header = (
<View style={styles.overviewContainer}>
<View style={styles.overviewCard}>
<View style={styles.overviewHeader}>
<Ionicons name="information-circle" size={20} color={Colors.primary} />
<Text style={styles.overviewTitle}>Overview</Text>
</View>
<Text style={styles.overviewText}>
The eight principles include exterior, interior, cold, heat, deficiency, excess, yin and yang. Syndrome differentiation (pattern identification) of the eight principles is an essential paradigm in the Chinese medicine system.
</Text>
<Text style={styles.overviewParagraph}>
Pattern identification of the eight principles aims to tell about the disease location, the pathogenic nature and the strength between antipathogenic qi and pathogenic factors, thus generalizing the condition into eight categories.
</Text>
<Text style={styles.overviewParagraph}>
The eight principles can be divided into four pairs: interior/exterior for the depth of pathogens; cold/heat for the disease nature; deficiency/excess for the strength between antipathogenic qi and pathogenic factors; and yin/yang for the preponderance of yin and yang. However, yin and yang can also generalize the other six principles: exterior, heat and excess are ascribed to yang, and interior, cold and deficiency to yin.
</Text>
<Text style={styles.overviewParagraph}>
Two or more principles may occur concurrently, such as an exterior cold syndrome and an interior deficiency cold syndrome. A combined deficiency and excess may also be present. The principles may transform into each other as well, such as cold transforming into heat, or the exterior entering the interior. Additionally, a true cold may sometimes manifest as a false heat or vice versa.
</Text>
</View>
<OverviewCard
style={styles.overviewCard}
paragraphs={[
"The eight principles include exterior, interior, cold, heat, deficiency, excess, yin and yang. Syndrome differentiation (pattern identification) of the eight principles is an essential paradigm in the Chinese medicine system.",
"Pattern identification of the eight principles aims to tell about the disease location, the pathogenic nature and the strength between antipathogenic qi and pathogenic factors, thus generalizing the condition into eight categories.",
"The eight principles can be divided into four pairs: interior/exterior for the depth of pathogens; cold/heat for the disease nature; deficiency/excess for the strength between antipathogenic qi and pathogenic factors; and yin/yang for the preponderance of yin and yang. However, yin and yang can also generalize the other six principles: exterior, heat and excess are ascribed to yang, and interior, cold and deficiency to yin.",
"Two or more principles may occur concurrently, such as an exterior cold syndrome and an interior deficiency cold syndrome. A combined deficiency and excess may also be present. The principles may transform into each other as well, such as cold transforming into heat, or the exterior entering the interior. Additionally, a true cold may sometimes manifest as a false heat or vice versa.",
]}
/>
<Text style={styles.sectionHeading}>Eight Principles</Text>
</View>
);
@ -111,35 +103,8 @@ const styles = StyleSheet.create({
marginBottom: verticalScale(14),
},
overviewCard: {
backgroundColor: "#FFFFFF",
borderRadius: moderateScale(16),
borderWidth: 1,
borderColor: "#E2EAE5",
padding: moderateScale(16),
marginBottom: verticalScale(14),
},
overviewHeader: {
flexDirection: "row",
alignItems: "center",
marginBottom: verticalScale(8),
gap: moderateScale(8),
},
overviewTitle: {
fontSize: moderateScale(16),
fontWeight: "700",
color: Colors.textPrimary,
},
overviewText: {
fontSize: moderateScale(13),
lineHeight: verticalScale(19),
color: Colors.textSecondary,
},
overviewParagraph: {
fontSize: moderateScale(13),
lineHeight: verticalScale(19),
color: Colors.textSecondary,
marginTop: verticalScale(10),
},
sectionHeading: {
fontSize: moderateScale(15),
fontWeight: "700",

View File

@ -7,6 +7,7 @@ import { Colors } from "@/theme";
import { asNumber, asString } from "../helpers/value";
import { CollectionScaffold } from "../shared/CollectionScaffold";
import { ContentCountBadge } from "../shared/ContentCountBadge";
import { OverviewCard } from "../shared/OverviewCard";
import type {
CollectionItemRendererProps,
CollectionRendererProps,
@ -15,21 +16,14 @@ import type {
export function FiveElementsCollectionRenderer(props: CollectionRendererProps) {
const header = (
<View style={styles.overviewContainer}>
<View style={styles.overviewCard}>
<View style={styles.overviewHeader}>
<Ionicons name="information-circle" size={20} color={Colors.primary} />
<Text style={styles.overviewTitle}>Overview</Text>
</View>
<Text style={styles.overviewText}>
The identification of patterns according to the Five Elements is based on the pathological changes occurring in dysfunctions of the Generating, Overacting and Insulting sequences of the Five Elements.
</Text>
<Text style={styles.overviewParagraph}>
These patterns describe clinical conditions which are often expressed by the Internal Organ patterns, but in certain cases, Five-Element patterns describe conditions falling outside their scope (such as Deficient Qi of Wood manifesting with timidity and indecision).
</Text>
<Text style={styles.overviewParagraph}>
The sequences below detail the Generating, Overacting, and Insulting relationships and their specific clinical presentations.
</Text>
</View>
<OverviewCard
style={styles.overviewCard}
paragraphs={[
"The identification of patterns according to the Five Elements is based on the pathological changes occurring in dysfunctions of the Generating, Overacting and Insulting sequences of the Five Elements.",
"These patterns describe clinical conditions which are often expressed by the Internal Organ patterns, but in certain cases, Five-Element patterns describe conditions falling outside their scope (such as Deficient Qi of Wood manifesting with timidity and indecision).",
"The sequences below detail the Generating, Overacting, and Insulting relationships and their specific clinical presentations.",
]}
/>
<Text style={styles.sectionHeading}>Sequences</Text>
</View>
);
@ -51,11 +45,10 @@ export function FiveElementsCardRenderer({
}: CollectionItemRendererProps) {
const attributes = item.attributes;
const title = asString(attributes.title) || asString(attributes.name) || item.title;
const label =
asString(attributes.content_label) ||
const subtitle =
asString(attributes.sub_title) ||
asString(attributes.description) ||
item.summary ||
"Open sequence";
(item.summary && item.summary !== "Open sequence" ? item.summary : null);
const sortOrder = asNumber(attributes.sort_order);
const sequenceNumber = typeof sortOrder === "number" ? sortOrder + 1 : undefined;
@ -72,9 +65,11 @@ export function FiveElementsCardRenderer({
<View style={styles.textContainer}>
<Text style={styles.title}>{title}</Text>
<Text style={styles.description} numberOfLines={1}>
{label}
</Text>
{subtitle ? (
<Text style={styles.description} numberOfLines={1}>
{subtitle}
</Text>
) : null}
</View>
<ContentCountBadge
@ -91,35 +86,8 @@ const styles = StyleSheet.create({
marginBottom: verticalScale(14),
},
overviewCard: {
backgroundColor: "#FFFFFF",
borderRadius: moderateScale(16),
borderWidth: 1,
borderColor: "#E2EAE5",
padding: moderateScale(16),
marginBottom: verticalScale(14),
},
overviewHeader: {
flexDirection: "row",
alignItems: "center",
marginBottom: verticalScale(8),
gap: moderateScale(8),
},
overviewTitle: {
fontSize: moderateScale(16),
fontWeight: "700",
color: Colors.textPrimary,
},
overviewText: {
fontSize: moderateScale(13),
lineHeight: verticalScale(19),
color: Colors.textSecondary,
},
overviewParagraph: {
fontSize: moderateScale(13),
lineHeight: verticalScale(19),
color: Colors.textSecondary,
marginTop: verticalScale(10),
},
sectionHeading: {
fontSize: moderateScale(15),
fontWeight: "700",

View File

@ -7,6 +7,7 @@ import { Colors } from "@/theme";
import { asNumber, asString } from "../helpers/value";
import { CollectionScaffold } from "../shared/CollectionScaffold";
import { ContentCountBadge } from "../shared/ContentCountBadge";
import { OverviewCard } from "../shared/OverviewCard";
import type {
CollectionItemRendererProps,
CollectionRendererProps,
@ -15,30 +16,17 @@ import type {
export function FourLevelsCollectionRenderer(props: CollectionRendererProps) {
const header = (
<View style={styles.overviewContainer}>
<View style={styles.overviewCard}>
<View style={styles.overviewHeader}>
<Ionicons name="information-circle" size={20} color={Colors.primary} />
<Text style={styles.overviewTitle}>Overview</Text>
</View>
<Text style={styles.overviewText}>
The Four Levels of Diagnosis in Traditional Chinese Medicine (TCM) is a framework mainly used in Warm Disease Theory (Wen Bing), which deals with febrile (heat) diseases caused by external pathogens, especially warm pathogens like viruses or bacteria. It helps practitioners understand the progression of the disease and guide treatment.
</Text>
<Text style={styles.overviewParagraph}>
The interpretation of clinical manifestations of Warm Diseases according to the Four Levels was formulated by Ye Tian Shi. This is a brilliant theory that provides the most clinically useful tool to diagnose, interpret and treat diseases caused by external Wind-Heat and their consequences, whether they are Warm Diseases or not.
</Text>
<Text style={styles.overviewParagraph}>
The theory of the Four Levels is clinically more relevant than that of the Six Stages. For example, one of the most common consequences of an invasion of Wind-Heat is the transformation of external Wind-Heat into interior Phlegm-Heat in the Lungs, causing a chest infection: this situation is contemplated in the Four Levels (corresponding to Lung-Heat, Qi level), while it is not contemplated in the Six Stages.
</Text>
<Text style={styles.overviewParagraph}>
The Qi level contemplates the pattern of Damp-Heat in Stomach and Spleen as a consequence of an invasion of Wind-Heat: this is a very common clinical situation and yet it is one that is not contemplated in the Six Stages.
</Text>
<Text style={styles.overviewParagraph}>
The Blood level includes patterns which are characterized by convulsions from the development of internal Wind: these are typical complications of children’s diseases such as meningitis but they are not contemplated in the Six Stages.
</Text>
<Text style={styles.overviewParagraph}>
The Four Levels are the Defensive Qi, Qi, Nutritive Qi and Blood levels (Wei, Qi, Ying, Xue): the first level is the only exterior one characterized by the presence of the external Wind-Heat on the energetic surface of the body. The other three levels are all interior and all characterized by interior Heat; however, the brilliance of this theory lies in its identification of three different depths of penetration of interior pathogenic Heat. Each level has its own distinctive pathology and treatment.
</Text>
</View>
<OverviewCard
style={styles.overviewCard}
paragraphs={[
"The Four Levels of Diagnosis in Traditional Chinese Medicine (TCM) is a framework mainly used in Warm Disease Theory (Wen Bing), which deals with febrile (heat) diseases caused by external pathogens, especially warm pathogens like viruses or bacteria. It helps practitioners understand the progression of the disease and guide treatment.",
"The interpretation of clinical manifestations of Warm Diseases according to the Four Levels was formulated by Ye Tian Shi. This is a brilliant theory that provides the most clinically useful tool to diagnose, interpret and treat diseases caused by external Wind-Heat and their consequences, whether they are Warm Diseases or not.",
"The theory of the Four Levels is clinically more relevant than that of the Six Stages. For example, one of the most common consequences of an invasion of Wind-Heat is the transformation of external Wind-Heat into interior Phlegm-Heat in the Lungs, causing a chest infection: this situation is contemplated in the Four Levels (corresponding to Lung-Heat, Qi level), while it is not contemplated in the Six Stages.",
"The Qi level contemplates the pattern of Damp-Heat in Stomach and Spleen as a consequence of an invasion of Wind-Heat: this is a very common clinical situation and yet it is one that is not contemplated in the Six Stages.",
"The Blood level includes patterns which are characterized by convulsions from the development of internal Wind: these are typical complications of children’s diseases such as meningitis but they are not contemplated in the Six Stages.",
"The Four Levels are the Defensive Qi, Qi, Nutritive Qi and Blood levels (Wei, Qi, Ying, Xue): the first level is the only exterior one characterized by the presence of the external Wind-Heat on the energetic surface of the body. The other three levels are all interior and all characterized by interior Heat; however, the brilliance of this theory lies in its identification of three different depths of penetration of interior pathogenic Heat. Each level has its own distinctive pathology and treatment.",
]}
/>
<Text style={styles.sectionHeading}>Levels</Text>
</View>
);
@ -60,11 +48,10 @@ export function FourLevelsCardRenderer({
}: CollectionItemRendererProps) {
const attributes = item.attributes;
const title = asString(attributes.title) || asString(attributes.name) || item.title;
const label =
asString(attributes.content_label) ||
const subtitle =
asString(attributes.sub_title) ||
asString(attributes.description) ||
item.summary ||
"Open content";
(item.summary && item.summary !== "Open content" ? item.summary : null);
const sortOrder = asNumber(attributes.sort_order);
const levelNumber = typeof sortOrder === "number" ? sortOrder + 1 : undefined;
@ -81,9 +68,11 @@ export function FourLevelsCardRenderer({
<View style={styles.textContainer}>
<Text style={styles.title}>{title}</Text>
<Text style={styles.description} numberOfLines={1}>
{label}
</Text>
{subtitle ? (
<Text style={styles.description} numberOfLines={1}>
{subtitle}
</Text>
) : null}
</View>
<ContentCountBadge
@ -100,35 +89,8 @@ const styles = StyleSheet.create({
marginBottom: verticalScale(14),
},
overviewCard: {
backgroundColor: "#FFFFFF",
borderRadius: moderateScale(16),
borderWidth: 1,
borderColor: "#E2EAE5",
padding: moderateScale(16),
marginBottom: verticalScale(14),
},
overviewHeader: {
flexDirection: "row",
alignItems: "center",
marginBottom: verticalScale(8),
gap: moderateScale(8),
},
overviewTitle: {
fontSize: moderateScale(16),
fontWeight: "700",
color: Colors.textPrimary,
},
overviewText: {
fontSize: moderateScale(13),
lineHeight: verticalScale(19),
color: Colors.textSecondary,
},
overviewParagraph: {
fontSize: moderateScale(13),
lineHeight: verticalScale(19),
color: Colors.textSecondary,
marginTop: verticalScale(10),
},
sectionHeading: {
fontSize: moderateScale(15),
fontWeight: "700",

View File

@ -7,6 +7,7 @@ import { Colors } from "@/theme";
import { asString, humanizeKey } from "../helpers/value";
import { Hero } from "../shared/Hero";
import { CollectionScaffold } from "../shared/CollectionScaffold";
import { OverviewCard } from "../shared/OverviewCard";
import type { CollectionRendererProps } from "../../types/renderer.types";
export interface GynecologyDiseaseInfo {
@ -540,20 +541,10 @@ export function GynecologyDiseaseCollectionRenderer(
/>
{paragraphs.length > 0 ? (
<View style={styles.overviewCard}>
<View style={styles.overviewHeader}>
<Ionicons name="information-circle" size={20} color={Colors.primary} />
<Text style={styles.overviewTitle}>Overview</Text>
</View>
{paragraphs.map((para, index) => (
<Text
key={index}
style={index === 0 ? styles.overviewText : styles.overviewParagraph}
>
{para}
</Text>
))}
</View>
<OverviewCard
paragraphs={paragraphs}
style={{ marginTop: verticalScale(12) }}
/>
) : null}
</View>
);
@ -578,34 +569,4 @@ const styles = StyleSheet.create({
overviewContainer: {
marginBottom: verticalScale(14),
},
overviewCard: {
backgroundColor: "#FFFFFF",
borderRadius: moderateScale(16),
borderWidth: 1,
borderColor: "#D7E9DE",
padding: moderateScale(16),
marginTop: verticalScale(12),
},
overviewHeader: {
flexDirection: "row",
alignItems: "center",
gap: moderateScale(8),
marginBottom: verticalScale(10),
},
overviewTitle: {
fontSize: moderateScale(15),
fontWeight: "700",
color: Colors.primaryDark,
},
overviewText: {
fontSize: moderateScale(13),
lineHeight: moderateScale(20),
color: "#374151",
},
overviewParagraph: {
fontSize: moderateScale(13),
lineHeight: moderateScale(20),
color: "#374151",
marginTop: verticalScale(8),
},
});

View File

@ -6,6 +6,7 @@ import { moderateScale, verticalScale } from "react-native-size-matters";
import { Colors } from "@/theme";
import { asNumber, asString } from "../helpers/value";
import { CollectionScaffold } from "../shared/CollectionScaffold";
import { OverviewCard } from "../shared/OverviewCard";
import type {
CollectionItemRendererProps,
CollectionRendererProps,
@ -16,24 +17,15 @@ export function PathogenicFactorsCollectionRenderer(
) {
const header = (
<View style={styles.overviewContainer}>
<View style={styles.overviewCard}>
<View style={styles.overviewHeader}>
<Ionicons name="information-circle" size={20} color={Colors.primary} />
<Text style={styles.overviewTitle}>Overview</Text>
</View>
<Text style={styles.overviewText}>
This method of pattern identification is based on the pathological changes occurring when the body is invaded by pathogenic factors such as Wind, Cold, Summer-Heat, Dampness, Dryness and Fire. Each of these pathogenic factors may be exterior or interior.
</Text>
<Text style={styles.overviewParagraph}>
They always correspond to a Full pattern according to the Eight Principles. Indeed, from the Eight-Principle point of view, a Full condition is defined as one characterized by the presence of a pathogenic factor while the body’s Qi is still relatively intact.
</Text>
<Text style={styles.overviewParagraph}>
The pathogenic factor is frequently associated with a Deficiency, in which case the condition is a combined Full–Empty condition. With regard to pathogenic factors, a combined Full-Empty condition can arise in one of two ways: a pathogenic factor can give rise to a Deficiency (e.g. Fire weakens Yin) or a Deficiency can give rise to a pathogenic factor (e.g. Spleen-Qi deficiency gives rise to Dampness).
</Text>
<Text style={styles.overviewParagraph}>
Generally speaking, pathogenic factors are more relevant as patterns of disharmony than as causes of disease. The diagnosis of a pathogenic factor is made not on the basis of the patient’s history, but on the basis of the pattern of symptoms and signs presented.
</Text>
</View>
<OverviewCard
style={styles.overviewCard}
paragraphs={[
"This method of pattern identification is based on the pathological changes occurring when the body is invaded by pathogenic factors such as Wind, Cold, Summer-Heat, Dampness, Dryness and Fire. Each of these pathogenic factors may be exterior or interior.",
"They always correspond to a Full pattern according to the Eight Principles. Indeed, from the Eight-Principle point of view, a Full condition is defined as one characterized by the presence of a pathogenic factor while the body’s Qi is still relatively intact.",
"The pathogenic factor is frequently associated with a Deficiency, in which case the condition is a combined Full–Empty condition. With regard to pathogenic factors, a combined Full-Empty condition can arise in one of two ways: a pathogenic factor can give rise to a Deficiency (e.g. Fire weakens Yin) or a Deficiency can give rise to a pathogenic factor (e.g. Spleen-Qi deficiency gives rise to Dampness).",
"Generally speaking, pathogenic factors are more relevant as patterns of disharmony than as causes of disease. The diagnosis of a pathogenic factor is made not on the basis of the patient’s history, but on the basis of the pattern of symptoms and signs presented.",
]}
/>
<Text style={styles.sectionHeading}>Pathogenic Factors</Text>
</View>
);
@ -105,35 +97,8 @@ const styles = StyleSheet.create({
marginBottom: verticalScale(14),
},
overviewCard: {
backgroundColor: "#FFFFFF",
borderRadius: moderateScale(16),
borderWidth: 1,
borderColor: "#E2EAE5",
padding: moderateScale(16),
marginBottom: verticalScale(14),
},
overviewHeader: {
flexDirection: "row",
alignItems: "center",
marginBottom: verticalScale(8),
gap: moderateScale(8),
},
overviewTitle: {
fontSize: moderateScale(16),
fontWeight: "700",
color: Colors.textPrimary,
},
overviewText: {
fontSize: moderateScale(13),
lineHeight: verticalScale(19),
color: Colors.textSecondary,
},
overviewParagraph: {
fontSize: moderateScale(13),
lineHeight: verticalScale(19),
color: Colors.textSecondary,
marginTop: verticalScale(10),
},
sectionHeading: {
fontSize: moderateScale(15),
fontWeight: "700",

View File

@ -6,6 +6,7 @@ import { moderateScale, verticalScale } from "react-native-size-matters";
import { Colors } from "@/theme";
import { asNumber, asString } from "../helpers/value";
import { CollectionScaffold } from "../shared/CollectionScaffold";
import { OverviewCard } from "../shared/OverviewCard";
import { useSingleTemplateContentQuery } from "../../hooks/use-single-template-content-query";
import type {
CollectionItemRendererProps,
@ -69,15 +70,7 @@ export function QiBloodCollectionRenderer(props: CollectionRendererProps) {
const header = (
<View style={styles.headerContainer}>
{overviewText ? (
<View style={styles.overviewCard}>
<View style={styles.overviewHeader}>
<Ionicons name="information-circle" size={20} color={Colors.primary} />
<Text style={styles.overviewTitle}>Overview</Text>
</View>
<Text style={styles.overviewText}>{overviewText}</Text>
</View>
) : null}
{overviewText ? <OverviewCard text={overviewText} /> : null}
<Text style={styles.sectionHeading}>Categories</Text>
</View>
@ -134,29 +127,6 @@ const styles = StyleSheet.create({
paddingBottom: verticalScale(8),
gap: verticalScale(14),
},
overviewCard: {
backgroundColor: "#FFFFFF",
borderRadius: moderateScale(16),
borderWidth: 1,
borderColor: "#E2EAE5",
padding: moderateScale(18),
},
overviewHeader: {
flexDirection: "row",
alignItems: "center",
marginBottom: verticalScale(10),
gap: moderateScale(8),
},
overviewTitle: {
fontSize: moderateScale(16),
fontWeight: "700",
color: Colors.textPrimary,
},
overviewText: {
fontSize: moderateScale(14),
lineHeight: moderateScale(22),
color: Colors.textSecondary,
},
sectionHeading: {
fontSize: moderateScale(16),
fontWeight: "700",

View File

@ -6,7 +6,7 @@ import { moderateScale, verticalScale } from "react-native-size-matters";
import { Colors } from "@/theme";
import { asNumber, asString, humanizeKey } from "../helpers/value";
import { CollectionScaffold } from "../shared/CollectionScaffold";
import { SectionCard } from "../shared/SectionCard";
import { OverviewCard } from "../shared/OverviewCard";
import type {
CollectionItemRendererProps,
CollectionRendererProps,
@ -17,9 +17,7 @@ export function SixStagesCollectionRenderer(props: CollectionRendererProps) {
const header = overviewText ? (
<View style={styles.overviewContainer}>
<SectionCard title="Overview" defaultExpanded={true}>
<Text style={styles.overviewText}>{overviewText}</Text>
</SectionCard>
<OverviewCard text={overviewText} />
</View>
) : null;
@ -93,11 +91,6 @@ const styles = StyleSheet.create({
overviewContainer: {
marginBottom: verticalScale(14),
},
overviewText: {
fontSize: moderateScale(14),
lineHeight: moderateScale(22),
color: "#374151",
},
row: {
minHeight: moderateScale(68),
flexDirection: "row",

View File

@ -8,6 +8,7 @@ import { Colors } from "@/theme";
import type { DetailRendererProps } from "../../types/renderer.types";
import { ContentLinkAttributeSections } from "../shared/ContentLinkAttributeSections";
import { Hero } from "../shared/Hero";
import { OverviewCard } from "../shared/OverviewCard";
import { Paragraphs } from "../shared/Paragraphs";
import { SectionCard } from "../shared/SectionCard";
import { asRecordArray, asString, asStringArray } from "../helpers/value";
@ -96,20 +97,7 @@ export function FiveElementsDetailRenderer({
{/* Overview Card (rendered only when overview/content exists in data) */}
{overviewParagraphs.length > 0 ? (
<View style={styles.overviewCard}>
<View style={styles.overviewHeader}>
<Ionicons name="information-circle" size={20} color={Colors.primary} />
<Text style={styles.overviewTitle}>Overview</Text>
</View>
{overviewParagraphs.map((para, idx) => (
<Text
key={idx}
style={[styles.overviewText, idx > 0 && styles.paragraphSpacing]}
>
{para}
</Text>
))}
</View>
<OverviewCard paragraphs={overviewParagraphs} />
) : null}
{/* Dynamic Sequences List from data.sections */}
@ -181,20 +169,7 @@ export function FiveElementsDetailRenderer({
{/* Overview Card (rendered only when overview/content exists in data) */}
{overviewParagraphs.length > 0 ? (
<View style={styles.overviewCard}>
<View style={styles.overviewHeader}>
<Ionicons name="information-circle" size={20} color={Colors.primary} />
<Text style={styles.overviewTitle}>Overview</Text>
</View>
{overviewParagraphs.map((para, idx) => (
<Text
key={idx}
style={[styles.overviewText, idx > 0 && styles.paragraphSpacing]}
>
{para}
</Text>
))}
</View>
<OverviewCard paragraphs={overviewParagraphs} />
) : null}
{/* Collapsible Pattern Cards from data.sections */}
@ -230,32 +205,6 @@ const styles = StyleSheet.create({
paddingBottom: verticalScale(40),
gap: verticalScale(14),
},
overviewCard: {
backgroundColor: "#FFFFFF",
borderRadius: moderateScale(16),
borderWidth: 1,
borderColor: "#E2EAE5",
padding: moderateScale(16),
},
overviewHeader: {
flexDirection: "row",
alignItems: "center",
marginBottom: verticalScale(8),
gap: moderateScale(8),
},
overviewTitle: {
fontSize: moderateScale(16),
fontWeight: "700",
color: Colors.textPrimary,
},
overviewText: {
fontSize: moderateScale(13),
lineHeight: verticalScale(19),
color: Colors.textSecondary,
},
paragraphSpacing: {
marginTop: verticalScale(10),
},
sequencesContainer: {
gap: verticalScale(10),
},

View File

@ -15,6 +15,7 @@ import { BulletList } from "../shared/BulletList";
import { ContentLinkAttributeSections } from "../shared/ContentLinkAttributeSections";
import { ContentValue } from "../shared/ContentValue";
import { Hero } from "../shared/Hero";
import { OverviewCard } from "../shared/OverviewCard";
import { Paragraphs } from "../shared/Paragraphs";
import { SectionCard } from "../shared/SectionCard";
@ -115,15 +116,7 @@ export function FourLevelsDetailRenderer({
<Hero title={title} />
{/* Direct Overview Card matching Four Levels 1st page */}
{overview ? (
<View style={styles.overviewCard}>
<View style={styles.overviewHeader}>
<Ionicons name="information-circle" size={20} color={Colors.primary} />
<Text style={styles.overviewTitle}>Overview</Text>
</View>
<Text style={styles.overviewText}>{overview}</Text>
</View>
) : null}
{overview ? <OverviewCard text={overview} /> : null}
{/* Patterns List with numbered cards matching 1st page */}
<View style={styles.patternsSection}>
@ -288,29 +281,6 @@ const styles = StyleSheet.create({
paddingBottom: verticalScale(40),
gap: verticalScale(14),
},
overviewCard: {
backgroundColor: "#FFFFFF",
borderRadius: moderateScale(16),
borderWidth: 1,
borderColor: "#E2EAE5",
padding: moderateScale(16),
},
overviewHeader: {
flexDirection: "row",
alignItems: "center",
marginBottom: verticalScale(8),
gap: moderateScale(8),
},
overviewTitle: {
fontSize: moderateScale(16),
fontWeight: "700",
color: Colors.textPrimary,
},
overviewText: {
fontSize: moderateScale(13),
lineHeight: verticalScale(19),
color: Colors.textSecondary,
},
patternsSection: {
gap: verticalScale(10),
},

View File

@ -8,6 +8,7 @@ import type { DetailRendererProps } from "../../types/renderer.types";
import { BackActionContext } from "../../context/BackActionContext";
import { ContentLinkAttributeSections } from "../shared/ContentLinkAttributeSections";
import { Hero } from "../shared/Hero";
import { OverviewCard } from "../shared/OverviewCard";
import { SectionCard } from "../shared/SectionCard";
import { BulletList } from "../shared/BulletList";
import { Paragraphs } from "../shared/Paragraphs";
@ -338,15 +339,7 @@ export function QiBloodDetailRenderer({
<Hero title={categoryTitle} />
{/* Category Overview Card */}
{categoryOverview ? (
<View style={styles.overviewCard}>
<View style={styles.overviewHeader}>
<Ionicons name="information-circle" size={20} color={Colors.primary} />
<Text style={styles.overviewTitle}>Overview</Text>
</View>
<Text style={styles.overviewText}>{categoryOverview}</Text>
</View>
) : null}
{categoryOverview ? <OverviewCard text={categoryOverview} /> : null}
{/* Numbered Patterns List */}
{rootPatterns.length > 0 ? (
@ -390,29 +383,6 @@ const styles = StyleSheet.create({
paddingBottom: verticalScale(40),
gap: verticalScale(14),
},
overviewCard: {
backgroundColor: "#FFFFFF",
borderRadius: moderateScale(16),
borderWidth: 1,
borderColor: "#E2EAE5",
padding: moderateScale(18),
},
overviewHeader: {
flexDirection: "row",
alignItems: "center",
marginBottom: verticalScale(10),
gap: moderateScale(8),
},
overviewTitle: {
fontSize: moderateScale(16),
fontWeight: "700",
color: Colors.textPrimary,
},
overviewText: {
fontSize: moderateScale(14),
lineHeight: moderateScale(22),
color: Colors.textSecondary,
},
patternsContainer: {
gap: verticalScale(10),
},

View File

@ -7,6 +7,7 @@ import { Colors } from "@/theme";
import type { DetailRendererProps } from "../../types/renderer.types";
import { BackActionContext } from "../../context/BackActionContext";
import { Hero } from "../shared/Hero";
import { OverviewCard } from "../shared/OverviewCard";
import { SectionCard } from "../shared/SectionCard";
import { Paragraphs } from "../shared/Paragraphs";
import { BulletList } from "../shared/BulletList";
@ -457,15 +458,7 @@ export function ThreeBurnersDetailRenderer({
<Hero title="Three Burners" />
{/* Overview Card */}
{overviewText ? (
<View style={styles.overviewCard}>
<View style={styles.overviewHeader}>
<Ionicons name="information-circle" size={20} color={Colors.primary} />
<Text style={styles.overviewTitle}>Overview</Text>
</View>
<Text style={styles.overviewText}>{overviewText}</Text>
</View>
) : null}
{overviewText ? <OverviewCard text={overviewText} /> : null}
{/* Burner Categories (1. Upper Burner, 2. Middle Burner, 3. Lower Burner) */}
<View style={styles.patternsContainer}>
@ -505,29 +498,6 @@ const styles = StyleSheet.create({
paddingBottom: verticalScale(40),
gap: verticalScale(14),
},
overviewCard: {
backgroundColor: "#FFFFFF",
borderRadius: moderateScale(16),
borderWidth: 1,
borderColor: "#E2EAE5",
padding: moderateScale(16),
},
overviewHeader: {
flexDirection: "row",
alignItems: "center",
marginBottom: verticalScale(8),
gap: moderateScale(8),
},
overviewTitle: {
fontSize: moderateScale(16),
fontWeight: "700",
color: Colors.textPrimary,
},
overviewText: {
fontSize: moderateScale(13),
lineHeight: verticalScale(20),
color: Colors.textSecondary,
},
patternsContainer: {
gap: verticalScale(10),
},

View File

@ -7,6 +7,7 @@ import { Colors } from "@/theme";
import type { DetailRendererProps } from "../../types/renderer.types";
import { BackActionContext } from "../../context/BackActionContext";
import { Hero } from "../shared/Hero";
import { OverviewCard } from "../shared/OverviewCard";
import { SectionCard } from "../shared/SectionCard";
import { Paragraphs } from "../shared/Paragraphs";
import { BulletList } from "../shared/BulletList";
@ -613,15 +614,7 @@ export function TwelveChannelsDetailRenderer({
<Hero title="Twelve Channels" />
{/* 1. Overview Card */}
{overviewText ? (
<View style={styles.overviewCard}>
<View style={styles.overviewHeader}>
<Ionicons name="information-circle" size={20} color={Colors.primary} />
<Text style={styles.overviewTitle}>Overview</Text>
</View>
<Text style={styles.overviewText}>{overviewText}</Text>
</View>
) : null}
{overviewText ? <OverviewCard text={overviewText} /> : null}
{/* 2. Organ vs Channel Card */}
{organVsChannelText ? (
@ -756,29 +749,6 @@ const styles = StyleSheet.create({
paddingBottom: verticalScale(40),
gap: verticalScale(14),
},
overviewCard: {
backgroundColor: "#F0FDF4",
borderRadius: moderateScale(14),
borderWidth: 1,
borderColor: "#DCFCE7",
padding: moderateScale(16),
},
overviewHeader: {
flexDirection: "row",
alignItems: "center",
marginBottom: moderateScale(8),
gap: moderateScale(6),
},
overviewTitle: {
fontSize: moderateScale(15),
fontWeight: "700",
color: Colors.primaryDark,
},
overviewText: {
fontSize: moderateScale(14),
color: Colors.textSecondary,
lineHeight: moderateScale(21),
},
infoCard: {
backgroundColor: "#FFFFFF",
borderRadius: moderateScale(14),

View File

@ -20,11 +20,15 @@ if (Platform.OS === "android" && UIManager.setLayoutAnimationEnabledExperimental
export interface AccordionSectionProps {
title: string;
defaultExpanded?: boolean;
icon?: keyof typeof Ionicons.glyphMap;
iconColor?: string;
}
export function AccordionSection({
title,
defaultExpanded = true,
icon,
iconColor,
children,
}: PropsWithChildren<AccordionSectionProps>) {
const [expanded, setExpanded] = useState(defaultExpanded);
@ -53,6 +57,13 @@ export function AccordionSection({
]}
>
<View style={[styles.accent, { backgroundColor: tone.accent }]} />
{icon ? (
<Ionicons
name={icon}
size={moderateScale(18)}
color={iconColor ?? tone.accent}
/>
) : null}
<Text style={[styles.title, { color: tone.title }]}>{title}</Text>
<View style={styles.chevron}>
<Ionicons

View File

@ -0,0 +1,115 @@
import React from "react";
import {
StyleProp,
StyleSheet,
Text,
TextStyle,
View,
ViewStyle,
} from "react-native";
import { Ionicons } from "@expo/vector-icons";
import { moderateScale, verticalScale } from "react-native-size-matters";
import { Colors } from "@/theme";
export interface OverviewCardProps {
title?: string;
icon?: keyof typeof Ionicons.glyphMap;
iconColor?: string;
iconSize?: number;
text?: string | null;
paragraphs?: Array<string | null | undefined>;
children?: React.ReactNode;
style?: StyleProp<ViewStyle>;
titleStyle?: StyleProp<TextStyle>;
textStyle?: StyleProp<TextStyle>;
}
export function OverviewCard({
title = "Overview",
icon = "information-circle",
iconColor = Colors.primary,
iconSize = moderateScale(20),
text,
paragraphs,
children,
style,
titleStyle,
textStyle,
}: OverviewCardProps) {
const filteredParagraphs = paragraphs?.filter(
(p): p is string => typeof p === "string" && p.trim().length > 0,
);
const hasText = typeof text === "string" && text.trim().length > 0;
const hasParagraphs =
Array.isArray(filteredParagraphs) && filteredParagraphs.length > 0;
if (!hasText && !hasParagraphs && !children) {
return null;
}
return (
<View style={[styles.card, style]}>
<View style={styles.header}>
{icon ? (
<Ionicons name={icon} size={iconSize} color={iconColor} />
) : null}
<Text style={[styles.title, titleStyle]}>{title}</Text>
</View>
{hasText ? (
<Text style={[styles.text, textStyle]}>{text}</Text>
) : null}
{hasParagraphs
? filteredParagraphs.map((para, index) => (
<Text
key={index}
style={[
index === 0 && !hasText ? styles.text : styles.paragraph,
textStyle,
]}
>
{para}
</Text>
))
: null}
{children}
</View>
);
}
const styles = StyleSheet.create({
card: {
backgroundColor: Colors.surface,
borderRadius: moderateScale(12),
padding: moderateScale(14),
borderWidth: 1,
borderColor: Colors.border,
},
header: {
flexDirection: "row",
alignItems: "center",
gap: moderateScale(8),
marginBottom: verticalScale(8),
},
title: {
fontSize: moderateScale(16),
fontWeight: "700",
color: Colors.textPrimary,
},
text: {
fontSize: moderateScale(13),
lineHeight: moderateScale(20),
color: Colors.textSecondary,
},
paragraph: {
fontSize: moderateScale(13),
lineHeight: moderateScale(20),
color: Colors.textSecondary,
marginTop: verticalScale(8),
},
});

View File

@ -1,4 +1,5 @@
import React, { type PropsWithChildren, isValidElement } from "react";
import { Ionicons } from "@expo/vector-icons";
import { isEmptyValue } from "../../utils/attribute-presentation";
import { AccordionSection } from "./AccordionSection";
@ -7,6 +8,8 @@ import { useSettingsStore } from "@/store/settings.store";
export interface SectionCardProps {
title: string;
defaultExpanded?: boolean;
icon?: keyof typeof Ionicons.glyphMap;
iconColor?: string;
}
function hasRenderableContent(node: React.ReactNode): boolean {
@ -37,6 +40,8 @@ function hasRenderableContent(node: React.ReactNode): boolean {
export function SectionCard({
title,
defaultExpanded,
icon,
iconColor,
children,
}: PropsWithChildren<SectionCardProps>) {
if (!hasRenderableContent(children)) return null;
@ -48,8 +53,19 @@ export function SectionCard({
const isExpanded =
defaultExpanded !== undefined ? defaultExpanded : accordionDefaultExpanded;
const resolvedIcon =
icon ??
(title.trim().toLowerCase() === "overview"
? ("information-circle" as const)
: undefined);
return (
<AccordionSection title={title} defaultExpanded={isExpanded}>
<AccordionSection
title={title}
defaultExpanded={isExpanded}
icon={resolvedIcon}
iconColor={iconColor}
>
{children}
</AccordionSection>
);