diff --git a/src/features/content/renderers/collections/FiveElementsRenderers.tsx b/src/features/content/renderers/collections/FiveElementsRenderers.tsx
new file mode 100644
index 0000000..7830396
--- /dev/null
+++ b/src/features/content/renderers/collections/FiveElementsRenderers.tsx
@@ -0,0 +1,167 @@
+import React from "react";
+import { Pressable, StyleSheet, Text, View } from "react-native";
+import { Ionicons } from "@expo/vector-icons";
+import { moderateScale, verticalScale } from "react-native-size-matters";
+
+import { Colors } from "@/theme";
+import { asNumber, asString } from "../helpers/value";
+import { CollectionScaffold } from "../shared/CollectionScaffold";
+import { ContentCountBadge } from "../shared/ContentCountBadge";
+import type {
+ CollectionItemRendererProps,
+ CollectionRendererProps,
+} from "../../types/renderer.types";
+
+export function FiveElementsCollectionRenderer(props: CollectionRendererProps) {
+ const header = (
+
+
+
+
+ Overview
+
+
+ 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.
+
+
+ Sequences
+
+ );
+
+ const sortedItems = React.useMemo(() => {
+ return [...props.items].sort((a, b) => {
+ const orderA = asNumber(a.attributes.sort_order) ?? 999;
+ const orderB = asNumber(b.attributes.sort_order) ?? 999;
+ return orderA - orderB;
+ });
+ }, [props.items]);
+
+ return ;
+}
+
+export function FiveElementsCardRenderer({
+ item,
+ onPress,
+}: CollectionItemRendererProps) {
+ const attributes = item.attributes;
+ const title = asString(attributes.title) || asString(attributes.name) || item.title;
+ const label =
+ asString(attributes.content_label) ||
+ asString(attributes.description) ||
+ item.summary ||
+ "Open sequence";
+
+ const sortOrder = asNumber(attributes.sort_order);
+ const sequenceNumber = typeof sortOrder === "number" ? sortOrder + 1 : undefined;
+
+ return (
+ [styles.row, pressed && styles.pressed]}
+ >
+
+ {sequenceNumber !== undefined ? sequenceNumber : "•"}
+
+
+
+ {title}
+
+ {label}
+
+
+
+
+
+
+ );
+}
+
+const styles = StyleSheet.create({
+ overviewContainer: {
+ 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",
+ color: Colors.textPrimary,
+ marginBottom: verticalScale(4),
+ marginLeft: moderateScale(4),
+ },
+ row: {
+ minHeight: moderateScale(68),
+ flexDirection: "row",
+ alignItems: "center",
+ padding: moderateScale(14),
+ },
+ pressed: {
+ opacity: 0.72,
+ },
+ iconWrapper: {
+ width: moderateScale(40),
+ height: moderateScale(40),
+ borderRadius: moderateScale(20),
+ justifyContent: "center",
+ alignItems: "center",
+ backgroundColor: "#E8F5E9",
+ },
+ sequenceNumber: {
+ fontSize: moderateScale(16),
+ fontWeight: "800",
+ color: Colors.primaryDark,
+ },
+ textContainer: {
+ flex: 1,
+ marginLeft: moderateScale(12),
+ marginRight: moderateScale(10),
+ },
+ title: {
+ fontSize: moderateScale(15),
+ fontWeight: "600",
+ color: Colors.textPrimary,
+ marginBottom: verticalScale(2),
+ },
+ description: {
+ fontSize: moderateScale(12),
+ color: Colors.textSecondary,
+ },
+});
diff --git a/src/features/content/renderers/details/FiveElementsDetailRenderer.tsx b/src/features/content/renderers/details/FiveElementsDetailRenderer.tsx
new file mode 100644
index 0000000..0f3f374
--- /dev/null
+++ b/src/features/content/renderers/details/FiveElementsDetailRenderer.tsx
@@ -0,0 +1,378 @@
+import React from "react";
+import { Pressable, ScrollView, StyleSheet, Text, View } from "react-native";
+import { Ionicons } from "@expo/vector-icons";
+import { router } from "expo-router";
+import { moderateScale, verticalScale } from "react-native-size-matters";
+
+import { Colors } from "@/theme";
+import type { DetailRendererProps } from "../../types/renderer.types";
+import { ContentLinkAttributeSections } from "../shared/ContentLinkAttributeSections";
+import { Hero } from "../shared/Hero";
+import { asRecordArray, asString, asStringArray } from "../helpers/value";
+
+function resolveSequenceTargetTemplate(
+ currentModule: string,
+ sectionTitle: string,
+ sectionRecord: Record,
+ index: number,
+): string {
+ // 1. Direct template_code in data section if present
+ const directTemplate =
+ asString(sectionRecord.template_code) ||
+ asString(
+ (sectionRecord.link as Record | undefined)?.target
+ ? ((sectionRecord.link as Record).target as Record).template_code
+ : undefined,
+ );
+ if (directTemplate) return directTemplate;
+
+ // 2. Resolve by semantic title keyword
+ const normalized = sectionTitle.toLowerCase();
+ if (normalized.includes("generating")) return `${currentModule}_ct0002`;
+ if (normalized.includes("overacting")) return `${currentModule}_ct0003`;
+ if (normalized.includes("insulting")) return `${currentModule}_ct0004`;
+
+ // 3. Fallback by ordinal index
+ return `${currentModule}_ct000${index + 2}`;
+}
+
+function extractParagraphs(value: unknown): string[] {
+ if (Array.isArray(value)) {
+ return value
+ .map((item) => asString(item).trim())
+ .filter((item) => item.length > 0);
+ }
+ const str = asString(value).trim();
+ return str.length > 0 ? [str] : [];
+}
+
+export function FiveElementsDetailRenderer({
+ moduleCode,
+ templateCode,
+ content,
+ data,
+ definitions,
+ presentationAttributes,
+}: DetailRendererProps) {
+ const currentModule = moduleCode || "m0019";
+ const title =
+ asString(data.name) ||
+ asString(data.title) ||
+ content.title ||
+ "";
+
+ const code = asString(data.code) || templateCode || content.slug || "";
+
+ // Dynamic Overview resolution from data only (generic fallback hierarchy)
+ const overviewCandidates = [
+ extractParagraphs(data.overview),
+ extractParagraphs(data.content),
+ extractParagraphs(data.description),
+ extractParagraphs(content.summary),
+ ];
+ const overviewParagraphs =
+ overviewCandidates.find((candidates) => candidates.length > 0) ?? [];
+
+ const rawSections = asRecordArray(data.sections);
+
+ // The Identification page is the parent/entry screen containing sequence links
+ const isIdentificationPage =
+ templateCode.toLowerCase() === `${currentModule.toLowerCase()}_ct0001` ||
+ code.toLowerCase().includes("identification") ||
+ title.toLowerCase().includes("identification");
+
+ // ----------------------------------------------------
+ // SCREEN 1: Identification Page with Dynamic Sequence Buttons
+ // ----------------------------------------------------
+ if (isIdentificationPage) {
+ return (
+
+
+
+ {/* Overview Card (rendered only when overview/content exists in data) */}
+ {overviewParagraphs.length > 0 ? (
+
+
+
+ Overview
+
+ {overviewParagraphs.map((para, idx) => (
+ 0 && styles.paragraphSpacing]}
+ >
+ {para}
+
+ ))}
+
+ ) : null}
+
+ {/* Dynamic Sequences List from data.sections */}
+ {rawSections.length > 0 ? (
+
+ Sequences
+ {rawSections.map((sec, idx) => {
+ const sectionTitle = asString(sec.title) || `Sequence ${idx + 1}`;
+ const sectionItems = asStringArray(sec.content);
+ const count = sectionItems.length;
+ const targetTemplate = resolveSequenceTargetTemplate(
+ currentModule,
+ sectionTitle,
+ sec,
+ idx,
+ );
+
+ return (
+
+ router.push(
+ `/modules/${encodeURIComponent(currentModule)}/${encodeURIComponent(targetTemplate)}` as never,
+ )
+ }
+ style={({ pressed }) => [styles.sequenceRow, pressed && styles.pressed]}
+ >
+
+ {idx + 1}
+
+
+
+ {sectionTitle}
+
+
+ {count > 0 ? (
+
+ {count} patterns
+
+ ) : null}
+
+
+
+ );
+ })}
+
+ ) : null}
+
+
+
+ );
+ }
+
+ // ----------------------------------------------------
+ // SCREEN 2: Leaf Node Data Page (Specific Sequence Patterns)
+ // ----------------------------------------------------
+ return (
+
+
+
+ {/* Overview Card (rendered only when overview/content exists in data) */}
+ {overviewParagraphs.length > 0 ? (
+
+
+
+ Overview
+
+ {overviewParagraphs.map((para, idx) => (
+ 0 && styles.paragraphSpacing]}
+ >
+ {para}
+
+ ))}
+
+ ) : null}
+
+ {/* Numbered Pattern Cards from data.sections */}
+ {rawSections.length > 0 ? (
+
+ Patterns & Manifestations
+ {rawSections.map((sec, idx) => {
+ const sectionTitle = asString(sec.title) || `Pattern ${idx + 1}`;
+ const sectionContent = extractParagraphs(sec.content);
+
+ return (
+
+
+
+ {idx + 1}
+
+ {sectionTitle}
+
+
+ {sectionContent.length > 0 ? (
+
+ {sectionContent.map((text, cIdx) => (
+
+ {text}
+
+ ))}
+
+ ) : null}
+
+ );
+ })}
+
+ ) : null}
+
+
+
+ );
+}
+
+const styles = StyleSheet.create({
+ container: {
+ paddingHorizontal: moderateScale(16),
+ paddingTop: verticalScale(14),
+ 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),
+ },
+ sectionHeading: {
+ fontSize: moderateScale(15),
+ fontWeight: "700",
+ color: Colors.textPrimary,
+ marginLeft: moderateScale(4),
+ marginBottom: verticalScale(2),
+ },
+ sequenceRow: {
+ minHeight: moderateScale(60),
+ flexDirection: "row",
+ alignItems: "center",
+ padding: moderateScale(14),
+ backgroundColor: "#FFFFFF",
+ borderRadius: moderateScale(14),
+ borderWidth: 1,
+ borderColor: "#E2EAE5",
+ },
+ pressed: {
+ opacity: 0.72,
+ },
+ sequenceNumberWrapper: {
+ width: moderateScale(36),
+ height: moderateScale(36),
+ borderRadius: moderateScale(18),
+ justifyContent: "center",
+ alignItems: "center",
+ backgroundColor: "#E8F5E9",
+ },
+ sequenceNumber: {
+ fontSize: moderateScale(15),
+ fontWeight: "800",
+ color: Colors.primaryDark,
+ },
+ sequenceTextWrapper: {
+ flex: 1,
+ marginLeft: moderateScale(12),
+ marginRight: moderateScale(8),
+ },
+ sequenceTitle: {
+ fontSize: moderateScale(15),
+ fontWeight: "600",
+ color: Colors.textPrimary,
+ },
+ badgeWrapper: {
+ backgroundColor: "#F3F4F6",
+ paddingHorizontal: moderateScale(8),
+ paddingVertical: verticalScale(4),
+ borderRadius: moderateScale(8),
+ marginRight: moderateScale(6),
+ },
+ badgeText: {
+ fontSize: moderateScale(11),
+ fontWeight: "600",
+ color: Colors.textSecondary,
+ },
+ sectionsContainer: {
+ gap: verticalScale(12),
+ },
+ patternCard: {
+ backgroundColor: "#FFFFFF",
+ borderRadius: moderateScale(14),
+ borderWidth: 1,
+ borderColor: "#E5E7EB",
+ overflow: "hidden",
+ },
+ patternHeader: {
+ flexDirection: "row",
+ alignItems: "center",
+ paddingHorizontal: moderateScale(14),
+ paddingVertical: verticalScale(12),
+ backgroundColor: "#F9FAFB",
+ borderBottomWidth: 1,
+ borderBottomColor: "#EEF2F6",
+ gap: moderateScale(10),
+ },
+ numberBadge: {
+ width: moderateScale(28),
+ height: moderateScale(28),
+ borderRadius: moderateScale(14),
+ backgroundColor: "#E8F5E9",
+ justifyContent: "center",
+ alignItems: "center",
+ },
+ numberText: {
+ fontSize: moderateScale(14),
+ fontWeight: "800",
+ color: Colors.primaryDark,
+ },
+ patternTitle: {
+ flex: 1,
+ fontSize: moderateScale(14),
+ fontWeight: "700",
+ color: Colors.textPrimary,
+ },
+ patternBody: {
+ padding: moderateScale(14),
+ gap: verticalScale(10),
+ },
+ contentText: {
+ fontSize: moderateScale(13),
+ lineHeight: verticalScale(19),
+ color: Colors.textSecondary,
+ },
+});
diff --git a/src/features/content/renderers/registry.ts b/src/features/content/renderers/registry.ts
index 6733e84..60ae99f 100644
--- a/src/features/content/renderers/registry.ts
+++ b/src/features/content/renderers/registry.ts
@@ -36,6 +36,8 @@ import { EightPrinciplesDetailRenderer } from "./details/EightPrinciplesDetailRe
import { FourLevelsCollectionRenderer, FourLevelsCardRenderer } from "./collections/FourLevelsRenderers";
import { PathogenicFactorsCollectionRenderer, PathogenicFactorsCardRenderer } from "./collections/PathogenicFactorsRenderers";
import { PathogenicFactorsDetailRenderer } from "./details/PathogenicFactorsDetailRenderer";
+import { FiveElementsCollectionRenderer, FiveElementsCardRenderer } from "./collections/FiveElementsRenderers";
+import { FiveElementsDetailRenderer } from "./details/FiveElementsDetailRenderer";
import { QiBloodCollectionRenderer, QiBloodCardRenderer } from "./collections/QiBloodRenderers";
import { QiBloodDetailRenderer } from "./details/QiBloodDetailRenderer";
import { TwelveChannelsCollectionRenderer, TwelveChannelsCardRenderer } from "./collections/TwelveChannelsRenderers";
@@ -64,6 +66,8 @@ export const collectionRenderers: Readonly>
four_levels_detail: FourLevelsDetailRenderer,
eight_principles_detail: EightPrinciplesDetailRenderer,
pathogenic_factors_detail: PathogenicFactorsDetailRenderer,
+ five_elements_detail: FiveElementsDetailRenderer,
chinese_scalp_acupuncture_detail: AcuPointDetailRenderer,
nutrition_food_detail: GenericDetailRenderer,
nutrition_effect_detail: GenericDetailRenderer,
@@ -144,6 +151,11 @@ export const detailRenderers: Readonly>
m0011_ct0005_detail: EightPrinciplesDetailRenderer,
m0014_ct0001_detail: PathogenicFactorsDetailRenderer,
m0014_ct0002_detail: PathogenicFactorsDetailRenderer,
+ m0019_ct0001_detail: FiveElementsDetailRenderer,
+ m0019_ct0002_detail: FiveElementsDetailRenderer,
+ m0019_ct0003_detail: FiveElementsDetailRenderer,
+ m0019_ct0004_detail: FiveElementsDetailRenderer,
+ m0019_ct0005_detail: FiveElementsDetailRenderer,
qi_blood_detail: QiBloodDetailRenderer,
m0013_ct0001_detail: QiBloodDetailRenderer,
m0013_ct0002_detail: QiBloodDetailRenderer,
@@ -200,6 +212,9 @@ export function resolveCollectionRenderer(
if (normalizedTemplate === "m0014_ct0001" || normalizedModule === "m0014") {
return PathogenicFactorsCollectionRenderer;
}
+ if (normalizedTemplate === "m0019_ct0005" || normalizedModule === "m0019") {
+ return FiveElementsCollectionRenderer;
+ }
if (normalizedTemplate === "m0013_ct0001" || normalizedModule === "m0013") {
return QiBloodCollectionRenderer;
}
@@ -236,6 +251,9 @@ export function resolveCollectionItemRenderer(
if (normalizedTemplate === "m0014_ct0001" || normalizedModule === "m0014") {
return PathogenicFactorsCardRenderer;
}
+ if (normalizedTemplate === "m0019_ct0005" || normalizedModule === "m0019") {
+ return FiveElementsCardRenderer;
+ }
if (normalizedTemplate === "m0013_ct0001" || normalizedModule === "m0013") {
return QiBloodCardRenderer;
}
@@ -287,6 +305,12 @@ export function resolveDetailRenderer(
) {
return PathogenicFactorsDetailRenderer;
}
+ if (
+ normalizedTemplate?.startsWith("m0019_") ||
+ normalizedModule === "m0019"
+ ) {
+ return FiveElementsDetailRenderer;
+ }
if (
normalizedTemplate?.startsWith("m0013_") ||
normalizedModule === "m0013"
diff --git a/src/features/content/screens/SingleTemplateScreen.tsx b/src/features/content/screens/SingleTemplateScreen.tsx
index d1edc51..67ba509 100644
--- a/src/features/content/screens/SingleTemplateScreen.tsx
+++ b/src/features/content/screens/SingleTemplateScreen.tsx
@@ -66,6 +66,10 @@ export function SingleTemplateScreen({
const presentationAttributes = contract.presentation.attributes ?? [];
const presentedData = applyPresentationContractToData(data, presentationAttributes);
+ const pointName = typeof data.point_name === "string" ? data.point_name.trim() : "";
+ const name = typeof data.name === "string" ? data.name.trim() : "";
+ const displayTitle = pointName || name || content.title;
+
return (
diff --git a/src/features/modules/module-index.ts b/src/features/modules/module-index.ts
index 532896d..92466c6 100644
--- a/src/features/modules/module-index.ts
+++ b/src/features/modules/module-index.ts
@@ -101,6 +101,7 @@ const MODULE_VISUALS: Record = {
color: "#6366F1",
isDefaultFree: false,
planCode: "PATTERN_CORE",
+ entryTemplateCode: "m0019_ct0001",
},
m0020: {
icon: "git-branch-outline",