diff --git a/src/features/content/renderers/details/BackShuDetailRenderer.tsx b/src/features/content/renderers/details/BackShuDetailRenderer.tsx
index 001c0d3..4242b60 100644
--- a/src/features/content/renderers/details/BackShuDetailRenderer.tsx
+++ b/src/features/content/renderers/details/BackShuDetailRenderer.tsx
@@ -1,8 +1,13 @@
import React from "react";
-import { ScrollView } from "react-native";
import type { DetailRendererProps } from "../../types/renderer.types";
-import { ContentLinkAttributeSections } from "../shared/ContentLinkAttributeSections";
-import { asString } from "../helpers/value";
-import { Hero } from "../shared/Hero";
-import { DescriptionList, Images, ObjectArrayCards, ObjectArrayTable, ObjectCard, PointCodes, Strings } from "./categoryParts";
-export function BackShuDetailRenderer({content,data,definitions,presentationAttributes}:DetailRendererProps){ return ; }
+import { YuanSourceDetailRenderer } from "./YuanSourceDetailRenderer";
+
+/** Renders Back-Shu category details using the shared Overview and expandable Points accordion layout. */
+export function BackShuDetailRenderer(props: DetailRendererProps) {
+ return (
+
+ );
+}
diff --git a/src/features/content/renderers/details/FrontMuDetailRenderer.tsx b/src/features/content/renderers/details/FrontMuDetailRenderer.tsx
index 9fe7fd0..9d038c5 100644
--- a/src/features/content/renderers/details/FrontMuDetailRenderer.tsx
+++ b/src/features/content/renderers/details/FrontMuDetailRenderer.tsx
@@ -1,8 +1,13 @@
import React from "react";
-import { ScrollView } from "react-native";
import type { DetailRendererProps } from "../../types/renderer.types";
-import { ContentLinkAttributeSections } from "../shared/ContentLinkAttributeSections";
-import { asString } from "../helpers/value";
-import { Hero } from "../shared/Hero";
-import { DescriptionList, Images, ObjectArrayCards, ObjectArrayTable, ObjectCard, PointCodes, Strings } from "./categoryParts";
-export function FrontMuDetailRenderer({content,data,definitions,presentationAttributes}:DetailRendererProps){ return ; }
+import { YuanSourceDetailRenderer } from "./YuanSourceDetailRenderer";
+
+/** Renders Front-Mu category details using the shared Overview and expandable Points accordion layout. */
+export function FrontMuDetailRenderer(props: DetailRendererProps) {
+ return (
+
+ );
+}
diff --git a/src/features/content/renderers/details/InfluentialPointsDetailRenderer.tsx b/src/features/content/renderers/details/InfluentialPointsDetailRenderer.tsx
new file mode 100644
index 0000000..fca10d6
--- /dev/null
+++ b/src/features/content/renderers/details/InfluentialPointsDetailRenderer.tsx
@@ -0,0 +1,14 @@
+import React from "react";
+import type { DetailRendererProps } from "../../types/renderer.types";
+import { YuanSourceDetailRenderer } from "./YuanSourceDetailRenderer";
+
+/** Renders Influential Points (Ba Hui Xue) category details using the shared accordion layout. */
+export function InfluentialPointsDetailRenderer(props: DetailRendererProps) {
+ return (
+
+ );
+}
+
diff --git a/src/features/content/renderers/details/LuoConnectingDetailRenderer.tsx b/src/features/content/renderers/details/LuoConnectingDetailRenderer.tsx
index 131c323..05f26a2 100644
--- a/src/features/content/renderers/details/LuoConnectingDetailRenderer.tsx
+++ b/src/features/content/renderers/details/LuoConnectingDetailRenderer.tsx
@@ -1,8 +1,13 @@
import React from "react";
-import { ScrollView } from "react-native";
import type { DetailRendererProps } from "../../types/renderer.types";
-import { ContentLinkAttributeSections } from "../shared/ContentLinkAttributeSections";
-import { asString } from "../helpers/value";
-import { Hero } from "../shared/Hero";
-import { DescriptionList, Images, ObjectArrayCards, ObjectArrayTable, ObjectCard, PointCodes, Strings } from "./categoryParts";
-export function LuoConnectingDetailRenderer({content,data,definitions,presentationAttributes}:DetailRendererProps){ return ; }
+import { YuanSourceDetailRenderer } from "./YuanSourceDetailRenderer";
+
+/** Renders Luo-Connecting category details using the shared Overview and expandable Points accordion layout. */
+export function LuoConnectingDetailRenderer(props: DetailRendererProps) {
+ return (
+
+ );
+}
diff --git a/src/features/content/renderers/details/XiCleftDetailRenderer.tsx b/src/features/content/renderers/details/XiCleftDetailRenderer.tsx
index 9d7da6b..5e4fbd3 100644
--- a/src/features/content/renderers/details/XiCleftDetailRenderer.tsx
+++ b/src/features/content/renderers/details/XiCleftDetailRenderer.tsx
@@ -1,8 +1,8 @@
import React from "react";
-import { ScrollView } from "react-native";
import type { DetailRendererProps } from "../../types/renderer.types";
-import { ContentLinkAttributeSections } from "../shared/ContentLinkAttributeSections";
-import { asString } from "../helpers/value";
-import { Hero } from "../shared/Hero";
-import { DescriptionList, Images, ObjectArrayCards, ObjectArrayTable, ObjectCard, PointCodes, Strings } from "./categoryParts";
-export function XiCleftDetailRenderer({content,data,definitions,presentationAttributes}:DetailRendererProps){ return ; }
+import { YuanSourceDetailRenderer } from "./YuanSourceDetailRenderer";
+
+/** Renders Xi-Cleft category details using the shared Overview and expandable Points accordion layout. */
+export function XiCleftDetailRenderer(props: DetailRendererProps) {
+ return ;
+}
diff --git a/src/features/content/renderers/details/YuanLuoDetailRenderer.tsx b/src/features/content/renderers/details/YuanLuoDetailRenderer.tsx
new file mode 100644
index 0000000..4f30416
--- /dev/null
+++ b/src/features/content/renderers/details/YuanLuoDetailRenderer.tsx
@@ -0,0 +1,248 @@
+import React, { useMemo } from "react";
+import { ScrollView, StyleSheet, Text, View } from "react-native";
+import { useRouter } from "expo-router";
+import { moderateScale, verticalScale } from "react-native-size-matters";
+
+import { Colors } from "@/theme";
+import { useSettingsStore } from "@/store/settings.store";
+import type { DetailRendererProps } from "../../types/renderer.types";
+import {
+ asNumber,
+ asRecordArray,
+ asString,
+ asStringArray,
+} from "../helpers/value";
+import { BulletList } from "../shared/BulletList";
+import { ContentLinkAttributeSections } from "../shared/ContentLinkAttributeSections";
+import { Hero } from "../shared/Hero";
+import { OverviewCard } from "../shared/OverviewCard";
+import { Images } from "./categoryParts";
+import {
+ buildCategoryOverviewParagraphs,
+ extractPointRefLabel,
+ navigateToPointRef,
+ PointCategoryAccordionCard,
+ pointCategoryStyles,
+ PointLinkChip,
+ type PointsCatalogMap,
+ usePointsCatalogMap,
+} from "./pointCategoryShared";
+
+interface PairingItemProps {
+ key?: React.Key;
+ pairing: Record;
+ index: number;
+ defaultExpanded: boolean;
+ moduleCode: string;
+ pointsCatalogMap: PointsCatalogMap;
+}
+
+function PairingAccordionCard({
+ pairing,
+ index,
+ defaultExpanded,
+ moduleCode,
+ pointsCatalogMap,
+}: PairingItemProps) {
+ const router = useRouter();
+
+ const num = asNumber(pairing.number) ?? index + 1;
+ const meridianPair = asString(pairing.meridian_pair).trim();
+ const hostLabel = extractPointRefLabel(pairing.host);
+ const guestLabel = extractPointRefLabel(pairing.guest);
+ const patterns = asRecordArray(pairing.patterns);
+
+ const title = meridianPair
+ ? `${num}. ${meridianPair}`
+ : `Pairing ${num}`;
+ const pairBadge =
+ hostLabel && guestLabel
+ ? `${hostLabel} + ${guestLabel}`
+ : hostLabel || guestLabel;
+
+ return (
+
+ {patterns.map((pattern, patternIdx) => {
+ const patternCode = asString(pattern.pattern_code).trim();
+ const patternName = asString(pattern.pattern_name).trim();
+ const needleTechnique = asString(pattern.needle_technique).trim();
+ const actions = asStringArray(pattern.actions);
+ const indications = asStringArray(pattern.indications);
+
+ const heading = patternCode && patternName
+ ? `${patternCode}. ${patternName}`
+ : patternName || `Pattern ${patternIdx + 1}`;
+
+ return (
+ 0 && styles.patternDivider,
+ ]}
+ >
+ {heading}
+
+ {needleTechnique ? (
+
+
+ NEEDLE TECHNIQUE
+
+ {needleTechnique}
+
+ ) : null}
+
+ {actions.length > 0 ? (
+
+ ACTIONS
+
+
+ ) : null}
+
+ {indications.length > 0 ? (
+
+ INDICATIONS
+
+
+ ) : null}
+
+ );
+ })}
+
+ {hostLabel || guestLabel ? (
+
+ {hostLabel ? (
+
+ navigateToPointRef(
+ router,
+ pairing.host,
+ moduleCode,
+ pointsCatalogMap,
+ )
+ }
+ />
+ ) : null}
+ {guestLabel ? (
+
+ navigateToPointRef(
+ router,
+ pairing.guest,
+ moduleCode,
+ pointsCatalogMap,
+ )
+ }
+ />
+ ) : null}
+
+ ) : null}
+
+ );
+}
+
+/** Renders Yuan–Luo (Host–Guest) category overview and meridian pairing pattern accordions. */
+export function YuanLuoDetailRenderer({
+ moduleCode = "m0001",
+ content,
+ data,
+ definitions,
+ presentationAttributes,
+}: DetailRendererProps) {
+ const accordionDefaultExpanded = useSettingsStore(
+ (state) => state.accordionDefaultExpanded,
+ );
+ const pointsCatalogMap = usePointsCatalogMap(moduleCode);
+
+ const rawTitle =
+ asString(data.title) || asString(data.name) || content.title || "Yuan–Luo Points";
+ const alias = asString(data.alias).trim() || undefined;
+ const overviewParagraphs = useMemo(
+ () => buildCategoryOverviewParagraphs(data),
+ [data],
+ );
+ const pairings = asRecordArray(data.pairings);
+
+ return (
+
+
+
+
+
+ {overviewParagraphs.length > 0 ? (
+
+ ) : null}
+
+ {pairings.length > 0 ? (
+
+ {pairings.map((pairing, index) => (
+
+ ))}
+
+ ) : null}
+
+
+
+ );
+}
+
+const styles = StyleSheet.create({
+ patternBlock: {
+ gap: verticalScale(10),
+ },
+ patternDivider: {
+ paddingTop: verticalScale(12),
+ borderTopWidth: 1,
+ borderTopColor: "#E2E8F0",
+ },
+ patternTitle: {
+ fontSize: moderateScale(15),
+ lineHeight: moderateScale(21),
+ fontWeight: "700",
+ color: Colors.primaryDark,
+ },
+ techniqueBox: {
+ backgroundColor: "#F8FAFC",
+ borderRadius: moderateScale(10),
+ borderWidth: 1,
+ borderColor: "#E2E8F0",
+ paddingHorizontal: moderateScale(12),
+ paddingVertical: verticalScale(8),
+ gap: verticalScale(3),
+ },
+ techniqueText: {
+ fontSize: moderateScale(14),
+ lineHeight: moderateScale(20),
+ fontWeight: "600",
+ color: "#1E293B",
+ },
+ listGroup: {
+ gap: verticalScale(6),
+ },
+});
+
diff --git a/src/features/content/renderers/details/YuanSourceDetailRenderer.tsx b/src/features/content/renderers/details/YuanSourceDetailRenderer.tsx
index 9201986..7143549 100644
--- a/src/features/content/renderers/details/YuanSourceDetailRenderer.tsx
+++ b/src/features/content/renderers/details/YuanSourceDetailRenderer.tsx
@@ -1,68 +1,66 @@
-import React, { useMemo, useState } from "react";
-import {
- LayoutAnimation,
- Platform,
- Pressable,
- ScrollView,
- StyleSheet,
- Text,
- UIManager,
- View,
-} from "react-native";
-import { Ionicons } from "@expo/vector-icons";
+import React, { useMemo } from "react";
+import { ScrollView, Text, View } from "react-native";
import { useRouter } from "expo-router";
-import { moderateScale, verticalScale } from "react-native-size-matters";
-import { Colors, Radius } from "@/theme";
import { useSettingsStore } from "@/store/settings.store";
import type { DetailRendererProps } from "../../types/renderer.types";
-import { useModuleTemplateContentDetailsQuery } from "../../hooks/use-content-queries";
-import {
- buildContentReferenceRoute,
- parseNavigableContentReference,
-} from "../../utils/content-reference";
-import {
- asRecord,
- asRecordArray,
- asString,
- asStringArray,
-} from "../helpers/value";
+import { asRecordArray, asString, asStringArray } from "../helpers/value";
import { BulletList } from "../shared/BulletList";
import { ContentLinkAttributeSections } from "../shared/ContentLinkAttributeSections";
import { Hero } from "../shared/Hero";
import { OverviewCard } from "../shared/OverviewCard";
import { Images } from "./categoryParts";
-
-if (Platform.OS === "android" && UIManager.setLayoutAnimationEnabledExperimental) {
- UIManager.setLayoutAnimationEnabledExperimental(true);
-}
+import {
+ buildCategoryOverviewParagraphs,
+ extractPointRefLabel,
+ navigateToPointRef,
+ PointCategoryAccordionCard,
+ pointCategoryStyles,
+ PointLinkChip,
+ type PointsCatalogMap,
+ usePointsCatalogMap,
+} from "./pointCategoryShared";
interface PointItemProps {
key?: React.Key;
item: Record;
defaultExpanded: boolean;
moduleCode: string;
- pointsCatalogMap?: Map;
+ pointsCatalogMap?: PointsCatalogMap;
}
-function sanitizeMeridianHeading(meridian: string, chineseName: string): string {
- const cleanChinese = chineseName.replace(/^\((.*)\)$/, "$1").trim();
+function formatPointHeading(
+ primaryLabel: string,
+ pointName: string,
+ pointCode?: string,
+): string {
+ const cleanName = pointName.replace(/^\((.*)\)$/, "$1").trim();
+ const cleanCode = (pointCode || "").trim();
- // Strip meridian abbreviation codes or point codes in parentheses,
- // e.g. (ST), (LU-9), (LI), (LV), (LR), (PC), (GB), (HT), etc.
- const cleanedMeridian = meridian
+ // Strip meridian abbreviation codes or point codes in parentheses.
+ const cleanedPrimary = primaryLabel
.replace(/\s*\(\s*[A-Z]{1,4}(?:[\s\-_]*\d+)?\s*\)\s*/g, " ")
.replace(/\s+/g, " ")
.trim();
- if (cleanedMeridian && cleanChinese) {
- if (cleanedMeridian.toLowerCase().includes(cleanChinese.toLowerCase())) {
- return cleanedMeridian;
- }
- return `${cleanedMeridian} (${cleanChinese})`;
+ const parts: string[] = [];
+ if (cleanedPrimary) {
+ parts.push(cleanedPrimary);
+ }
+ if (
+ cleanCode &&
+ !cleanedPrimary.toLowerCase().includes(cleanCode.toLowerCase())
+ ) {
+ parts.push(cleanCode);
+ }
+ if (
+ cleanName &&
+ !cleanedPrimary.toLowerCase().includes(cleanName.toLowerCase())
+ ) {
+ parts.push(`(${cleanName})`);
}
- return cleanedMeridian || cleanChinese || "Point";
+ return parts.join(" ") || "Point";
}
function PointAccordionCard({
@@ -72,262 +70,133 @@ function PointAccordionCard({
pointsCatalogMap,
}: PointItemProps) {
const router = useRouter();
- const [expanded, setExpanded] = useState(defaultExpanded);
- const meridian = asString(item.meridian).trim();
- const chineseName = asString(item.chinese_name).trim();
+ const primaryLabel =
+ asString(item.meridian).trim() ||
+ asString(item.organ).trim() ||
+ asString(item.category).trim();
+ const pointName =
+ asString(item.chinese_name).trim() || asString(item.pinyin_name).trim();
const element = asString(item.element).trim();
+ const yinYang = asString(item.yin_yang).trim();
+ const connection = asString(item.connection).trim();
const caution = asString(item.caution).trim();
const cautionList = asStringArray(item.caution);
-
const actions = asStringArray(item.actions);
const indications = asStringArray(item.indications);
- // Format header title: e.g. "Stomach (Chongyang)", "Lung (Taiyuan)"
- const title = useMemo(() => {
- return sanitizeMeridianHeading(meridian, chineseName);
- }, [meridian, chineseName]);
+ const pointLabel = extractPointRefLabel(item.point);
- // Resolve point reference for linkable button
- const rawPoint = asRecord(item.point);
- const directRef = parseNavigableContentReference(item.point);
+ const title = useMemo(
+ () => formatPointHeading(primaryLabel, pointName, pointLabel),
+ [primaryLabel, pointName, pointLabel],
+ );
- // Extract candidate point codes/labels: e.g. "LU 9", "LU-9"
- const pointLabel =
- directRef?.label?.trim() ||
- asString(rawPoint.label).trim() ||
- (rawPoint.target && typeof rawPoint.target === "object"
- ? asString((rawPoint.target as Record).source_code).trim()
- : "") ||
- "";
-
- // Construct button display label: e.g. "LU-9 (Taiyuan)" or "LU 9 (Taiyuan)"
const pointButtonLabel = useMemo(() => {
const baseCode = pointLabel || "Point Details";
- if (chineseName && !baseCode.toLowerCase().includes(chineseName.toLowerCase())) {
- return `${baseCode} (${chineseName})`;
+ if (pointName && !baseCode.toLowerCase().includes(pointName.toLowerCase())) {
+ return `${baseCode} (${pointName})`;
}
return baseCode;
- }, [pointLabel, chineseName]);
+ }, [pointLabel, pointName]);
- // Resolve navigation destination
- const navigateToPoint = () => {
- if (directRef) {
- router.push(buildContentReferenceRoute(directRef) as never);
- return;
- }
-
- if (rawPoint.target && typeof rawPoint.target === "object") {
- const target = rawPoint.target as Record;
- const targetModule = asString(target.module_code).trim() || moduleCode || "m0001";
- const targetTemplate = asString(target.template_code).trim() || "m0001_ct0003";
- const contentId = asString(target.content_id).trim();
- const sourceCode = asString(target.source_code).trim();
-
- if (contentId) {
- router.push(
- `/modules/${encodeURIComponent(targetModule)}/${encodeURIComponent(targetTemplate)}/${encodeURIComponent(contentId)}` as never,
- );
- return;
- }
-
- // Fallback: match by catalog map (from m0001_ct0003) using sourceCode or label
- if (pointsCatalogMap && sourceCode) {
- const found =
- pointsCatalogMap.get(sourceCode.toLowerCase()) ||
- pointsCatalogMap.get(sourceCode.replace(/[- ]/g, "").toLowerCase());
- if (found) {
- router.push(
- `/modules/${encodeURIComponent(targetModule)}/${encodeURIComponent(targetTemplate)}/${encodeURIComponent(found.contentId)}` as never,
- );
- return;
- }
- }
- }
-
- // Secondary fallback matching by pointLabel in catalog
- if (pointsCatalogMap && pointLabel) {
- const found =
- pointsCatalogMap.get(pointLabel.toLowerCase()) ||
- pointsCatalogMap.get(pointLabel.replace(/[- ]/g, "").toLowerCase());
- if (found) {
- router.push(
- `/modules/${encodeURIComponent(moduleCode || "m0001")}/m0001_ct0003/${encodeURIComponent(found.contentId)}` as never,
- );
- }
- }
- };
-
- const toggle = () => {
- LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
- setExpanded((prev) => !prev);
- };
+ const badges = [element, yinYang, connection].filter(Boolean);
return (
-
- {/* Accordion Header */}
- [
- styles.cardHeader,
- expanded && styles.cardHeaderExpanded,
- pressed && styles.pressed,
- ]}
- >
-
-
-
- {title}
-
-
-
-
- {element ? (
-
- {element}
-
- ) : null}
-
-
-
-
-
-
- {/* Accordion Body (Expanded State) */}
- {expanded ? (
-
- {/* Actions */}
- {actions.length > 0 ? (
-
- ACTIONS
- {actions.length === 1 ? (
- {actions[0]}
- ) : (
-
- )}
-
- ) : null}
-
- {/* Indications */}
- {indications.length > 0 ? (
-
- INDICATIONS
-
-
- ) : null}
-
- {/* Caution (same UI as Actions and Indications) */}
- {caution ? (
-
- CAUTION
- {cautionList.length > 1 ? (
-
- ) : (
- {caution}
- )}
-
- ) : null}
-
- {/* Linkable Point Button (matching standard ReferenceChipList styling) */}
- {pointLabel ? (
- [
- styles.pointLinkButton,
- pressed && styles.pressed,
- ]}
- >
- {pointButtonLabel}
-
-
- ) : null}
+
+ {actions.length > 0 ? (
+
+ ACTIONS
+ {actions.length === 1 ? (
+ {actions[0]}
+ ) : (
+
+ )}
) : null}
-
+
+ {indications.length > 0 ? (
+
+ INDICATIONS
+
+
+ ) : null}
+
+ {caution ? (
+
+ CAUTION
+ {cautionList.length > 1 ? (
+
+ ) : (
+ {caution}
+ )}
+
+ ) : null}
+
+ {pointLabel ? (
+
+
+ navigateToPointRef(router, item.point, moduleCode, pointsCatalogMap)
+ }
+ />
+
+ ) : null}
+
);
}
+/** Shared category detail renderer supporting Yuan-Source, Xi-Cleft, Luo, Back-Shu, Front-Mu, and Influential points. */
export function YuanSourceDetailRenderer({
moduleCode = "m0001",
content,
data,
definitions,
presentationAttributes,
-}: DetailRendererProps) {
+ fallbackTitle = "Yuan Source",
+}: DetailRendererProps & { fallbackTitle?: string }) {
const accordionDefaultExpanded = useSettingsStore(
(state) => state.accordionDefaultExpanded,
);
-
- // Fetch points from m0001_ct0003 for robust ID navigation fallback
- const { data: pointsCatalog } = useModuleTemplateContentDetailsQuery({
- module_code: moduleCode || "m0001",
- template_code: "m0001_ct0003",
- });
-
- const pointsCatalogMap = useMemo(() => {
- const map = new Map();
- if (pointsCatalog?.items) {
- for (const item of pointsCatalog.items) {
- const id = item.content.id;
- const title = item.content.title;
- const code = asString(item.data.code).trim().toLowerCase();
- const name = asString(item.data.name).trim().toLowerCase();
- if (code) {
- map.set(code, { contentId: id, title });
- map.set(code.replace(/[- ]/g, ""), { contentId: id, title });
- }
- if (name) {
- map.set(name, { contentId: id, title });
- }
- }
- }
- return map;
- }, [pointsCatalog]);
+ const pointsCatalogMap = usePointsCatalogMap(moduleCode);
const rawTitle =
- asString(data.title) || asString(data.name) || content.title || "Yuan Source";
+ asString(data.title) || asString(data.name) || content.title || fallbackTitle;
const altNames = asStringArray(data.alt_name);
- const descriptionParagraphs = asStringArray(data.description);
+ const alias = asString(data.alias).trim();
+ const subtitle =
+ altNames.length > 0 ? altNames.join(" · ") : alias || undefined;
+
+ const overviewParagraphs = useMemo(
+ () => buildCategoryOverviewParagraphs(data),
+ [data],
+ );
const points = asRecordArray(data.points);
return (
- {/* Screen Title & Subtitle */}
- 0 ? altNames.join(" · ") : undefined}
- />
+
- {/* Visual images (if any assigned) */}
- {/* Overview Section */}
- {descriptionParagraphs.length > 0 ? (
+ {overviewParagraphs.length > 0 ? (
) : null}
- {/* Points Accordion List */}
{points.length > 0 ? (
-
+
{points.map((pointItem, index) => (
) : null}
- {/* Generic content link attributes (excluding points already rendered above) */}
);
}
-
-const styles = StyleSheet.create({
- container: {
- paddingHorizontal: moderateScale(16),
- paddingTop: verticalScale(14),
- paddingBottom: verticalScale(40),
- gap: verticalScale(14),
- },
- pointsList: {
- gap: verticalScale(12),
- },
- card: {
- backgroundColor: "#FFFFFF",
- borderRadius: moderateScale(16),
- borderWidth: 1,
- borderColor: "#E2E8F0",
- overflow: "hidden",
- },
- cardHeader: {
- minHeight: verticalScale(54),
- paddingHorizontal: moderateScale(14),
- paddingVertical: verticalScale(12),
- flexDirection: "row",
- alignItems: "center",
- justifyContent: "space-between",
- backgroundColor: "#FFFFFF",
- gap: moderateScale(10),
- },
- cardHeaderExpanded: {
- backgroundColor: "#F0F7F3",
- borderBottomWidth: 1,
- borderBottomColor: "#E2E8F0",
- },
- pressed: {
- opacity: 0.75,
- },
- headerLeft: {
- flex: 1,
- flexDirection: "row",
- alignItems: "center",
- gap: moderateScale(10),
- },
- headerAccent: {
- width: moderateScale(4),
- height: verticalScale(22),
- borderRadius: moderateScale(2),
- backgroundColor: Colors.primary,
- },
- headerTitle: {
- flex: 1,
- fontSize: moderateScale(15),
- lineHeight: moderateScale(21),
- fontWeight: "700",
- color: "#1E293B",
- },
- headerRight: {
- flexDirection: "row",
- alignItems: "center",
- gap: moderateScale(8),
- },
- elementBadge: {
- paddingHorizontal: moderateScale(9),
- paddingVertical: verticalScale(3),
- borderRadius: moderateScale(10),
- backgroundColor: "#E8F5E9",
- borderWidth: 1,
- borderColor: "#C6E4CE",
- },
- elementBadgeText: {
- fontSize: 11,
- lineHeight: 16,
- fontWeight: "600",
- color: "#285A44",
- },
- chevron: {
- width: moderateScale(28),
- height: moderateScale(28),
- borderRadius: moderateScale(14),
- backgroundColor: "#FFFFFFB8",
- alignItems: "center",
- justifyContent: "center",
- borderWidth: 1,
- borderColor: "#E2E8F0",
- },
- cardBody: {
- paddingHorizontal: moderateScale(16),
- paddingTop: verticalScale(14),
- paddingBottom: verticalScale(16),
- gap: verticalScale(12),
- backgroundColor: "#FFFFFF",
- },
- sectionRow: {
- gap: verticalScale(6),
- paddingBottom: verticalScale(10),
- borderBottomWidth: StyleSheet.hairlineWidth,
- borderBottomColor: "#E8ECEF",
- },
- sectionLabel: {
- fontSize: 12,
- lineHeight: 17,
- fontWeight: "700",
- color: "#597064",
- letterSpacing: 0.15,
- },
- sectionValue: {
- fontSize: 16,
- lineHeight: 25,
- color: "#334155",
- },
- pointLinkButton: {
- alignSelf: "flex-start",
- minHeight: verticalScale(34),
- paddingHorizontal: moderateScale(12),
- paddingVertical: verticalScale(6),
- borderRadius: Radius.full,
- backgroundColor: "#E8F5E9",
- borderWidth: 1,
- borderColor: "#CDE5D0",
- flexDirection: "row",
- alignItems: "center",
- gap: moderateScale(6),
- marginTop: verticalScale(6),
- },
- pointLinkLabel: {
- fontSize: moderateScale(13),
- lineHeight: moderateScale(18),
- fontWeight: "700",
- color: Colors.primaryDark,
- },
-});
diff --git a/src/features/content/renderers/details/pointCategoryShared.tsx b/src/features/content/renderers/details/pointCategoryShared.tsx
new file mode 100644
index 0000000..60e6e41
--- /dev/null
+++ b/src/features/content/renderers/details/pointCategoryShared.tsx
@@ -0,0 +1,422 @@
+import React, { useMemo, useState } from "react";
+import {
+ LayoutAnimation,
+ Platform,
+ Pressable,
+ StyleSheet,
+ Text,
+ UIManager,
+ View,
+} from "react-native";
+import { Ionicons } from "@expo/vector-icons";
+import { useRouter } from "expo-router";
+import { moderateScale, verticalScale } from "react-native-size-matters";
+
+import { Colors, Radius } from "@/theme";
+import { useModuleTemplateContentDetailsQuery } from "../../hooks/use-content-queries";
+import {
+ buildContentReferenceRoute,
+ parseNavigableContentReference,
+} from "../../utils/content-reference";
+import { asRecord, asString, asStringArray } from "../helpers/value";
+
+if (
+ Platform.OS === "android" &&
+ UIManager.setLayoutAnimationEnabledExperimental
+) {
+ UIManager.setLayoutAnimationEnabledExperimental(true);
+}
+
+export type PointsCatalogMap = Map<
+ string,
+ { contentId: string; title: string }
+>;
+
+/** Loads m0001_ct0003 points catalog for fallback navigation by point code or name. */
+export function usePointsCatalogMap(moduleCode = "m0001"): PointsCatalogMap {
+ const { data: pointsCatalog } = useModuleTemplateContentDetailsQuery({
+ module_code: moduleCode || "m0001",
+ template_code: "m0001_ct0003",
+ });
+
+ return useMemo(() => {
+ const map = new Map();
+ if (pointsCatalog?.items) {
+ for (const item of pointsCatalog.items) {
+ const id = item.content.id;
+ const title = item.content.title;
+ const code = asString(item.data.code).trim().toLowerCase();
+ const name = asString(item.data.name).trim().toLowerCase();
+ if (code) {
+ map.set(code, { contentId: id, title });
+ map.set(code.replace(/[- ]/g, ""), { contentId: id, title });
+ }
+ if (name) {
+ map.set(name, { contentId: id, title });
+ }
+ }
+ }
+ return map;
+ }, [pointsCatalog]);
+}
+
+/** Extracts display label from a point content_ref or raw target payload. */
+export function extractPointRefLabel(rawValue: unknown): string {
+ const directRef = parseNavigableContentReference(rawValue);
+ if (directRef?.label?.trim()) {
+ return directRef.label.trim();
+ }
+ const rawPoint = asRecord(rawValue);
+ const label = asString(rawPoint.label).trim();
+ if (label) return label;
+ if (rawPoint.target && typeof rawPoint.target === "object") {
+ return asString((rawPoint.target as Record).source_code).trim();
+ }
+ return "";
+}
+
+/** Navigates to the canonical acupuncture point detail route from a content_ref payload. */
+export function navigateToPointRef(
+ router: ReturnType,
+ rawValue: unknown,
+ moduleCode: string,
+ pointsCatalogMap?: PointsCatalogMap,
+): void {
+ const directRef = parseNavigableContentReference(rawValue);
+ if (directRef) {
+ router.push(buildContentReferenceRoute(directRef) as never);
+ return;
+ }
+
+ const rawPoint = asRecord(rawValue);
+ const pointLabel = extractPointRefLabel(rawValue);
+
+ if (rawPoint.target && typeof rawPoint.target === "object") {
+ const target = rawPoint.target as Record;
+ const targetModule =
+ asString(target.module_code).trim() || moduleCode || "m0001";
+ const targetTemplate =
+ asString(target.template_code).trim() || "m0001_ct0003";
+ const contentId = asString(target.content_id).trim();
+ const sourceCode = asString(target.source_code).trim();
+
+ if (contentId) {
+ router.push(
+ `/modules/${encodeURIComponent(targetModule)}/${encodeURIComponent(targetTemplate)}/${encodeURIComponent(contentId)}` as never,
+ );
+ return;
+ }
+
+ if (pointsCatalogMap && sourceCode) {
+ const found =
+ pointsCatalogMap.get(sourceCode.toLowerCase()) ||
+ pointsCatalogMap.get(sourceCode.replace(/[- ]/g, "").toLowerCase());
+ if (found) {
+ router.push(
+ `/modules/${encodeURIComponent(targetModule)}/${encodeURIComponent(targetTemplate)}/${encodeURIComponent(found.contentId)}` as never,
+ );
+ return;
+ }
+ }
+ }
+
+ if (pointsCatalogMap && pointLabel) {
+ const found =
+ pointsCatalogMap.get(pointLabel.toLowerCase()) ||
+ pointsCatalogMap.get(pointLabel.replace(/[- ]/g, "").toLowerCase());
+ if (found) {
+ router.push(
+ `/modules/${encodeURIComponent(moduleCode || "m0001")}/m0001_ct0003/${encodeURIComponent(found.contentId)}` as never,
+ );
+ }
+ }
+}
+
+function formatGeneralInfoKey(key: string): string {
+ const trimmed = key.trim();
+ if (trimmed === "Yin_vs_Yang") return "Yin vs. Yang";
+ if (trimmed === "Yuan_vs_Luo") return "Yuan vs. Luo";
+ return trimmed.replace(/_/g, " ");
+}
+
+function formatGeneralInfoSubLines(
+ value: unknown,
+ indent = "",
+ lines: string[] = [],
+): string[] {
+ if (typeof value === "string") {
+ const text = value.trim();
+ if (text) lines.push(text);
+ return lines;
+ }
+ const obj = asRecord(value);
+ const entries = Object.entries(obj);
+ entries.forEach(([k, v], idx) => {
+ const label = formatGeneralInfoKey(k);
+ if (typeof v === "string") {
+ const text = v.trim();
+ if (text) {
+ lines.push(`${indent}${idx + 1}. ${label}: ${text}`);
+ }
+ } else if (v && typeof v === "object") {
+ lines.push(`${indent}${label}:`);
+ formatGeneralInfoSubLines(v, `${indent} `, lines);
+ }
+ });
+ return lines;
+}
+
+/** Merges description strings and structured general_information into Overview bullet items. */
+export function buildCategoryOverviewParagraphs(
+ data: Record,
+): string[] {
+ const paragraphs = [...asStringArray(data.description)];
+ const generalInfo = asRecord(data.general_information);
+
+ for (const [key, value] of Object.entries(generalInfo)) {
+ const label = formatGeneralInfoKey(key);
+ if (typeof value === "string") {
+ const text = value.trim();
+ if (text) {
+ paragraphs.push(`${label}: ${text}`);
+ }
+ } else if (value && typeof value === "object") {
+ const subLines = formatGeneralInfoSubLines(value);
+ if (subLines.length > 0) {
+ paragraphs.push(`${label}:\n${subLines.join("\n")}`);
+ }
+ }
+ }
+
+ return paragraphs;
+}
+
+/** Renders a pill-style navigable chip linking to an acupuncture point detail screen. */
+export function PointLinkChip({
+ label,
+ accessibilityLabel,
+ onPress,
+}: {
+ label: string;
+ accessibilityLabel?: string;
+ onPress: () => void;
+}) {
+ return (
+ [
+ pointCategoryStyles.pointLinkButton,
+ pressed && pointCategoryStyles.pressed,
+ ]}
+ >
+ {label}
+
+
+ );
+}
+
+/** Reusable expandable accordion card wrapper matching category detail styling. */
+export function PointCategoryAccordionCard({
+ title,
+ badges = [],
+ defaultExpanded,
+ children,
+}: {
+ title: string;
+ badges?: string[];
+ defaultExpanded: boolean;
+ children: React.ReactNode;
+}) {
+ const [expanded, setExpanded] = useState(defaultExpanded);
+
+ const toggle = () => {
+ LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
+ setExpanded((prev) => !prev);
+ };
+
+ return (
+
+ [
+ pointCategoryStyles.cardHeader,
+ expanded && pointCategoryStyles.cardHeaderExpanded,
+ pressed && pointCategoryStyles.pressed,
+ ]}
+ >
+
+
+
+ {title}
+
+
+
+
+ {badges
+ .filter((b) => b.trim().length > 0)
+ .map((badge, index) => (
+
+ {badge}
+
+ ))}
+
+
+
+
+
+
+ {expanded ? (
+ {children}
+ ) : null}
+
+ );
+}
+
+export const pointCategoryStyles = StyleSheet.create({
+ container: {
+ paddingHorizontal: moderateScale(16),
+ paddingTop: verticalScale(14),
+ paddingBottom: verticalScale(40),
+ gap: verticalScale(14),
+ },
+ cardsList: {
+ gap: verticalScale(12),
+ },
+ card: {
+ backgroundColor: "#FFFFFF",
+ borderRadius: moderateScale(16),
+ borderWidth: 1,
+ borderColor: "#E2E8F0",
+ overflow: "hidden",
+ },
+ cardHeader: {
+ minHeight: verticalScale(54),
+ paddingHorizontal: moderateScale(14),
+ paddingVertical: verticalScale(12),
+ flexDirection: "row",
+ alignItems: "center",
+ justifyContent: "space-between",
+ backgroundColor: "#FFFFFF",
+ gap: moderateScale(10),
+ },
+ cardHeaderExpanded: {
+ backgroundColor: "#F0F7F3",
+ borderBottomWidth: 1,
+ borderBottomColor: "#E2E8F0",
+ },
+ pressed: {
+ opacity: 0.75,
+ },
+ headerLeft: {
+ flex: 1,
+ flexDirection: "row",
+ alignItems: "center",
+ gap: moderateScale(10),
+ },
+ headerAccent: {
+ width: moderateScale(4),
+ height: verticalScale(22),
+ borderRadius: moderateScale(2),
+ backgroundColor: Colors.primary,
+ },
+ headerTitle: {
+ flex: 1,
+ fontSize: moderateScale(15),
+ lineHeight: moderateScale(21),
+ fontWeight: "700",
+ color: "#1E293B",
+ },
+ headerRight: {
+ flexDirection: "row",
+ alignItems: "center",
+ gap: moderateScale(8),
+ },
+ badge: {
+ paddingHorizontal: moderateScale(9),
+ paddingVertical: verticalScale(3),
+ borderRadius: moderateScale(10),
+ backgroundColor: "#E8F5E9",
+ borderWidth: 1,
+ borderColor: "#C6E4CE",
+ },
+ badgeText: {
+ fontSize: 11,
+ lineHeight: 16,
+ fontWeight: "600",
+ color: "#285A44",
+ },
+ chevron: {
+ width: moderateScale(28),
+ height: moderateScale(28),
+ borderRadius: moderateScale(14),
+ backgroundColor: "#FFFFFFB8",
+ alignItems: "center",
+ justifyContent: "center",
+ borderWidth: 1,
+ borderColor: "#E2E8F0",
+ },
+ cardBody: {
+ paddingHorizontal: moderateScale(16),
+ paddingTop: verticalScale(14),
+ paddingBottom: verticalScale(16),
+ gap: verticalScale(12),
+ backgroundColor: "#FFFFFF",
+ },
+ sectionRow: {
+ gap: verticalScale(6),
+ paddingBottom: verticalScale(10),
+ borderBottomWidth: StyleSheet.hairlineWidth,
+ borderBottomColor: "#E8ECEF",
+ },
+ sectionLabel: {
+ fontSize: 12,
+ lineHeight: 17,
+ fontWeight: "700",
+ color: "#597064",
+ letterSpacing: 0.15,
+ },
+ sectionValue: {
+ fontSize: 16,
+ lineHeight: 25,
+ color: "#334155",
+ },
+ pointLinksRow: {
+ flexDirection: "row",
+ flexWrap: "wrap",
+ gap: moderateScale(8),
+ marginTop: verticalScale(4),
+ },
+ pointLinkButton: {
+ alignSelf: "flex-start",
+ minHeight: verticalScale(34),
+ paddingHorizontal: moderateScale(12),
+ paddingVertical: verticalScale(6),
+ borderRadius: Radius.full,
+ backgroundColor: "#E8F5E9",
+ borderWidth: 1,
+ borderColor: "#CDE5D0",
+ flexDirection: "row",
+ alignItems: "center",
+ gap: moderateScale(6),
+ },
+ pointLinkLabel: {
+ fontSize: moderateScale(13),
+ lineHeight: moderateScale(18),
+ fontWeight: "700",
+ color: Colors.primaryDark,
+ },
+});
+
diff --git a/src/features/content/renderers/registry.ts b/src/features/content/renderers/registry.ts
index 08f74d2..50a6a2e 100644
--- a/src/features/content/renderers/registry.ts
+++ b/src/features/content/renderers/registry.ts
@@ -32,6 +32,8 @@ import { FourSeasDetailRenderer } from "./details/FourSeasDetailRenderer";
import { GhostPointsDetailRenderer } from "./details/GhostPointsDetailRenderer";
import { EntryExitPointsDetailRenderer } from "./details/EntryExitPointsDetailRenderer";
import { ReturningYangDetailRenderer } from "./details/ReturningYangDetailRenderer";
+import { YuanLuoDetailRenderer } from "./details/YuanLuoDetailRenderer";
+import { InfluentialPointsDetailRenderer } from "./details/InfluentialPointsDetailRenderer";
import { EarAcupunctureCatalogCollectionRenderer, EarAcupunctureCatalogCardRenderer, EarAcupunctureCollectionRenderer, EarAcupunctureCardRenderer } from "./collections/EarAcupunctureRenderers";
import { EarAcupunctureCatalogDetailRenderer } from "./details/EarAcupunctureCatalogDetailRenderer";
import { EarAcupunctureDetailRenderer } from "./details/EarAcupunctureDetailRenderer";
@@ -146,6 +148,8 @@ export const detailRenderers: Readonly>
ghost_points_detail: GhostPointsDetailRenderer,
entry_exit_points_detail: EntryExitPointsDetailRenderer,
returning_yang_detail: ReturningYangDetailRenderer,
+ yuan_luo_detail: YuanLuoDetailRenderer,
+ influential_points_detail: InfluentialPointsDetailRenderer,
ear_acupuncture_catalog_detail: EarAcupunctureCatalogDetailRenderer,
ear_acupuncture_detail: EarAcupunctureDetailRenderer,
four_levels_detail: FourLevelsDetailRenderer,
diff --git a/src/features/content/renderers/shared/BulletList.tsx b/src/features/content/renderers/shared/BulletList.tsx
index f8b35a9..4233d75 100644
--- a/src/features/content/renderers/shared/BulletList.tsx
+++ b/src/features/content/renderers/shared/BulletList.tsx
@@ -1,16 +1,60 @@
import React from "react";
-import { StyleSheet, Text, View } from "react-native";
+import {
+ StyleProp,
+ StyleSheet,
+ Text,
+ TextStyle,
+ View,
+ ViewStyle,
+} from "react-native";
import { Colors } from "@/theme";
-export function BulletList({ items }: { items: string[] }) {
+export interface BulletListProps {
+ items: string[];
+ listStyle?: StyleProp;
+ dotStyle?: StyleProp;
+ textStyle?: StyleProp;
+ boldColonPrefix?: boolean;
+}
+
+const COLON_PREFIX_RE = /^([A-Za-z][A-Za-z0-9 &/().-]{1,32}:)([\s\S]*)$/;
+
+function renderBulletText(
+ item: string,
+ textStyle?: StyleProp,
+ boldColonPrefix?: boolean,
+) {
+ if (!boldColonPrefix) {
+ return {item};
+ }
+ const match = COLON_PREFIX_RE.exec(item);
+ if (!match) {
+ return {item};
+ }
+ return (
+
+ {match[1]}
+ {match[2]}
+
+ );
+}
+
+/** Renders a bulleted list with optional custom typography and bold label prefixes. */
+export function BulletList({
+ items,
+ listStyle,
+ dotStyle,
+ textStyle,
+ boldColonPrefix = false,
+}: BulletListProps) {
if (!items.length) return null;
return (
-
+
{items.map((item, index) => (
-
- {item}
+
+ {renderBulletText(item, textStyle, boldColonPrefix)}
))}
@@ -28,4 +72,5 @@ const styles = StyleSheet.create({
backgroundColor: Colors.primary,
},
text: { flex: 1, fontSize: 16, lineHeight: 25, color: "#334155" },
+ prefix: { fontWeight: "700", color: Colors.textPrimary },
});
diff --git a/src/features/content/renderers/shared/OverviewCard.tsx b/src/features/content/renderers/shared/OverviewCard.tsx
index 8b89cfb..2fcc474 100644
--- a/src/features/content/renderers/shared/OverviewCard.tsx
+++ b/src/features/content/renderers/shared/OverviewCard.tsx
@@ -11,6 +11,7 @@ import { Ionicons } from "@expo/vector-icons";
import { moderateScale, verticalScale } from "react-native-size-matters";
import { Colors } from "@/theme";
+import { BulletList } from "./BulletList";
export interface OverviewCardProps {
title?: string;
@@ -19,6 +20,8 @@ export interface OverviewCardProps {
iconSize?: number;
text?: string | null;
paragraphs?: Array;
+ variant?: "paragraphs" | "bullets";
+ boldBulletPrefix?: boolean;
children?: React.ReactNode;
style?: StyleProp;
titleStyle?: StyleProp;
@@ -32,14 +35,16 @@ export function OverviewCard({
iconSize = moderateScale(20),
text,
paragraphs,
+ variant = "paragraphs",
+ boldBulletPrefix = true,
children,
style,
titleStyle,
textStyle,
}: OverviewCardProps) {
- const filteredParagraphs = paragraphs?.filter(
- (p): p is string => typeof p === "string" && p.trim().length > 0,
- );
+ const filteredParagraphs = paragraphs
+ ?.filter((p): p is string => typeof p === "string" && p.trim().length > 0)
+ .map((p) => p.replace(/\n[ \t]+/g, "\n").trim());
const hasText = typeof text === "string" && text.trim().length > 0;
const hasParagraphs =
@@ -62,19 +67,27 @@ export function OverviewCard({
{text}
) : null}
- {hasParagraphs
- ? filteredParagraphs.map((para, index) => (
-
- {para}
-
- ))
- : null}
+ {hasParagraphs && variant === "bullets" ? (
+
+ ) : hasParagraphs ? (
+ filteredParagraphs.map((para, index) => (
+
+ {para}
+
+ ))
+ ) : null}
{children}
@@ -111,5 +124,17 @@ const styles = StyleSheet.create({
color: Colors.textSecondary,
marginTop: verticalScale(8),
},
+ paragraphSpacing: {
+ marginTop: verticalScale(8),
+ },
+ bulletList: {
+ gap: verticalScale(7),
+ },
+ bulletDot: {
+ width: moderateScale(5),
+ height: moderateScale(5),
+ borderRadius: moderateScale(2.5),
+ marginTop: moderateScale(7.5),
+ },
});