Merge pull request 'feat(therapeutics): generic detail and collection UI improvements for therapeutics modules' (#91) from theraputics into main

Reviewed-on: https://10.10.0.4/AcuPedia/acupedia-mobile-ui/pulls/91
Reviewed-by: Amit Salunke <amit@noreply.localhost>
This commit is contained in:
Amit Salunke 2026-10-29 07:02:23 +00:00
commit 71d8034a24
36 changed files with 546 additions and 648 deletions

12
.env
View File

@ -22,11 +22,11 @@
# EXPO_PUBLIC_CONTENT_PREVIEW_ENABLED=true
# QA Dev
EXPO_PUBLIC_API_URL=https://api.acupedia.in/api
EXPO_PUBLIC_STOREFRONT_URL=https://acupedia.in/store
EXPO_PUBLIC_CONTENT_PREVIEW_ENABLED=true
#EXPO_PUBLIC_API_URL=https://qa-api.acupedia.in/api
# EXPO_PUBLIC_STOREFRONT_URL=https://qa-acupedia.in/store
# EXPO_PUBLIC_CONTENT_PREVIEW_ENABLED=true
# Local Dev
# EXPO_PUBLIC_API_URL=http://localhost:8000/api
# EXPO_PUBLIC_STOREFRONT_URL=http://localhost:3000
# EXPO_PUBLIC_CONTENT_PREVIEW_ENABLED=true
EXPO_PUBLIC_API_URL=http://localhost:8000/api
EXPO_PUBLIC_STOREFRONT_URL=http://localhost:3000
EXPO_PUBLIC_CONTENT_PREVIEW_ENABLED=true

View File

@ -60,7 +60,7 @@ react {
// hermesFlags = ["-O", "-output-source-map"]
/* Autolinking */
autolinkLibrariesWithApp()
// autolinkLibrariesWithApp() // disabled to bypass codegen errors
}
/**
@ -87,9 +87,9 @@ android {
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdk rootProject.ext.compileSdkVersion
namespace 'com.anonymous.acupedia'
namespace 'com.renownent.mobile.acupedia'
defaultConfig {
applicationId 'com.anonymous.acupedia'
applicationId 'com.renownent.mobile.acupedia'
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1

View File

@ -11,7 +11,7 @@
<data android:scheme="https"/>
</intent>
</queries>
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme" android:supportsRtl="true" android:enableOnBackInvokedCallback="false">
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="false" android:theme="@style/AppTheme" android:supportsRtl="true" android:enableOnBackInvokedCallback="false" android:usesCleartextTraffic="true">
<meta-data android:name="expo.modules.updates.ENABLED" android:value="false"/>
<meta-data android:name="expo.modules.updates.ENABLE_BSDIFF_PATCH_SUPPORT" android:value="true"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
@ -26,6 +26,7 @@
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="myapp"/>
<data android:scheme="acupedia"/>
</intent-filter>
</activity>
</application>

View File

@ -1,65 +0,0 @@
package com.anonymous.acupedia
import expo.modules.splashscreen.SplashScreenManager
import android.os.Build
import android.os.Bundle
import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
import com.facebook.react.defaults.DefaultReactActivityDelegate
import expo.modules.ReactActivityDelegateWrapper
class MainActivity : ReactActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
// Set the theme to AppTheme BEFORE onCreate to support
// coloring the background, status bar, and navigation bar.
// This is required for expo-splash-screen.
// setTheme(R.style.AppTheme);
// @generated begin expo-splashscreen - expo prebuild (DO NOT MODIFY) sync-f3ff59a738c56c9a6119210cb55f0b613eb8b6af
SplashScreenManager.registerOnActivity(this)
// @generated end expo-splashscreen
super.onCreate(null)
}
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
override fun getMainComponentName(): String = "main"
/**
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
*/
override fun createReactActivityDelegate(): ReactActivityDelegate {
return ReactActivityDelegateWrapper(
this,
BuildConfig.IS_NEW_ARCHITECTURE_ENABLED,
object : DefaultReactActivityDelegate(
this,
mainComponentName,
fabricEnabled
){})
}
/**
* Align the back button behavior with Android S
* where moving root activities to background instead of finishing activities.
* @see <a href="https://developer.android.com/reference/android/app/Activity#onBackPressed()">onBackPressed</a>
*/
override fun invokeDefaultOnBackPressed() {
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) {
if (!moveTaskToBack(false)) {
// For non-root activities, use the default implementation to finish them.
super.invokeDefaultOnBackPressed()
}
return
}
// Use the default back button implementation on Android S
// because it's doing more than [Activity.moveTaskToBack] in fact.
super.invokeDefaultOnBackPressed()
}
}

View File

@ -1,57 +0,0 @@
package com.anonymous.acupedia
import android.app.Application
import android.content.res.Configuration
import com.facebook.react.PackageList
import com.facebook.react.ReactApplication
import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative
import com.facebook.react.ReactNativeHost
import com.facebook.react.ReactPackage
import com.facebook.react.ReactHost
import com.facebook.react.common.ReleaseLevel
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint
import com.facebook.react.defaults.DefaultReactNativeHost
import expo.modules.ApplicationLifecycleDispatcher
import expo.modules.ReactNativeHostWrapper
class MainApplication : Application(), ReactApplication {
override val reactNativeHost: ReactNativeHost = ReactNativeHostWrapper(
this,
object : DefaultReactNativeHost(this) {
override fun getPackages(): List<ReactPackage> =
PackageList(this).packages.apply {
// Packages that cannot be autolinked yet can be added manually here, for example:
// add(MyReactNativePackage())
}
override fun getJSMainModuleName(): String = ".expo/.virtual-metro-entry"
override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
}
)
override val reactHost: ReactHost
get() = ReactNativeHostWrapper.createReactHost(applicationContext, reactNativeHost)
override fun onCreate() {
super.onCreate()
DefaultNewArchitectureEntryPoint.releaseLevel = try {
ReleaseLevel.valueOf(BuildConfig.REACT_NATIVE_RELEASE_LEVEL.uppercase())
} catch (e: IllegalArgumentException) {
ReleaseLevel.STABLE
}
loadReactNative(this)
ApplicationLifecycleDispatcher.onApplicationCreate(this)
}
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig)
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -2,4 +2,5 @@
<color name="splashscreen_background">#208AEF</color>
<color name="iconBackground">#E6F4FE</color>
<color name="colorPrimary">#023c69</color>
<color name="colorPrimaryDark">#208AEF</color>
</resources>

View File

@ -2,4 +2,5 @@
<string name="app_name">acupedia</string>
<string name="expo_system_ui_user_interface_style" translatable="false">automatic</string>
<string name="expo_splash_screen_resize_mode" translatable="false">contain</string>
<string name="expo_splash_screen_status_bar_translucent" translatable="false">false</string>
</resources>

View File

@ -1,9 +1,9 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="android:enforceNavigationBarContrast" tools:targetApi="29">true</item>
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">#208AEF</item>
</style>
<style name="Theme.App.SplashScreen" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/splashscreen_background</item>

View File

@ -60,4 +60,7 @@ EX_DEV_CLIENT_NETWORK_INSPECTOR=true
# Use legacy packaging to compress native libraries in the resulting APK.
expo.useLegacyPackaging=false
expo.inlineModules.watchedDirectories=[]
expo.inlineModules.watchedDirectories=[]
# Specifies whether the app is configured to use edge-to-edge via the app config or plugin
# WARNING: This property has been deprecated and will be removed in Expo SDK 55. Use `edgeToEdgeEnabled` or `react.edgeToEdgeEnabled` to determine whether the project is using edge-to-edge.
expo.edgeToEdgeEnabled=true

11
eas.json Normal file
View File

@ -0,0 +1,11 @@
{
"build": {
"production": {
"android": {
"buildType": "apk",
"gradleCommand": "./gradlew assembleRelease",
"artifactPath": "android/app/build/outputs/apk/release/app-release.apk"
}
}
}
}

View File

@ -371,7 +371,7 @@
);
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG";
PRODUCT_BUNDLE_IDENTIFIER = com.renownent.mobile.acupedia;
PRODUCT_NAME = acupedia;
PRODUCT_NAME = "acupedia";
SWIFT_OBJC_BRIDGING_HEADER = "acupedia/acupedia-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
@ -405,7 +405,7 @@
);
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_RELEASE";
PRODUCT_BUNDLE_IDENTIFIER = com.renownent.mobile.acupedia;
PRODUCT_NAME = acupedia;
PRODUCT_NAME = "acupedia";
SWIFT_OBJC_BRIDGING_HEADER = "acupedia/acupedia-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";

Binary file not shown.

After

Width:  |  Height:  |  Size: 734 KiB

View File

@ -1,14 +1,14 @@
{
"images": [
{
"filename": "AppIcon.png",
"filename": "App-Icon-1024x1024@1x.png",
"idiom": "universal",
"platform": "ios",
"size": "1024x1024"
}
],
"info": {
"author": "expo",
"version": 1
"version": 1,
"author": "expo"
}
}
}

View File

@ -1,81 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>acupedia</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>myapp</string>
<string>com.renownent.acupedia</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>12.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSUserActivityTypes</key>
<array>
<string>$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route</string>
</array>
<key>RCTMetroPort</key>
<string>$(RCT_METRO_PORT)</string>
<key>RCTNewArchEnabled</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>SplashScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
<key>UIRequiresFullScreen</key>
<false/>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIUserInterfaceStyle</key>
<string>Automatic</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
<dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>acupedia</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>acupedia</string>
<string>com.renownent.mobile.acupedia</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>12.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSUserActivityTypes</key>
<array>
<string>$(PRODUCT_BUNDLE_IDENTIFIER).expo.index_route</string>
</array>
<key>RCTMetroPort</key>
<string>$(RCT_METRO_PORT)</string>
<key>RCTNewArchEnabled</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>SplashScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
<key>UIRequiresFullScreen</key>
<false/>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIUserInterfaceStyle</key>
<string>Automatic</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>

680
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@
"@tanstack/react-query": "^5.101.2",
"axios": "^1.18.1",
"expo": "~54.0.0",
"expo-build-properties": "~1.0.10",
"expo-build-properties": "~57.0.22",
"expo-constants": "~18.0.10",
"expo-device": "~8.0.9",
"expo-font": "~14.0.9",

View File

@ -1,22 +1,43 @@
import React from "react";
import React, { useMemo } from "react";
import { ScrollView } from "react-native";
import type { DetailRendererProps } from "../types/renderer.types";
import { humanizeKey } from "./helpers/value";
import { ContentLinkAttributeSections } from "./shared/ContentLinkAttributeSections";
import { ContentValue } from "./shared/ContentValue";
import { Hero } from "./shared/Hero";
import { ImageGallery } from "./shared/ImageGallery";
import { SectionCard } from "./shared/SectionCard";
const RESERVED_KEYS = new Set(["code"]);
const RESERVED_KEYS = new Set(["code", "id", "slug", "sort_order", "link"]);
/**
* Renderer-independent detail fallback.
* Generic detail renderer for modules and catalog items.
*
* `data` has already been filtered/ordered through the presentation contract by
* ContentDetailScreen, so object insertion order is the intended display order.
* Each attribute is rendered in its own separate SectionCard.
* For therapeutics modules, the redundant Hero name card is hidden.
*/
export function GenericDetailRenderer({ content, data }: DetailRendererProps) {
export function GenericDetailRenderer({
content,
data,
moduleCode,
templateCode,
definitions,
presentationAttributes,
}: DetailRendererProps) {
const isTherapeutic = Boolean(
moduleCode?.toLowerCase().startsWith("m004") ||
templateCode?.toLowerCase().startsWith("m004")
);
const definitionMap = useMemo(
() =>
new Map(
(definitions ?? []).map((d) => [d.code, d.label]),
),
[definitions],
);
return (
<ScrollView
contentContainerStyle={{
@ -27,15 +48,31 @@ export function GenericDetailRenderer({ content, data }: DetailRendererProps) {
}}
showsVerticalScrollIndicator={false}
>
<Hero title={content.title || "Untitled content"} subtitle={content.summary ?? undefined} />
<Hero
title={content.title || "Untitled content"}
subtitle={content.summary ?? undefined}
/>
<ImageGallery images={[]} />
{Object.entries(data)
.filter(([key]) => !RESERVED_KEYS.has(key))
.map(([key, value]) => (
<SectionCard key={key} title={humanizeKey(key)}>
<ContentValue value={value} />
</SectionCard>
))}
.filter(
([key]) =>
!RESERVED_KEYS.has(key) &&
!(isTherapeutic && key.toLowerCase() === "name"),
)
.map(([key, value]) => {
const rawLabel = definitionMap.get(key) || key;
const label = humanizeKey(rawLabel);
return (
<SectionCard key={key} title={label}>
<ContentValue value={value} />
</SectionCard>
);
})}
<ContentLinkAttributeSections
data={data}
definitions={definitions}
presentationAttributes={presentationAttributes}
/>
</ScrollView>
);
}

View File

@ -1,21 +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 { ImageGallery } from "../shared/ImageGallery";
import { KeyValueGrid } from "../shared/KeyValueGrid";
import { SectionCard } from "../shared/SectionCard";
export function IndexEntryDetailRenderer({content,data,definitions,presentationAttributes}:DetailRendererProps){
const subtitle = asString(data.sub_title) || asString(data.subtitle) || undefined;
return (
<ScrollView contentContainerStyle={{paddingHorizontal:18,paddingTop:16,paddingBottom:40,gap:14}}>
<Hero title={content.title} subtitle={subtitle}/>
<ImageGallery images={[]}/>
<SectionCard title="Details">
<KeyValueGrid rows={Object.entries(data).filter(([,v])=>typeof v==="string"||typeof v==="number").map(([k,v])=>({label:k,value:String(v)}))}/>
</SectionCard>
<ContentLinkAttributeSections data={data} definitions={definitions} presentationAttributes={presentationAttributes}/>
</ScrollView>
);
import { GenericDetailRenderer } from "../GenericDetailRenderer";
export function IndexEntryDetailRenderer(props: DetailRendererProps) {
return <GenericDetailRenderer {...props} />;
}

View File

@ -67,27 +67,10 @@ export const collectionRenderers: Readonly<Record<string, CollectionRendererComp
chinese_scalp_acupuncture_collection: ModuleCatalogCollectionRenderer,
nutrition_food_collection: ModuleCatalogCollectionRenderer,
nutrition_effect_collection: ModuleCatalogCollectionRenderer,
m0042_ct0001_collection: ModuleCatalogCollectionRenderer,
m0016_ct0001_collection: FourLevelsCollectionRenderer,
m0011_ct0005_collection: EightPrinciplesCollectionRenderer,
m0014_ct0001_collection: PathogenicFactorsCollectionRenderer,
five_elements_collection: FiveElementsCollectionRenderer,
m0019_ct0005_collection: FiveElementsCollectionRenderer,
qi_blood_collection: QiBloodCollectionRenderer,
m0013_ct0001_collection: QiBloodCollectionRenderer,
twelve_channels_collection: TwelveChannelsCollectionRenderer,
m0018_ct0002_collection: TwelveChannelsCollectionRenderer,
three_burners_collection: ThreeBurnersCollectionRenderer,
m0017_ct0002_collection: ThreeBurnersCollectionRenderer,
six_stages_collection: SixStagesCollectionRenderer,
m0015_ct0001_collection: SixStagesCollectionRenderer,
m0015_ct0002_collection: SixStagesCollectionRenderer,
m0015_ct0003_collection: SixStagesCollectionRenderer,
m0015_ct0004_collection: SixStagesCollectionRenderer,
m0015_ct0005_collection: SixStagesCollectionRenderer,
m0015_ct0006_collection: SixStagesCollectionRenderer,
tcm_pattern_list_collection: ModuleCatalogCollectionRenderer,
m0012_ct0001_collection: ModuleCatalogCollectionRenderer,
disease_collection: ModuleCatalogCollectionRenderer,
auriculotherapy_collection: ModuleCatalogCollectionRenderer,
// Module-specific renderers removed for generic handling
});
export const collectionItemRenderers: Readonly<Record<string, CollectionItemRendererComponent>> = Object.freeze({
module_catalog_card: ModuleCatalogCardRenderer,
@ -107,26 +90,10 @@ export const collectionItemRenderers: Readonly<Record<string, CollectionItemRend
chinese_scalp_acupuncture_card: ModuleCatalogCardRenderer,
nutrition_food_card: ModuleCatalogCardRenderer,
nutrition_effect_card: ModuleCatalogCardRenderer,
m0042_ct0001_card: ModuleCatalogCardRenderer,
m0016_ct0001_card: FourLevelsCardRenderer,
m0011_ct0005_card: EightPrinciplesCardRenderer,
m0014_ct0001_card: PathogenicFactorsCardRenderer,
m0019_ct0005_card: FiveElementsCardRenderer,
qi_blood_card: QiBloodCardRenderer,
m0013_ct0001_card: QiBloodCardRenderer,
twelve_channels_card: TwelveChannelsCardRenderer,
m0018_ct0002_card: TwelveChannelsCardRenderer,
three_burners_card: ThreeBurnersCardRenderer,
m0017_ct0002_card: ThreeBurnersCardRenderer,
six_stages_card: SixStagesCardRenderer,
m0015_ct0001_card: SixStagesCardRenderer,
m0015_ct0002_card: SixStagesCardRenderer,
m0015_ct0003_card: SixStagesCardRenderer,
m0015_ct0004_card: SixStagesCardRenderer,
m0015_ct0005_card: SixStagesCardRenderer,
m0015_ct0006_card: SixStagesCardRenderer,
tcm_pattern_list_card: ModuleCatalogCardRenderer,
m0012_ct0001_card: ModuleCatalogCardRenderer,
disease_card: ModuleCatalogCardRenderer,
auriculotherapy_card: ModuleCatalogCardRenderer,
// Module-specific card renderers removed for generic handling
});
export const detailRenderers: Readonly<Record<string, DetailRendererComponent>> = Object.freeze({
extra_ordinary_vessel_detail: ExtraOrdinaryVesselsDetailRenderer,
@ -164,10 +131,8 @@ export const detailRenderers: Readonly<Record<string, DetailRendererComponent>>
chinese_scalp_acupuncture_detail: AcuPointDetailRenderer,
nutrition_food_detail: GenericDetailRenderer,
nutrition_effect_detail: GenericDetailRenderer,
m0042_ct0001_detail: IndexEntryDetailRenderer,
m0042_ct0002_detail: IndexEntryDetailRenderer,
m0042_ct0003_detail: IndexEntryDetailRenderer,
m0042_ct0004_detail: IndexEntryDetailRenderer,
disease_detail: GenericDetailRenderer,
auriculotherapy_detail: GenericDetailRenderer,
m0016_ct0002_detail: FourLevelsDetailRenderer,
m0011_ct0001_detail: EightPrinciplesDetailRenderer,
m0011_ct0002_detail: EightPrinciplesDetailRenderer,
@ -233,6 +198,10 @@ export function resolveCollectionRenderer(
if (normalizedTemplate === "m0016_ct0001" || normalizedModule === "m0016") {
return FourLevelsCollectionRenderer;
}
// Generic fallback for any mXXXX_ct... template
if (normalizedTemplate?.startsWith("m") && normalizedTemplate?.includes("_ct")) {
return ModuleCatalogCollectionRenderer;
}
if (normalizedTemplate === "m0011_ct0005" || normalizedModule === "m0011") {
return EightPrinciplesCollectionRenderer;
}
@ -304,6 +273,10 @@ export function resolveCollectionItemRenderer(
if (normalizedTemplate === "m0017_ct0002" || (normalizedModule === "m0017" && normalizedTemplate?.includes("ct0002"))) {
return ThreeBurnersCardRenderer;
}
// Generic fallback for any mXXXX_ct... template
if (normalizedTemplate?.startsWith("m") && normalizedTemplate?.includes("_ct")) {
return ModuleCatalogCardRenderer;
}
if (
normalizedTemplate?.startsWith("m0015_ct000") &&
normalizedTemplate !== "m0015_ct0007"
@ -410,6 +383,10 @@ export function resolveDetailRenderer(
return ExtraOrdinaryVesselsDetailRenderer;
}
// Generic fallback for any mXXXX_ct... template
if (normalizedTemplate?.startsWith("m") && normalizedTemplate?.includes("_ct")) {
return GenericDetailRenderer;
}
if (code && detailRenderers[code]) return detailRenderers[code];
reportMissingRenderer("detail", code);
return GenericDetailRenderer;

View File

@ -152,6 +152,25 @@ export function ContentValue({
);
}
if (typeof value === "string") {
const text = value.trim();
if (text.includes("\n") || text.includes(";")) {
const bullets = parseBullets(text);
if (bullets.length > 1) {
return <BulletList items={bullets} />;
}
}
if (text.includes(",")) {
const parts = parseBullets(text);
if (
parts.length > 1 &&
parts.every((p) => p.length > 0 && p.length < 50 && !p.endsWith("."))
) {
return <BulletList items={parts} />;
}
}
}
return (
<Text style={[styles.text, textStyle]}>
{typeof value === "boolean" ? (value ? "Yes" : "No") : String(value)}

View File

@ -134,8 +134,13 @@ export function CollectionTemplateScreen({
const isCatalog =
collectionRendererCode === "module_catalog_collection" ||
itemRendererCode === "module_catalog_card" ||
collectionRendererCode === "disease_collection" ||
itemRendererCode === "disease_card" ||
collectionRendererCode === "auriculotherapy_collection" ||
itemRendererCode === "auriculotherapy_card" ||
templateCode === "m0001_ct0001" ||
templateCode === "m0002_ct0001";
templateCode === "m0002_ct0001" ||
templateCode === "m0041_ct0001";
const pageTone: PageTone = isCatalog ? "green" : "purple";
return (