fix registry.ts
This commit is contained in:
commit
190461f50f
|
|
@ -0,0 +1,89 @@
|
|||
import React from "react";
|
||||
import { Pressable, StyleSheet, Text, View } from "react-native";
|
||||
import { Ionicons } from "@expo/vector-icons";
|
||||
import { moderateScale } from "react-native-size-matters";
|
||||
|
||||
import { Colors } from "@/theme";
|
||||
import { asNumber, asString } from "../helpers/value";
|
||||
import { CollectionScaffold } from "../shared/CollectionScaffold";
|
||||
import type {
|
||||
CollectionItemRendererProps,
|
||||
CollectionRendererProps,
|
||||
} from "../../types/renderer.types";
|
||||
|
||||
export function ThreeBurnersCollectionRenderer(props: CollectionRendererProps) {
|
||||
return <CollectionScaffold {...props} />;
|
||||
}
|
||||
|
||||
export function ThreeBurnersCardRenderer({
|
||||
item,
|
||||
onPress,
|
||||
}: CollectionItemRendererProps) {
|
||||
const a = item.attributes;
|
||||
const title = asString(a.name) || asString(a.title) || item.title;
|
||||
const sortOrder = asNumber(a.sort_order);
|
||||
|
||||
return (
|
||||
<Pressable
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={title}
|
||||
onPress={onPress}
|
||||
style={({ pressed }) => [styles.cardRow, pressed && styles.pressed]}
|
||||
>
|
||||
<View style={styles.numberBadge}>
|
||||
{typeof sortOrder === "number" ? (
|
||||
<Text style={styles.numberText}>{sortOrder + 1}</Text>
|
||||
) : (
|
||||
<Ionicons name="flame-outline" size={18} color={Colors.primaryDark} />
|
||||
)}
|
||||
</View>
|
||||
|
||||
<View style={styles.titleContainer}>
|
||||
<Text numberOfLines={2} style={styles.cardTitle}>
|
||||
{title}
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
<Ionicons name="chevron-forward" size={20} color="#9CA3AF" />
|
||||
</Pressable>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
cardRow: {
|
||||
minHeight: moderateScale(60),
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
padding: moderateScale(14),
|
||||
backgroundColor: "#FFFFFF",
|
||||
borderRadius: moderateScale(14),
|
||||
borderWidth: 1,
|
||||
borderColor: "#E2EAE5",
|
||||
},
|
||||
pressed: {
|
||||
opacity: 0.72,
|
||||
},
|
||||
numberBadge: {
|
||||
width: moderateScale(36),
|
||||
height: moderateScale(36),
|
||||
borderRadius: moderateScale(18),
|
||||
backgroundColor: "#E8F5E9",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
},
|
||||
numberText: {
|
||||
fontSize: moderateScale(15),
|
||||
fontWeight: "800",
|
||||
color: Colors.primaryDark,
|
||||
},
|
||||
titleContainer: {
|
||||
flex: 1,
|
||||
marginLeft: moderateScale(12),
|
||||
marginRight: moderateScale(8),
|
||||
},
|
||||
cardTitle: {
|
||||
fontSize: moderateScale(15),
|
||||
fontWeight: "600",
|
||||
color: Colors.textPrimary,
|
||||
},
|
||||
});
|
||||
|
|
@ -0,0 +1,566 @@
|
|||
import React, { useContext, useEffect, useMemo, useState } from "react";
|
||||
import { Pressable, ScrollView, 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 type { DetailRendererProps } from "../../types/renderer.types";
|
||||
import { BackActionContext } from "../../screens/SingleTemplateScreen";
|
||||
import { Hero } from "../shared/Hero";
|
||||
import { SectionCard } from "../shared/SectionCard";
|
||||
import { Paragraphs } from "../shared/Paragraphs";
|
||||
import { asString } from "../helpers/value";
|
||||
import { useContentSearchInfiniteQuery } from "../../hooks/use-content-search-infinite-query";
|
||||
|
||||
interface PatternData {
|
||||
name: string;
|
||||
code?: string;
|
||||
clinicalManifestation?: string;
|
||||
pathology?: string;
|
||||
treatment?: string;
|
||||
}
|
||||
|
||||
interface BurnerCategory {
|
||||
key: string;
|
||||
title: string;
|
||||
patterns: string[];
|
||||
}
|
||||
|
||||
const DEFAULT_THREE_BURNERS_OVERVIEW =
|
||||
"The Three Burners (San Jiao) pattern identification is a diagnostic system created by Wu Jutong in the Qing dynasty for warm diseases (Wen Bing). It categorizes acute febrile conditions into Upper, Middle, and Lower Burner patterns according to pathological changes in the zang-fu organs and the transmission of heat pathogens.";
|
||||
|
||||
const BURNER_CONFIGS: Array<{ key: string; title: string }> = [
|
||||
{ key: "upper burner", title: "Upper Burner" },
|
||||
{ key: "middle burner", title: "Middle Burner" },
|
||||
{ key: "lower burner", title: "Lower Burner" },
|
||||
];
|
||||
|
||||
// Embedded fallback patterns for guaranteed zero-latency / offline rendering
|
||||
const FALLBACK_PATTERNS: Record<string, PatternData> = {
|
||||
"wind_heat_in_the_lungs_defensive_qi_portion": {
|
||||
name: "Wind-Heat in the Lungs’ Defensive Qi portion",
|
||||
clinicalManifestation:
|
||||
"Fever, aversion to cold, headache, sore throat, slight sweating, runny nose with yellow discharge, swollen tonsils, body aches, slight thirst",
|
||||
pathology:
|
||||
"The pathology of this pattern is the same as that for invasion of Wind-Heat at the Defensive Qi Level of the Four Levels. The tongue coating is white because the pathogenic factor is on the Exterior.",
|
||||
treatment:
|
||||
"Treatment principle:\nRelease the Exterior\nExpel Wind-Heat,\nRestore the diffusing and descending of Lung-Qi.\nAcupuncture\nLI-4, LI-11, SJ-5, DU-14, BL-12 (with cupping), LU-11",
|
||||
},
|
||||
"heat_in_the_lungs_qi_level": {
|
||||
name: "Heat in the Lungs (Qi level)",
|
||||
clinicalManifestation:
|
||||
"Fever, sweating, cough, breathlessness, thirst, feeling of oppression and pain of the chest",
|
||||
pathology:
|
||||
"The pathology of this pattern is essentially the same as that for the pattern Heat in the Lungs at the Qi Level of the Four Levels.",
|
||||
treatment:
|
||||
"Treatment principle:\nClear Lung-Heat,\nResolve Phlegm,\nRestore the descending of Lung-Qi.\nAcupuncture\nLU-5, LU-10, LU-1, LI-11, BL-13",
|
||||
},
|
||||
"heat_in_the_pericardium_nutritive_qi_level": {
|
||||
name: "Heat in the Pericardium (Nutritive Qi level)",
|
||||
clinicalManifestation:
|
||||
"High fever at night, a burning sensation of the epigastrium,\ncold limbs, delirium, aphasia",
|
||||
pathology:
|
||||
"The pathology of this pattern is essentially the same as that for the pattern Heat in the Pericardium at the Nutritive Qi level of the Four Levels.",
|
||||
treatment:
|
||||
"Treatment principle:\nClear Heat in the Pericardium\nRestore consciousness\nPromote fluid\nAcupuncture\nPC-9, PC-3, LI-11, PC-8, HT-9, KI-6, Shixuan extra points.",
|
||||
},
|
||||
"heat_in_bright_yang": {
|
||||
name: "Heat in Bright Yang",
|
||||
clinicalManifestation:
|
||||
"High fever that is worse in the afternoon, no aversion to cold, feeling of heat, intense thirst, profuse sweating",
|
||||
pathology:
|
||||
"The pathology of this pattern is essentially the same as that for the pattern Stomach-Heat at the Qi level of the Four Levels.",
|
||||
treatment:
|
||||
"Treatment principle:\nClear Stomach-Heat Expel Wind-Heat,\nAcupuncture\nST-44, ST-34, ST-21, ST-43, LI-11, ST-25.",
|
||||
},
|
||||
"damp_heat_in_the_spleen": {
|
||||
name: "Damp-Heat in the Spleen",
|
||||
clinicalManifestation:
|
||||
"Fever, epigastric fullness, a feeling of heaviness of the body and head, nausea, vomiting",
|
||||
pathology:
|
||||
"The pathology of this pattern is essentially the same as that for the pattern Damp-Heat in Stomach and Spleen from the Qi level of the Four Levels.",
|
||||
treatment:
|
||||
"Treatment principle:\nClear Heat\nResolve Dampness in the Spleen\nAcupuncture\nCV-12, SP-9, SP-6, CV-9, ST-36, LI-1, BL-20, BL-2.",
|
||||
},
|
||||
"heat_in_the_kidneys": {
|
||||
name: "Heat in the Kidneys",
|
||||
clinicalManifestation:
|
||||
"Fever in the afternoon and evening, five-palm heat, dry mouth and throat, night sweating, deafness, lassitude",
|
||||
pathology:
|
||||
"The pathology of this pattern is essentially the same as that of the pattern Heat transformation from the Lesser Yin stage of the Six Stages.",
|
||||
treatment:
|
||||
"Treatment principle:\nNourish Kidney-Yin\nClear Empty-Heat\nAcupuncture\nKI-3, KI-6, SP-6, KI-2, LI-11.",
|
||||
},
|
||||
"liver_heat_stirs_wind": {
|
||||
name: "Liver-Heat stirs Wind",
|
||||
clinicalManifestation:
|
||||
"High fever at night, coma, convulsions, clenched teeth.",
|
||||
pathology:
|
||||
"The pathology of this pattern is essentially the same as that of the pattern Heat victorious stirring Wind from the Blood level of the Four Levels.",
|
||||
treatment:
|
||||
"Treatment principle:\nClear Heat\nExtinguish Wind\nStop convulsions\nRestore consciousness\nAcupuncture\nLR-3, LR-2, GB-20, Du-16, SI-3 and BL-62 in combination, SP-10, LI-11, KI-6, HE-9, Shixuan extra points.",
|
||||
},
|
||||
"liver_empty_wind": {
|
||||
name: "Liver Empty-Wind",
|
||||
clinicalManifestation:
|
||||
"Low-grade fever, cold limbs, dry and black teeth, dry and cracked lips, convulsions, tremor of limbs",
|
||||
pathology:
|
||||
"The pathology of this pattern is essentially the same as that for the pattern Empty-Wind, agitating the Interior from the Blood level of the Four Levels.",
|
||||
treatment:
|
||||
"Treatment principle:\nNourish Yin\nExtinguish Wind\nStop convulsions\nAcupuncture\nLR-3, LR-2, G.B.-20, DU-16, SI-3 and BL-62 in combination, KI-3, KI-6, SP-6, LR-8",
|
||||
},
|
||||
};
|
||||
|
||||
function normalizeKey(str: string): string {
|
||||
return str.toLowerCase().replace(/[^a-z0-9]/g, "");
|
||||
}
|
||||
|
||||
function extractBurnerList(data: Record<string, unknown>, burnerKey: string): string[] {
|
||||
const normTarget = normalizeKey(burnerKey);
|
||||
for (const [k, v] of Object.entries(data)) {
|
||||
const normK = normalizeKey(k);
|
||||
if (normK === normTarget && Array.isArray(v)) {
|
||||
return v.map((item) => asString(item).trim()).filter((item) => item.length > 0);
|
||||
}
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
function parseTreatment(rawTreatment: string) {
|
||||
const lines = rawTreatment.split("\n").map((l) => l.trim()).filter(Boolean);
|
||||
const principles: string[] = [];
|
||||
const acupuncture: string[] = [];
|
||||
let currentSection: "principle" | "acupuncture" = "principle";
|
||||
|
||||
for (const line of lines) {
|
||||
const lower = line.toLowerCase();
|
||||
if (lower.startsWith("treatment principle")) {
|
||||
currentSection = "principle";
|
||||
const rest = line.replace(/^treatment principle:?/i, "").trim();
|
||||
if (rest) principles.push(rest);
|
||||
} else if (lower.startsWith("acupuncture")) {
|
||||
currentSection = "acupuncture";
|
||||
const rest = line.replace(/^acupuncture:?/i, "").trim();
|
||||
if (rest) acupuncture.push(rest);
|
||||
} else {
|
||||
if (currentSection === "principle") {
|
||||
principles.push(line);
|
||||
} else {
|
||||
acupuncture.push(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return { principles, acupuncture };
|
||||
}
|
||||
|
||||
export function ThreeBurnersDetailRenderer({
|
||||
moduleCode,
|
||||
templateCode,
|
||||
content,
|
||||
data,
|
||||
definitions,
|
||||
presentationAttributes,
|
||||
}: DetailRendererProps) {
|
||||
const [selectedBurnerKey, setSelectedBurnerKey] = useState<string | null>(null);
|
||||
const [selectedPatternName, setSelectedPatternName] = useState<string | null>(null);
|
||||
|
||||
const { setCustomBackAction } = useContext(BackActionContext);
|
||||
|
||||
// Query m0017_ct0002 for published dynamic pattern records
|
||||
const patternsQuery = useContentSearchInfiniteQuery({
|
||||
module_code: "m0017",
|
||||
template_code: "m0017_ct0002",
|
||||
page_size: 50,
|
||||
logic: "and",
|
||||
filters: [],
|
||||
sort: [],
|
||||
});
|
||||
|
||||
// Index patterns by normalized name for instant lookup
|
||||
const patternMap = useMemo(() => {
|
||||
const map = new Map<string, PatternData>();
|
||||
|
||||
// 1. Seed fallback patterns
|
||||
for (const p of Object.values(FALLBACK_PATTERNS)) {
|
||||
map.set(normalizeKey(p.name), p);
|
||||
}
|
||||
|
||||
// 2. Hydrate from live search query
|
||||
const items = patternsQuery.data?.pages?.flatMap((p) => p.items) ?? [];
|
||||
for (const it of items) {
|
||||
const a = it.attributes as Record<string, unknown>;
|
||||
const name = asString(a.name) || it.title;
|
||||
if (!name) continue;
|
||||
|
||||
const clinical =
|
||||
asString(a["clinical menifestation"]) ||
|
||||
asString(a["clinical manifestation"]) ||
|
||||
asString(a.clinical_manifestations) ||
|
||||
asString(a.clinical_manifestation);
|
||||
|
||||
const pathology = asString(a.pathology);
|
||||
const treatment = asString(a.treatment);
|
||||
|
||||
map.set(normalizeKey(name), {
|
||||
name,
|
||||
code: asString(a.code) || undefined,
|
||||
clinicalManifestation: clinical || undefined,
|
||||
pathology: pathology || undefined,
|
||||
treatment: treatment || undefined,
|
||||
});
|
||||
}
|
||||
|
||||
return map;
|
||||
}, [patternsQuery.data]);
|
||||
|
||||
// Extract the 3 burners and their patterns dynamically from data
|
||||
const burnerCategories: BurnerCategory[] = useMemo(() => {
|
||||
return BURNER_CONFIGS.map(({ key, title }) => {
|
||||
const patterns = extractBurnerList(data, key);
|
||||
return {
|
||||
key,
|
||||
title,
|
||||
patterns,
|
||||
};
|
||||
}).filter((b) => b.patterns.length > 0);
|
||||
}, [data]);
|
||||
|
||||
// If this component is rendered directly for a single pattern leaf (e.g. from search or deep link)
|
||||
const isDirectLeafPattern = Boolean(
|
||||
data["clinical menifestation"] ||
|
||||
data["clinical manifestation"] ||
|
||||
data.pathology,
|
||||
);
|
||||
|
||||
const selectedBurner = useMemo(() => {
|
||||
if (!selectedBurnerKey) return null;
|
||||
return burnerCategories.find((b) => b.key === selectedBurnerKey) ?? null;
|
||||
}, [selectedBurnerKey, burnerCategories]);
|
||||
|
||||
const activePatternData: PatternData | null = useMemo(() => {
|
||||
if (isDirectLeafPattern) {
|
||||
const name = asString(data.name) || content.title || "Three Burners Pattern";
|
||||
return {
|
||||
name,
|
||||
code: asString(data.code) || undefined,
|
||||
clinicalManifestation:
|
||||
asString(data["clinical menifestation"]) ||
|
||||
asString(data["clinical manifestation"]) ||
|
||||
asString(data.clinical_manifestations),
|
||||
pathology: asString(data.pathology) || undefined,
|
||||
treatment: asString(data.treatment) || undefined,
|
||||
};
|
||||
}
|
||||
|
||||
if (!selectedPatternName) return null;
|
||||
return (
|
||||
patternMap.get(normalizeKey(selectedPatternName)) || {
|
||||
name: selectedPatternName,
|
||||
}
|
||||
);
|
||||
}, [isDirectLeafPattern, data, content.title, selectedPatternName, patternMap]);
|
||||
|
||||
// Connect drilldown navigation to the top-header back button
|
||||
useEffect(() => {
|
||||
if (selectedPatternName) {
|
||||
setCustomBackAction(() => () => setSelectedPatternName(null));
|
||||
return () => {
|
||||
setCustomBackAction(null);
|
||||
};
|
||||
}
|
||||
if (selectedBurnerKey) {
|
||||
setCustomBackAction(() => () => setSelectedBurnerKey(null));
|
||||
return () => {
|
||||
setCustomBackAction(null);
|
||||
};
|
||||
}
|
||||
setCustomBackAction(null);
|
||||
}, [selectedPatternName, selectedBurnerKey, setCustomBackAction]);
|
||||
|
||||
// ----------------------------------------------------
|
||||
// SCREEN 3: Pattern Leaf Detail Screen
|
||||
// ----------------------------------------------------
|
||||
if (activePatternData && (selectedPatternName || isDirectLeafPattern)) {
|
||||
const { principles, acupuncture } = parseTreatment(
|
||||
activePatternData.treatment || "",
|
||||
);
|
||||
|
||||
return (
|
||||
<ScrollView
|
||||
contentContainerStyle={styles.container}
|
||||
showsVerticalScrollIndicator={false}
|
||||
>
|
||||
<Hero title={activePatternData.name} />
|
||||
|
||||
{/* 1. Clinical Manifestations Card */}
|
||||
{activePatternData.clinicalManifestation ? (
|
||||
<SectionCard title="Clinical Manifestations">
|
||||
<Paragraphs items={[activePatternData.clinicalManifestation]} />
|
||||
</SectionCard>
|
||||
) : null}
|
||||
|
||||
{/* 2. Pathology Card */}
|
||||
{activePatternData.pathology ? (
|
||||
<SectionCard title="Pathology">
|
||||
<Paragraphs items={[activePatternData.pathology]} />
|
||||
</SectionCard>
|
||||
) : null}
|
||||
|
||||
{/* 3. Treatment Card */}
|
||||
{activePatternData.treatment ? (
|
||||
<SectionCard title="Treatment">
|
||||
{principles.length > 0 ? (
|
||||
<View style={styles.subSection}>
|
||||
<Text style={styles.subSectionTitle}>Treatment Principle:</Text>
|
||||
{principles.map((p, i) => (
|
||||
<Text key={i} style={styles.bulletItem}>
|
||||
• {p}
|
||||
</Text>
|
||||
))}
|
||||
</View>
|
||||
) : null}
|
||||
|
||||
{acupuncture.length > 0 ? (
|
||||
<View style={[styles.subSection, principles.length > 0 && styles.subSectionSpacing]}>
|
||||
<Text style={styles.subSectionTitle}>Acupuncture Points:</Text>
|
||||
{acupuncture.map((a, i) => (
|
||||
<Text key={i} style={styles.bodyText}>
|
||||
{a}
|
||||
</Text>
|
||||
))}
|
||||
</View>
|
||||
) : null}
|
||||
|
||||
{principles.length === 0 && acupuncture.length === 0 ? (
|
||||
<Paragraphs items={[activePatternData.treatment]} />
|
||||
) : null}
|
||||
</SectionCard>
|
||||
) : null}
|
||||
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------
|
||||
// SCREEN 2: Burner Category Screen (e.g. Upper Burner)
|
||||
// ----------------------------------------------------
|
||||
if (selectedBurner) {
|
||||
return (
|
||||
<ScrollView
|
||||
contentContainerStyle={styles.container}
|
||||
showsVerticalScrollIndicator={false}
|
||||
>
|
||||
<Hero title={selectedBurner.title} />
|
||||
|
||||
<View style={styles.patternsContainer}>
|
||||
<Text style={styles.sectionHeading}>Patterns</Text>
|
||||
{selectedBurner.patterns.map((patternName, idx) => (
|
||||
<Pressable
|
||||
key={patternName}
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={`Open ${patternName}`}
|
||||
onPress={() => setSelectedPatternName(patternName)}
|
||||
style={({ pressed }) => [styles.patternRow, pressed && styles.pressed]}
|
||||
>
|
||||
<View style={styles.numberBadge}>
|
||||
<Text style={styles.numberText}>{idx + 1}</Text>
|
||||
</View>
|
||||
|
||||
<View style={styles.patternTitleContainer}>
|
||||
<Text style={styles.patternTitle}>{patternName}</Text>
|
||||
</View>
|
||||
|
||||
<Ionicons name="chevron-forward" size={20} color="#9CA3AF" />
|
||||
</Pressable>
|
||||
))}
|
||||
</View>
|
||||
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------
|
||||
// SCREEN 1: Three Burners (Module Root Screen)
|
||||
// ----------------------------------------------------
|
||||
const overviewText =
|
||||
asString(data.overview) ||
|
||||
asString(data.content) ||
|
||||
asString(data.description) ||
|
||||
content.summary ||
|
||||
DEFAULT_THREE_BURNERS_OVERVIEW;
|
||||
|
||||
return (
|
||||
<ScrollView
|
||||
contentContainerStyle={styles.container}
|
||||
showsVerticalScrollIndicator={false}
|
||||
>
|
||||
<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}
|
||||
|
||||
{/* Burner Categories (1. Upper Burner, 2. Middle Burner, 3. Lower Burner) */}
|
||||
<View style={styles.patternsContainer}>
|
||||
<Text style={styles.sectionHeading}>Burners</Text>
|
||||
{burnerCategories.map((burner, idx) => (
|
||||
<Pressable
|
||||
key={burner.key}
|
||||
accessibilityRole="button"
|
||||
accessibilityLabel={`Open ${burner.title}`}
|
||||
onPress={() => setSelectedBurnerKey(burner.key)}
|
||||
style={({ pressed }) => [styles.cardRow, pressed && styles.pressed]}
|
||||
>
|
||||
<View style={styles.numberBadge}>
|
||||
<Text style={styles.numberText}>{idx + 1}</Text>
|
||||
</View>
|
||||
|
||||
<View style={styles.titleContainer}>
|
||||
<Text style={styles.cardTitle}>{burner.title}</Text>
|
||||
<Text style={styles.cardSubtitle}>
|
||||
{burner.patterns.length} {burner.patterns.length === 1 ? "pattern" : "patterns"}
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
<Ionicons name="chevron-forward" size={20} color="#9CA3AF" />
|
||||
</Pressable>
|
||||
))}
|
||||
</View>
|
||||
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
|
||||
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(20),
|
||||
color: Colors.textSecondary,
|
||||
},
|
||||
patternsContainer: {
|
||||
gap: verticalScale(10),
|
||||
},
|
||||
sectionHeading: {
|
||||
fontSize: moderateScale(15),
|
||||
fontWeight: "700",
|
||||
color: Colors.textPrimary,
|
||||
marginLeft: moderateScale(4),
|
||||
marginBottom: verticalScale(2),
|
||||
},
|
||||
cardRow: {
|
||||
minHeight: moderateScale(64),
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
padding: moderateScale(14),
|
||||
backgroundColor: "#FFFFFF",
|
||||
borderRadius: moderateScale(14),
|
||||
borderWidth: 1,
|
||||
borderColor: "#E2EAE5",
|
||||
},
|
||||
patternRow: {
|
||||
minHeight: moderateScale(60),
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
padding: moderateScale(14),
|
||||
backgroundColor: "#FFFFFF",
|
||||
borderRadius: moderateScale(14),
|
||||
borderWidth: 1,
|
||||
borderColor: "#E2EAE5",
|
||||
},
|
||||
pressed: {
|
||||
opacity: 0.72,
|
||||
},
|
||||
numberBadge: {
|
||||
width: moderateScale(36),
|
||||
height: moderateScale(36),
|
||||
borderRadius: moderateScale(18),
|
||||
backgroundColor: "#E8F5E9",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
},
|
||||
numberText: {
|
||||
fontSize: moderateScale(15),
|
||||
fontWeight: "800",
|
||||
color: Colors.primaryDark,
|
||||
},
|
||||
titleContainer: {
|
||||
flex: 1,
|
||||
marginLeft: moderateScale(12),
|
||||
marginRight: moderateScale(8),
|
||||
},
|
||||
cardTitle: {
|
||||
fontSize: moderateScale(15),
|
||||
fontWeight: "700",
|
||||
color: Colors.textPrimary,
|
||||
},
|
||||
cardSubtitle: {
|
||||
fontSize: moderateScale(12),
|
||||
color: Colors.textSecondary,
|
||||
marginTop: verticalScale(2),
|
||||
},
|
||||
patternTitleContainer: {
|
||||
flex: 1,
|
||||
marginLeft: moderateScale(12),
|
||||
marginRight: moderateScale(8),
|
||||
},
|
||||
patternTitle: {
|
||||
fontSize: moderateScale(15),
|
||||
fontWeight: "600",
|
||||
color: Colors.textPrimary,
|
||||
},
|
||||
subSection: {
|
||||
marginTop: verticalScale(4),
|
||||
},
|
||||
subSectionSpacing: {
|
||||
marginTop: verticalScale(12),
|
||||
},
|
||||
subSectionTitle: {
|
||||
fontSize: moderateScale(13),
|
||||
fontWeight: "700",
|
||||
color: Colors.primaryDark,
|
||||
marginBottom: verticalScale(4),
|
||||
},
|
||||
bulletItem: {
|
||||
fontSize: moderateScale(13),
|
||||
lineHeight: verticalScale(20),
|
||||
color: Colors.textPrimary,
|
||||
marginLeft: moderateScale(4),
|
||||
},
|
||||
bodyText: {
|
||||
fontSize: moderateScale(13),
|
||||
lineHeight: verticalScale(20),
|
||||
color: Colors.textPrimary,
|
||||
},
|
||||
});
|
||||
|
|
@ -38,6 +38,8 @@ import { PathogenicFactorsCollectionRenderer, PathogenicFactorsCardRenderer } fr
|
|||
import { PathogenicFactorsDetailRenderer } from "./details/PathogenicFactorsDetailRenderer";
|
||||
import { TwelveChannelsCollectionRenderer, TwelveChannelsCardRenderer } from "./collections/TwelveChannelsRenderers";
|
||||
import { TwelveChannelsDetailRenderer } from "./details/TwelveChannelsDetailRenderer";
|
||||
import { ThreeBurnersCollectionRenderer, ThreeBurnersCardRenderer } from "./collections/ThreeBurnersRenderers";
|
||||
import { ThreeBurnersDetailRenderer } from "./details/ThreeBurnersDetailRenderer";
|
||||
|
||||
export const collectionRenderers: Readonly<Record<string, CollectionRendererComponent>> = Object.freeze({
|
||||
module_catalog_collection: ModuleCatalogCollectionRenderer,
|
||||
|
|
@ -62,6 +64,8 @@ export const collectionRenderers: Readonly<Record<string, CollectionRendererComp
|
|||
m0014_ct0001_collection: PathogenicFactorsCollectionRenderer,
|
||||
twelve_channels_collection: TwelveChannelsCollectionRenderer,
|
||||
m0018_ct0002_collection: TwelveChannelsCollectionRenderer,
|
||||
three_burners_collection: ThreeBurnersCollectionRenderer,
|
||||
m0017_ct0002_collection: ThreeBurnersCollectionRenderer,
|
||||
});
|
||||
export const collectionItemRenderers: Readonly<Record<string, CollectionItemRendererComponent>> = Object.freeze({
|
||||
module_catalog_card: ModuleCatalogCardRenderer,
|
||||
|
|
@ -86,6 +90,8 @@ export const collectionItemRenderers: Readonly<Record<string, CollectionItemRend
|
|||
m0014_ct0001_card: PathogenicFactorsCardRenderer,
|
||||
twelve_channels_card: TwelveChannelsCardRenderer,
|
||||
m0018_ct0002_card: TwelveChannelsCardRenderer,
|
||||
three_burners_card: ThreeBurnersCardRenderer,
|
||||
m0017_ct0002_card: ThreeBurnersCardRenderer,
|
||||
});
|
||||
export const detailRenderers: Readonly<Record<string, DetailRendererComponent>> = Object.freeze({
|
||||
module_catalog_detail: IndexEntryDetailRenderer,
|
||||
|
|
@ -136,6 +142,9 @@ export const detailRenderers: Readonly<Record<string, DetailRendererComponent>>
|
|||
twelve_channels_connecting_and_muscle_channel_detail: TwelveChannelsDetailRenderer,
|
||||
m0018_ct0001_detail: TwelveChannelsDetailRenderer,
|
||||
m0018_ct0002_detail: TwelveChannelsDetailRenderer,
|
||||
three_burners_detail: ThreeBurnersDetailRenderer,
|
||||
m0017_ct0001_detail: ThreeBurnersDetailRenderer,
|
||||
m0017_ct0002_detail: ThreeBurnersDetailRenderer,
|
||||
});
|
||||
function reportMissingRenderer(kind: string, code?: string | null) {
|
||||
if (__DEV__) {
|
||||
|
|
@ -181,6 +190,9 @@ export function resolveCollectionRenderer(
|
|||
if (normalizedTemplate === "m0018_ct0002" || (normalizedModule === "m0018" && normalizedTemplate?.includes("ct0002"))) {
|
||||
return TwelveChannelsCollectionRenderer;
|
||||
}
|
||||
if (normalizedTemplate === "m0017_ct0002" || (normalizedModule === "m0017" && normalizedTemplate?.includes("ct0002"))) {
|
||||
return ThreeBurnersCollectionRenderer;
|
||||
}
|
||||
|
||||
if (code && collectionRenderers[code]) return collectionRenderers[code];
|
||||
reportMissingRenderer("collection", code);
|
||||
|
|
@ -211,6 +223,9 @@ export function resolveCollectionItemRenderer(
|
|||
if (normalizedTemplate === "m0018_ct0002" || (normalizedModule === "m0018" && normalizedTemplate?.includes("ct0002"))) {
|
||||
return TwelveChannelsCardRenderer;
|
||||
}
|
||||
if (normalizedTemplate === "m0017_ct0002" || (normalizedModule === "m0017" && normalizedTemplate?.includes("ct0002"))) {
|
||||
return ThreeBurnersCardRenderer;
|
||||
}
|
||||
|
||||
if (code && collectionItemRenderers[code]) return collectionItemRenderers[code];
|
||||
reportMissingRenderer("collection-item", code);
|
||||
|
|
@ -258,6 +273,12 @@ export function resolveDetailRenderer(
|
|||
) {
|
||||
return TwelveChannelsDetailRenderer;
|
||||
}
|
||||
if(
|
||||
normalizedTemplate?.startsWith("m0017_") ||
|
||||
normalizedModule === "m0017"
|
||||
) {
|
||||
return ThreeBurnersDetailRenderer;
|
||||
}
|
||||
|
||||
if (code && detailRenderers[code]) return detailRenderers[code];
|
||||
reportMissingRenderer("detail", code);
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ const MODULE_VISUALS: Record<string, ModuleVisualConfig> = {
|
|||
color: "#EC4899",
|
||||
isDefaultFree: false,
|
||||
planCode: "PATTERN_CORE",
|
||||
entryTemplateCode: "m0017_ct0001",
|
||||
},
|
||||
m0018: {
|
||||
icon: "pulse-outline",
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ export default function FacetedSearchScreen({
|
|||
fixedModuleName,
|
||||
}: FacetedSearchScreenProps) {
|
||||
const isModuleMode = mode === "module";
|
||||
const normalizedModuleCode = fixedModuleCode?.trim().toUpperCase() || "";
|
||||
const normalizedModuleCode = fixedModuleCode?.trim().toLowerCase() || "";
|
||||
const fixedModuleCodes =
|
||||
isModuleMode && normalizedModuleCode ? [normalizedModuleCode] : null;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue