merge: resolve main conflict in four levels

This commit is contained in:
ShivaniKhaire 2026-09-25 10:42:54 +05:30
commit 82a2a5673e
21 changed files with 673 additions and 42 deletions

8
.env
View File

@ -17,9 +17,9 @@
# old working .env file
# Production Dev
# EXPO_PUBLIC_API_URL=https://api.acupedia.in/api
# EXPO_PUBLIC_STOREFRONT_URL=https://acupedia.in/store
EXPO_PUBLIC_API_URL=https://api.acupedia.in/api
EXPO_PUBLIC_STOREFRONT_URL=https://acupedia.in/store
# Local Dev
EXPO_PUBLIC_API_URL=http://localhost:8000/api
EXPO_PUBLIC_STOREFRONT_URL=http://localhost:3000
# EXPO_PUBLIC_API_URL=http://localhost:8000/api
# EXPO_PUBLIC_STOREFRONT_URL=http://localhost:3000

View File

@ -8,7 +8,14 @@
"scheme": "myapp",
"userInterfaceStyle": "automatic",
"ios": {
"icon": "./assets/expo.icon"
"bundleIdentifier": "com.anonymous.acupedia",
"supportsTablet": true,
"icon": "./assets/expo.icon",
"infoPlist": {
"NSAppTransportSecurity": {
"NSAllowsArbitraryLoads": true
}
}
},
"android": {
"adaptiveIcon": {

234
docs/instruction_for_ios.md Normal file
View File

@ -0,0 +1,234 @@
# iOS Release (.ipa) Build Instructions
> **Note:** This guide explains how to build the native iOS release app (`.ipa`) locally on your Mac using Xcode command-line tools and CocoaPods, without using cloud EAS build.
---
## Prerequisites on Mac (One-Time Setup)
Before building, make sure your Mac has:
1. **Xcode** (Download free from Mac App Store).
2. **Xcode Command Line Tools**:
```bash
xcode-select --install
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
```
3. **CocoaPods** (Dependency manager for iOS native libraries):
```bash
brew install cocoapods
```
4. **Node.js & Watchman**:
```bash
brew install node watchman
```
---
## Step 1: Prebuild the iOS Native Project
Run this in your project root to generate the native `ios/` directory, Podfile, and Xcode workspace:
```bash
cd ~/acupedia_mobile_ui
npx expo prebuild --platform ios
```
---
## Step 2: Install CocoaPods Dependencies
Navigate into the generated `ios/` folder and install the native iOS pods:
```bash
cd ios
pod install
cd ..
```
---
## Step 3: Configure Code Signing (One-Time Setup in Xcode)
Apple requires all iOS binaries to be signed with an Apple ID or Apple Developer certificate (unlike Android which uses a local `.keystore` file).
1. Open the project in Xcode:
```bash
open ios/acupedia.xcworkspace
```
*(Important: Always open `.xcworkspace`, never `.xcodeproj`)*
2. In the left file navigator, select the top-level **`acupedia`** project.
3. In the center pane, select the **`acupedia`** Target and go to the **`Signing & Capabilities`** tab.
4. Check **Automatically manage signing**.
5. In the **Team** dropdown, select your Apple ID / Developer Team (click *Add an Account...* if not logged in).
6. Confirm the **Bundle Identifier** matches: `com.anonymous.acupedia`.
---
## Step 4: Understanding Export Methods in `ExportOptions.plist`
In `ExportOptions.plist`, the `<key>method</key>` defines how the `.ipa` is signed and who can install it:
| Method | What it is | When to Use | Requirements |
| :--- | :--- | :--- | :--- |
| **`development`** | Signed for local developer devices. | **Recommended for your testing.** Install directly on your Mac or your own connected iPhone. | Free personal Apple ID or paid Developer account. |
| **`ad-hoc`** | Signed for external tester devices without App Store. | When sending the `.ipa` file to outside clients/testers to test on their own iPhones. | Paid Apple Developer Account ($99/yr) + recipient device UDIDs must be registered in Apple Developer portal. |
| **`app-store`** | Production release signed for Apple's servers. | Uploading to **TestFlight** or the **Apple App Store**. | Paid Apple Developer Account. Cannot be installed directly on a phone via USB. |
### Which should you select?
- **For local testing on your own iPhone or simulator:** Select **`development`**.
- **For sharing with remote testers outside your office:** Select **`ad-hoc`** (or upload to TestFlight using `app-store`).
Create the file `ios/ExportOptions.plist`:
```xml
<?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>method</key>
<string>development</string>
<key>signingStyle</key>
<string>automatic</string>
<key>stripSwiftSymbols</key>
<true/>
<key>compileBitcode</key>
<false/>
</dict>
</plist>
```
---
## Step 5: Build the Release `.ipa`
You can build either via **Terminal (CLI)** or **Xcode (GUI)**:
### Method A: Terminal CLI (Equivalent to `./gradlew assembleRelease`)
Run the following commands:
```bash
cd ~/acupedia_mobile_ui/ios
# 1. Clean and Archive the Release build
xcodebuild -workspace acupedia.xcworkspace \
-scheme acupedia \
-configuration Release \
-destination 'generic/platform=iOS' \
-archivePath build/acupedia.xcarchive \
archive
# 2. Export the .ipa file
xcodebuild -exportArchive \
-archivePath build/acupedia.xcarchive \
-exportOptionsPlist ExportOptions.plist \
-exportPath build/ipa
```
Your generated iOS release file will be located at:
📁 **`ios/build/ipa/acupedia.ipa`**
---
### Method B: Xcode GUI Archive (1-Click Export)
1. In Xcode, in the top destination bar, select **Any iOS Device (arm64)**.
2. In the top menu bar, click **Product → Archive**.
3. When the compilation finishes, the **Organizer** window opens automatically.
4. Click **Distribute App**:
- Select **Development** (for connected phones) or **Ad Hoc** (for remote testers) or **App Store Connect** (for TestFlight).
- Click **Next** through the signing steps and click **Export**.
5. Xcode saves the **`acupedia.ipa`** to your chosen destination folder.
---
## Step 6: How to Install the `.ipa` File on an iPhone
Unlike Android where you can simply tap an APK to install it, iOS requires a trusted installation method:
### Method 1: Using Mac Finder (Fastest via USB)
1. Connect your iPhone to your Mac using a lightning/USB-C cable.
2. Open **Finder** on your Mac and select your iPhone under **Locations** in the left sidebar.
3. If prompted on the iPhone, tap **"Trust This Computer"** and enter your passcode.
4. Simply **drag and drop** the `acupedia.ipa` file directly onto the iPhone window in Finder.
5. The app will install on your iPhone home screen within 10–20 seconds.
### Method 2: Using Xcode Devices Window (USB)
1. Connect your iPhone to your Mac.
2. In Xcode, go to the top menu: **Window → Devices and Simulators** (or press `Cmd + Shift + 2`).
3. Under **Connected**, select your iPhone.
4. Under the **Installed Apps** section, click the **`+`** (plus) icon.
5. Select `acupedia.ipa` and click **Open**. The app installs immediately.
### Method 3: Wireless Over-The-Air (OTA) Link for Remote Testers
If you built with `ad-hoc` and want to send the app to a remote tester without cables:
1. Open free distribution services like [Diawi.com](https://www.diawi.com) or [InstallOnAir.com](https://www.installonair.com).
2. Upload `acupedia.ipa`.
3. Share the generated link or QR code with the tester.
4. The tester opens the link in **Safari** on their iPhone and taps **Install**.
*(Note: Requires the tester's iPhone UDID to be registered in your Apple Developer Account).*
### Method 4: Sideloadly (When Mac & iPhone are in Different Locations & Using Free Apple ID)
If the Mac and iPhone are in different locations and you **do not** have a paid Apple Developer Account ($99/year), you can send the raw `.ipa` file directly to the tester, and they can install it using their own computer (Windows PC or Mac) with **Sideloadly**:
1. **Send the file:** Send `acupedia.ipa` to the remote user via Google Drive, WeTransfer, or Telegram.
2. **Download Sideloadly:** On their computer (Windows or Mac), have them download and install **[Sideloadly](https://sideloadly.io/)** (Free).
3. **Connect iPhone:** Connect the iPhone to their computer using a USB cable. If prompted on the iPhone, tap **"Trust This Computer"** and enter the passcode.
4. **Open Sideloadly:**
- Sideloadly will automatically detect the connected device.
- **Drag and drop** `acupedia.ipa` into the IPA icon box on Sideloadly.
- In the **Apple ID** field, have the user enter their own personal Apple ID (email).
- Click **"Start"**.
5. **Installation:** Sideloadly signs the application using their Apple ID and installs it directly onto their iPhone within 1–2 minutes!
6. **First Launch:** The user must then complete **Step 7** below (Trust Developer & Developer Mode) to open the app.
### Method 5: 3uTools (Windows PC Alternative)
If the remote tester uses a Windows PC:
1. Send `acupedia.ipa` to the tester.
2. The tester installs **[3uTools](https://www.3utools.com/)** (Free) on their Windows PC.
3. Connect iPhone to PC via USB cable.
4. In 3uTools, go to **Apps** → Click **"Import & Install IPA"**.
5. Select `acupedia.ipa` and it installs directly onto the connected iPhone.
### Method 6: Apple TestFlight (Official Remote Distribution)
If you have a paid Apple Developer Account:
1. Build with `<string>app-store</string>`.
2. Upload using the free **Transporter** app on your Mac.
3. In [App Store Connect](https://appstoreconnect.apple.com) → TestFlight, enter the tester's email address.
4. The tester receives an invitation email and installs the app via the free Apple TestFlight app from the App Store (no cables, no UDID required).
---
## Step 7: Required iPhone Permissions & Settings (Must-Do on Phone)
When launching the app for the first time, iOS security will block it until you enable these two settings:
### 1. Trust the Developer Certificate ("Untrusted Developer" Alert)
If you tap the app and see:
> *"Untrusted Enterprise Developer / Untrusted Developer: Your device needs to trust this developer before opening."*
**Fix:**
1. On your iPhone, open **Settings → General → VPN & Device Management**.
2. Under **Developer App**, tap your Apple ID / Email.
3. Tap **"Trust [Your Email / Name]"** and confirm.
### 2. Enable Developer Mode (iOS 16, 17, 18+)
On iOS 16 or newer, Apple blocks developer-installed apps until Developer Mode is toggled:
1. On your iPhone, open **Settings → Privacy & Security**.
2. Scroll to the very bottom and tap **Developer Mode**.
3. Toggle Developer Mode to **ON**.
4. Tap **Restart** when prompted.
5. After reboot, unlock your phone and tap **Turn On**, then enter your device passcode.
---
## Troubleshooting Common iOS Build Issues
| Issue | Cause | Solution |
| :--- | :--- | :--- |
| **"No signing certificate found"** | Xcode has no Apple ID account configured. | Go to Xcode → `Settings` (or `Preferences`) → `Accounts` → Click `+` and sign in with your Apple ID. |
| **"The maximum number of apps for free development profiles has been reached"** | Apple limits free Apple IDs to 3 active sideloaded apps. | Delete any old test apps from your iPhone before installing, or use a paid Apple Developer Account. |
| **App certificate expires after 7 days** | Free personal Apple IDs only grant 7-day provisioning profiles. | Rebuild and re-install with Xcode after 7 days, or sign with a paid Apple Developer account ($99/year) which lasts 1 year. |
| **"App Transport Security (ATS) blocked cleartext HTTP"** | App is trying to access an insecure `http://` URL. | Ensure `.env` uses `https://api.acupedia.in` (already configured). iOS strictly requires HTTPS. |
| **CocoaPods error during `pod install`** | CocoaPods cache is out of date. | Run `cd ios && pod cache clean --all && pod install --repo-update && cd ..`. |

View File

@ -0,0 +1,6 @@
import React from "react";
import { Redirect } from "expo-router";
export default function ModulesListRoute() {
return <Redirect href="/modules" />;
}

View File

@ -180,7 +180,7 @@ export default function SubscriptionScreen() {
};
return (
<SafeAreaView style={styles.safeArea}>
<SafeAreaView style={styles.safeArea} edges={["top", "left", "right"]}>
<View style={styles.header}>
<TouchableOpacity onPress={() => router.back()} style={styles.backButton}>
<Ionicons name="chevron-back" size={24} color={Colors.textPrimary} />
@ -272,7 +272,7 @@ export default function SubscriptionScreen() {
</>
) : (
<View style={styles.buttonContainer}>
<PrimaryButton title="Back to Modules" onPress={() => router.replace("/modules/list")} />
<PrimaryButton title="Back to Modules" onPress={() => router.replace("/modules")} />
</View>
)}
</ScrollView>
@ -281,13 +281,15 @@ export default function SubscriptionScreen() {
}
const styles = StyleSheet.create({
safeArea: { flex: 1, backgroundColor: Colors.background },
safeArea: { flex: 1, backgroundColor: "#FFFFFF" },
header: {
height: 60,
minHeight: 64,
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
paddingHorizontal: moderateScale(16),
paddingTop: Platform.OS === "web" ? 14 : moderateScale(8),
paddingBottom: moderateScale(8),
borderBottomWidth: 1,
borderBottomColor: "#ECECEC",
backgroundColor: "#FFFFFF",

View File

@ -2,10 +2,10 @@ import React from "react";
import {
ActivityIndicator,
Pressable,
SafeAreaView,
Text,
View,
} from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
export function ScreenLoading({ message = "Loading content…" }: { message?: string }) {
return (

View File

@ -1,5 +1,5 @@
import React, { type ReactNode } from "react";
import { Pressable, StyleSheet, Text, View } from "react-native";
import { Platform, Pressable, StyleSheet, Text, View } from "react-native";
import { Ionicons } from "@expo/vector-icons";
import { router } from "expo-router";
import { moderateScale } from "react-native-size-matters";
@ -92,11 +92,13 @@ export function ContentPageHeader({
const styles = StyleSheet.create({
header: {
minHeight: 60,
minHeight: 64,
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
paddingHorizontal: moderateScale(16),
paddingTop: Platform.OS === "web" ? 14 : moderateScale(8),
paddingBottom: moderateScale(8),
borderBottomWidth: 1,
borderBottomColor: "#ECECEC",
backgroundColor: "#FFFFFF",

View File

@ -3,7 +3,6 @@ import React, { memo, useEffect, useMemo, useRef, useState } from "react";
import {
ActivityIndicator,
FlatList,
Image,
NativeScrollEvent,
NativeSyntheticEvent,
Pressable,
@ -12,6 +11,7 @@ import {
useWindowDimensions,
View,
} from "react-native";
import { Image } from "expo-image";
import { useAuthStore } from "@/store/auth.store";
import { Colors } from "@/theme/colors";
@ -103,12 +103,13 @@ const GalleryImage = memo(function GalleryImage({
<Image
source={source}
style={styles.image}
resizeMode="contain"
contentFit="contain"
accessible
accessibilityRole="image"
accessibilityLabel={item.alt_text || item.caption || "Content image"}
onLoad={() => setLoading(false)}
onError={() => {
onError={(error) => {
console.warn("Failed to load GalleryImage:", source, error);
setLoading(false);
setFailed(true);
}}

View File

@ -76,7 +76,7 @@ export function FullScreenMediaViewer({
</Text>
<Pressable
onPress={onClose}
hitSlop={12}
hitSlop={16}
accessibilityRole="button"
accessibilityLabel="Close image viewer"
style={({ pressed }) => [styles.closeButton, pressed && styles.pressed]}
@ -107,7 +107,7 @@ export function FullScreenMediaViewer({
item={item}
accessToken={accessToken}
width={width}
height={Math.max(height - 170, 320)}
height={Math.max(height - 150, 320)}
active={index === activeIndex}
onZoomStateChange={index === activeIndex ? setZoomed : undefined}
/>
@ -128,7 +128,8 @@ export function FullScreenMediaViewer({
const styles = StyleSheet.create({
root: { flex: 1, backgroundColor: Colors.black },
toolbar: {
height: 58,
height: 56,
marginTop: 16,
paddingHorizontal: 16,
flexDirection: "row",
alignItems: "center",
@ -144,7 +145,12 @@ const styles = StyleSheet.create({
backgroundColor: "rgba(255,255,255,0.12)",
},
pressed: { opacity: 0.65 },
footer: { minHeight: 94, paddingHorizontal: 20, paddingTop: 12, paddingBottom: 18 },
caption: { color: Colors.white, fontSize: 15, lineHeight: 21, textAlign: "center" },
hint: { marginTop: 7, color: "#AFAFAF", fontSize: 12, textAlign: "center" },
footer: {
minHeight: 64,
paddingHorizontal: 20,
paddingTop: 6,
paddingBottom: 8,
},
caption: { color: Colors.white, fontSize: 15, lineHeight: 20, textAlign: "center" },
hint: { marginTop: 4, color: "#AFAFAF", fontSize: 12, textAlign: "center" },
});

View File

@ -1,5 +1,6 @@
import React, { memo, useEffect, useMemo, useState } from "react";
import { ActivityIndicator, Image, StyleSheet, Text, View } from "react-native";
import { ActivityIndicator, StyleSheet, Text, View } from "react-native";
import { Image } from "expo-image";
import { Gesture, GestureDetector } from "react-native-gesture-handler";
import Animated, {
runOnJS,
@ -182,13 +183,14 @@ export const ZoomableImage = memo(function ZoomableImage({
<Animated.View style={[styles.imageWrap, animatedStyle]}>
<Image
source={source}
resizeMode="contain"
contentFit="contain"
style={styles.image}
accessible
accessibilityRole="image"
accessibilityLabel={item.alt_text || item.caption || "Content image"}
onLoad={() => setLoading(false)}
onError={() => {
onError={(error) => {
console.warn("Failed to load ZoomableImage:", source, error);
setLoading(false);
setFailed(true);
}}

View File

@ -1,4 +1,4 @@
import type { ImageSourcePropType } from "react-native";
import type { ImageSource } from "expo-image";
import type { ContentMediaItem } from "../types/media.types";
/**
@ -44,7 +44,7 @@ export function buildMediaImageSourceFromValues(
storageKey: string | null | undefined,
requiresAuth: boolean | null | undefined,
accessToken: string | null,
): ImageSourcePropType | null {
): ImageSource | null {
const uri = resolveMediaUri(url, storageKey);
if (!uri) {
@ -69,7 +69,7 @@ export function buildMediaImageSourceFromValues(
export function buildMediaImageSource(
item: ContentMediaItem,
accessToken: string | null,
): ImageSourcePropType | null {
): ImageSource | null {
return buildMediaImageSourceFromValues(
item.url,
item.storage_key,

View File

@ -0,0 +1,175 @@
import React from "react";
import { Pressable, StyleSheet, Text, View } from "react-native";
import { Ionicons } from "@expo/vector-icons";
import { moderateScale, verticalScale } from "react-native-size-matters";
import { Colors } from "@/theme";
import { asNumber, asString } from "../helpers/value";
import { CollectionScaffold } from "../shared/CollectionScaffold";
import type {
CollectionItemRendererProps,
CollectionRendererProps,
} from "../../types/renderer.types";
export function PathogenicFactorsCollectionRenderer(
props: CollectionRendererProps,
) {
const header = (
<View style={styles.overviewContainer}>
<View style={styles.overviewCard}>
<View style={styles.overviewHeader}>
<Ionicons name="information-circle" size={20} color={Colors.primary} />
<Text style={styles.overviewTitle}>Overview</Text>
</View>
<Text style={styles.overviewText}>
This method of pattern identification is based on the pathological changes occurring when the body is invaded by pathogenic factors such as Wind, Cold, Summer-Heat, Dampness, Dryness and Fire. Each of these pathogenic factors may be exterior or interior.
</Text>
<Text style={styles.overviewParagraph}>
They always correspond to a Full pattern according to the Eight Principles. Indeed, from the Eight-Principle point of view, a Full condition is defined as one characterized by the presence of a pathogenic factor while the body’s Qi is still relatively intact.
</Text>
<Text style={styles.overviewParagraph}>
The pathogenic factor is frequently associated with a Deficiency, in which case the condition is a combined Full–Empty condition. With regard to pathogenic factors, a combined Full-Empty condition can arise in one of two ways: a pathogenic factor can give rise to a Deficiency (e.g. Fire weakens Yin) or a Deficiency can give rise to a pathogenic factor (e.g. Spleen-Qi deficiency gives rise to Dampness).
</Text>
<Text style={styles.overviewParagraph}>
Generally speaking, pathogenic factors are more relevant as patterns of disharmony than as causes of disease. The diagnosis of a pathogenic factor is made not on the basis of the patient’s history, but on the basis of the pattern of symptoms and signs presented.
</Text>
</View>
<Text style={styles.sectionHeading}>Pathogenic Factors</Text>
</View>
);
return <CollectionScaffold {...props} header={header} />;
}
export function PathogenicFactorsCardRenderer({
item,
onPress,
}: CollectionItemRendererProps) {
const a = item.attributes;
const title =
asString(a.name) ||
asString(a.title) ||
item.title;
const overview =
asString(a.overview) ||
asString(a.content) ||
item.summary;
const sortOrder = asNumber(a.sort_order);
const factorNumber = typeof sortOrder === "number" && sortOrder > 0 ? sortOrder : undefined;
return (
<Pressable
accessibilityRole="button"
accessibilityLabel={title}
onPress={onPress}
style={({ pressed }) => [styles.row, pressed && styles.pressed]}
>
<View style={styles.iconBox}>
{factorNumber !== undefined ? (
<Text style={styles.factorNumber}>{factorNumber}</Text>
) : (
<Ionicons name="leaf-outline" size={20} color={Colors.textPrimary} />
)}
</View>
<View style={styles.content}>
<Text numberOfLines={2} style={styles.title}>
{title}
</Text>
{overview ? (
<Text numberOfLines={3} style={styles.subtitle}>
{overview}
</Text>
) : null}
</View>
<Ionicons name="chevron-forward" size={19} color="#94A3B8" />
</Pressable>
);
}
const styles = StyleSheet.create({
overviewContainer: {
marginBottom: verticalScale(14),
},
overviewCard: {
backgroundColor: "#FFFFFF",
borderRadius: moderateScale(16),
borderWidth: 1,
borderColor: "#E2EAE5",
padding: moderateScale(16),
marginBottom: verticalScale(14),
},
overviewHeader: {
flexDirection: "row",
alignItems: "center",
marginBottom: verticalScale(8),
gap: moderateScale(8),
},
overviewTitle: {
fontSize: moderateScale(16),
fontWeight: "700",
color: Colors.textPrimary,
},
overviewText: {
fontSize: moderateScale(13),
lineHeight: verticalScale(19),
color: Colors.textSecondary,
},
overviewParagraph: {
fontSize: moderateScale(13),
lineHeight: verticalScale(19),
color: Colors.textSecondary,
marginTop: verticalScale(10),
},
sectionHeading: {
fontSize: moderateScale(15),
fontWeight: "700",
color: Colors.textPrimary,
marginBottom: verticalScale(4),
marginLeft: moderateScale(4),
},
row: {
minHeight: verticalScale(72),
flexDirection: "row",
alignItems: "center",
paddingHorizontal: moderateScale(14),
paddingVertical: verticalScale(13),
gap: moderateScale(11),
},
pressed: {
opacity: 0.72,
},
iconBox: {
width: moderateScale(40),
height: moderateScale(40),
borderRadius: moderateScale(20),
alignItems: "center",
justifyContent: "center",
backgroundColor: "#E8F5E9",
},
factorNumber: {
fontSize: moderateScale(16),
fontWeight: "800",
color: Colors.primaryDark,
},
content: {
flex: 1,
gap: verticalScale(3),
},
title: {
fontSize: moderateScale(16),
lineHeight: moderateScale(22),
fontWeight: "700",
color: Colors.textPrimary,
},
subtitle: {
fontSize: moderateScale(12.5),
lineHeight: moderateScale(18),
color: Colors.textSecondary,
},
});

View File

@ -0,0 +1,93 @@
import React from "react";
import { ScrollView, StyleSheet } from "react-native";
import type { DetailRendererProps } from "../../types/renderer.types";
import { ContentLinkAttributeSections } from "../shared/ContentLinkAttributeSections";
import { Hero } from "../shared/Hero";
import { SectionCard } from "../shared/SectionCard";
import { Paragraphs } from "../shared/Paragraphs";
import { ImageGallery } from "../shared/ImageGallery";
import { asString } from "../helpers/value";
export function PathogenicFactorsDetailRenderer({
content,
data,
definitions,
presentationAttributes,
}: DetailRendererProps) {
const title =
asString(data.name) ||
asString(data.title) ||
content.title;
const overview = asString(data.overview);
const clinicalManifestations = asString(data.clinical_manifestations);
const analysis = asString(data.analysis);
const contentText = asString(data.content);
const defaultImage = asString(data["default image"]);
const imageValue = data.image;
const media = Array.isArray(imageValue)
? imageValue.filter(
(item): item is Record<string, unknown> =>
item !== null && typeof item === "object" && !Array.isArray(item),
)
: [];
return (
<ScrollView
contentContainerStyle={styles.content}
showsVerticalScrollIndicator={false}
>
<Hero title={title} />
{media.length > 0 ? <ImageGallery images={media} /> : null}
{defaultImage ? (
<SectionCard title="Default Image">
<Paragraphs items={[defaultImage]} />
</SectionCard>
) : null}
{overview ? (
<SectionCard title="Overview">
<Paragraphs items={[overview]} />
</SectionCard>
) : null}
{clinicalManifestations ? (
<SectionCard title="Clinical Manifestations">
<Paragraphs items={[clinicalManifestations]} />
</SectionCard>
) : null}
{analysis ? (
<SectionCard title="Analysis">
<Paragraphs items={[analysis]} />
</SectionCard>
) : null}
{contentText ? (
<SectionCard title="Content">
<Paragraphs items={[contentText]} />
</SectionCard>
) : null}
<ContentLinkAttributeSections
data={data}
definitions={definitions}
presentationAttributes={presentationAttributes}
/>
</ScrollView>
);
}
const styles = StyleSheet.create({
content: {
paddingHorizontal: 18,
paddingTop: 16,
paddingBottom: 40,
gap: 14,
},
});

View File

@ -30,8 +30,38 @@ import { ReturningYangDetailRenderer } from "./details/ReturningYangDetailRender
import { EarAcupunctureCatalogCollectionRenderer, EarAcupunctureCatalogCardRenderer, EarAcupunctureCollectionRenderer, EarAcupunctureCardRenderer } from "./collections/EarAcupunctureRenderers";
import { EarAcupunctureCatalogDetailRenderer } from "./details/EarAcupunctureCatalogDetailRenderer";
import { EarAcupunctureDetailRenderer } from "./details/EarAcupunctureDetailRenderer";
import { FourLevelsCollectionRenderer, FourLevelsCardRenderer } from "./collections/FourLevelsRenderers";
import { FourLevelsDetailRenderer } from "./details/FourLevelsDetailRenderer";
import { PatternCollectionRenderer, PatternCardRenderer } from "./collections/PatternRenderers";
import { PatternDetailRenderer } from "./details/PatternDetailRenderer";
import { EightPrinciplesCollectionRenderer, EightPrinciplesCardRenderer } from "./collections/EightPrinciplesRenderers";
import { EightPrinciplesDetailRenderer } from "./details/EightPrinciplesDetailRenderer";
import { FiveElementsCollectionRenderer, FiveElementsCardRenderer } from "./collections/FiveElementsRenderers";
import { FiveElementsDetailRenderer } from "./details/FiveElementsDetailRenderer";
import { FourLevelsCollectionRenderer, FourLevelsCardRenderer } from "./collections/FourLevelsRenderers";
import { SixStagesCollectionRenderer, SixStagesCardRenderer } from "./collections/SixStagesRenderers";
import { SixStagesDetailRenderer } from "./details/SixStagesDetailRenderer";
import { ThreeBurnersCollectionRenderer, ThreeBurnersCardRenderer } from "./collections/ThreeBurnersRenderers";
import { ThreeBurnersDetailRenderer } from "./details/ThreeBurnersDetailRenderer";
import {
TwelveChannelsCollectionRenderer,
TwelveChannelsCardRenderer,
TwelveChannelsConnectingAndMuscleChannelCollectionRenderer,
TwelveChannelsConnectingAndMuscleChannelCardRenderer,
} from "./collections/TwelveChannelsRenderers";
import { TwelveChannelsDetailRenderer } from "./details/TwelveChannelsDetailRenderer";
import { TwelveChannelsConnectingAndMuscleChannelDetailRenderer } from "./details/TwelveChannelsConnectingAndMuscleChannelDetailRenderer";
import { ExtraOrdinaryVesselCollectionRenderer, ExtraOrdinaryVesselCardRenderer } from "./collections/ExtraOrdinaryVesselRenderers";
import { ExtraOrdinaryVesselDetailRenderer } from "./details/ExtraOrdinaryVesselDetailRenderer";
import { DeficiencyExcessPatternsCollectionRenderer, DeficiencyExcessPatternsCardRenderer } from "./collections/DeficiencyExcessPatternsRenderers";
import { DeficiencyExcessPatternsDetailRenderer } from "./details/DeficiencyExcessPatternsDetailRenderer";
import { YinYangCollectionRenderer, YinYangCardRenderer } from "./collections/YinYangRenderers";
import { YinYangDetailRenderer } from "./details/YinYangDetailRenderer";
import { PathogenicFactorsCollectionRenderer, PathogenicFactorsCardRenderer } from "./collections/PathogenicFactorsRenderers";
import { PathogenicFactorsDetailRenderer } from "./details/PathogenicFactorsDetailRenderer";
import { TcmPatternListCollectionRenderer, TcmPatternListCardRenderer } from "./collections/TcmPatternListRenderers";
import { TcmPatternDetailRenderer } from "./details/TcmPatternDetailRenderer";
import { DiseaseCollectionRenderer, DiseaseCardRenderer } from "./collections/DiseaseRenderers";
import { DiseaseDetailRenderer } from "./details/DiseaseDetailRenderer";
export const collectionRenderers: Readonly<Record<string, CollectionRendererComponent>> = Object.freeze({
module_catalog_collection: ModuleCatalogCollectionRenderer,
@ -44,7 +74,28 @@ export const collectionRenderers: Readonly<Record<string, CollectionRendererComp
point_category_index_collection: PointCategoryIndexCollectionRenderer,
ear_acupuncture_catalog_collection: EarAcupunctureCatalogCollectionRenderer,
ear_acupuncture_collection: EarAcupunctureCollectionRenderer,
disease_collection: DiseaseCollectionRenderer,
pathogenic_factors_collection: PathogenicFactorsCollectionRenderer,
tcm_pattern_list_collection: TcmPatternListCollectionRenderer,
four_levels_collection: FourLevelsCollectionRenderer,
pattern_collection: PatternCollectionRenderer,
eight_principles_collection: EightPrinciplesCollectionRenderer,
five_elements_collection: FiveElementsCollectionRenderer,
six_stages_collection: SixStagesCollectionRenderer,
three_burners_collection: ThreeBurnersCollectionRenderer,
twelve_channels_collection: TwelveChannelsCollectionRenderer,
twelve_channels_connecting_and_muscle_channel_collection: TwelveChannelsConnectingAndMuscleChannelCollectionRenderer,
extra_ordinary_vessel_collection: ExtraOrdinaryVesselCollectionRenderer,
deficiency_excess_patterns_collection: DeficiencyExcessPatternsCollectionRenderer,
yin_yang_collection: YinYangCollectionRenderer,
chinese_scalp_acupuncture_collection: ModuleCatalogCollectionRenderer,
nutrition_food_collection: ModuleCatalogCollectionRenderer,
nutrition_effect_collection: ModuleCatalogCollectionRenderer,
m0042_ct0001_collection: ModuleCatalogCollectionRenderer,
m0042_ct0002_collection: DiseaseCollectionRenderer,
m0042_ct0003_collection: DiseaseCollectionRenderer,
m0042_ct0004_collection: DiseaseCollectionRenderer,
m0042_ct0005_collection: DiseaseCollectionRenderer,
});
export const collectionItemRenderers: Readonly<Record<string, CollectionItemRendererComponent>> = Object.freeze({
module_catalog_card: ModuleCatalogCardRenderer,
@ -57,7 +108,28 @@ export const collectionItemRenderers: Readonly<Record<string, CollectionItemRend
point_category_index_card: PointCategoryIndexCardRenderer,
ear_acupuncture_catalog_card: EarAcupunctureCatalogCardRenderer,
ear_acupuncture_card: EarAcupunctureCardRenderer,
disease_card: DiseaseCardRenderer,
pathogenic_factors_card: PathogenicFactorsCardRenderer,
tcm_pattern_list_card: TcmPatternListCardRenderer,
four_levels_card: FourLevelsCardRenderer,
pattern_card: PatternCardRenderer,
eight_principles_card: EightPrinciplesCardRenderer,
five_elements_card: FiveElementsCardRenderer,
six_stages_card: SixStagesCardRenderer,
three_burners_card: ThreeBurnersCardRenderer,
twelve_channels_card: TwelveChannelsCardRenderer,
twelve_channels_connecting_and_muscle_channel_card: TwelveChannelsConnectingAndMuscleChannelCardRenderer,
extra_ordinary_vessel_card: ExtraOrdinaryVesselCardRenderer,
deficiency_excess_patterns_card: DeficiencyExcessPatternsCardRenderer,
yin_yang_card: YinYangCardRenderer,
chinese_scalp_acupuncture_card: ModuleCatalogCardRenderer,
nutrition_food_card: ModuleCatalogCardRenderer,
nutrition_effect_card: ModuleCatalogCardRenderer,
m0042_ct0001_card: ModuleCatalogCardRenderer,
m0042_ct0002_card: DiseaseCardRenderer,
m0042_ct0003_card: DiseaseCardRenderer,
m0042_ct0004_card: DiseaseCardRenderer,
m0042_ct0005_card: DiseaseCardRenderer,
});
export const detailRenderers: Readonly<Record<string, DetailRendererComponent>> = Object.freeze({
module_catalog_detail: IndexEntryDetailRenderer,
@ -87,6 +159,27 @@ export const detailRenderers: Readonly<Record<string, DetailRendererComponent>>
ear_acupuncture_catalog_detail: EarAcupunctureCatalogDetailRenderer,
ear_acupuncture_detail: EarAcupunctureDetailRenderer,
four_levels_detail: FourLevelsDetailRenderer,
pattern_detail: PatternDetailRenderer,
eight_principles_detail: EightPrinciplesDetailRenderer,
five_elements_detail: FiveElementsDetailRenderer,
six_stages_detail: SixStagesDetailRenderer,
three_burners_detail: ThreeBurnersDetailRenderer,
twelve_channels_detail: TwelveChannelsDetailRenderer,
twelve_channels_connecting_and_muscle_channel_detail: TwelveChannelsConnectingAndMuscleChannelDetailRenderer,
extra_ordinary_vessel_detail: ExtraOrdinaryVesselDetailRenderer,
deficiency_excess_patterns_detail: DeficiencyExcessPatternsDetailRenderer,
yin_yang_detail: YinYangDetailRenderer,
pathogenic_factors_detail: PathogenicFactorsDetailRenderer,
tcm_pattern_list_detail: TcmPatternDetailRenderer,
disease_detail: DiseaseDetailRenderer,
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,
m0042_ct0005_detail: PatternDetailRenderer,
});
function reportMissingRenderer(kind: string, code?: string | null) {
if (__DEV__) {

View File

@ -77,7 +77,7 @@ export function DetailPageShell({ children }: DetailPageShellProps) {
const styles = StyleSheet.create({
screen: {
flex: 1,
backgroundColor: "#F6F8F7",
backgroundColor: "#FFFFFF",
},
body: {
flex: 1,

View File

@ -1,5 +1,6 @@
import React from "react";
import { Image, StyleSheet, Text, View } from "react-native";
import { StyleSheet, Text, View } from "react-native";
import { Image } from "expo-image";
import { ContentMediaGallery } from "../../media/ContentMediaGallery";
import { useRelationalContentMedia } from "../../media/ContentMediaContext";
import { asString } from "../helpers/value";
@ -22,7 +23,7 @@ export function ImageGallery({ images }: { images: Record<string, unknown>[] })
return (
<View key={`${path}-${index}`} style={styles.item}>
<View style={styles.imageFrame}>
<Image source={{ uri: path }} resizeMode="contain" style={styles.image} />
<Image source={{ uri: path }} contentFit="contain" style={styles.image} />
</View>
{name ? <Text style={styles.caption}>{name}</Text> : null}
</View>

View File

@ -1,5 +1,6 @@
import React, { useMemo, useState } from "react";
import { Pressable, SafeAreaView, StyleSheet, View } from "react-native";
import { Pressable, StyleSheet, View } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
import { Ionicons } from "@expo/vector-icons";
import { router } from "expo-router";
@ -130,7 +131,7 @@ export function CollectionTemplateScreen({
);
return (
<SafeAreaView style={styles.screen}>
<SafeAreaView style={styles.screen} edges={["top", "left", "right"]}>
<ContentPageHeader
title={moduleDisplay.name}
onTitlePress={() => router.push(moduleDisplay.homeRoute as never)}
@ -221,7 +222,7 @@ export function CollectionTemplateScreen({
const styles = StyleSheet.create({
screen: {
flex: 1,
backgroundColor: "#F6F8F7",
backgroundColor: "#FFFFFF",
},
headerActions: {
flexDirection: "row",

View File

@ -1,10 +1,10 @@
import React from "react";
import {
Image,
Pressable,
StyleSheet,
View,
} from "react-native";
import { Image } from "expo-image";
import { Ionicons } from "@expo/vector-icons";
import {
moderateScale,
@ -28,6 +28,7 @@ export default function EditProfileAvatar({
<Image
source={{ uri: imageUri }}
style={styles.avatar}
contentFit="cover"
/>
) : (
<View style={styles.avatar}>

View File

@ -1,11 +1,11 @@
import React from "react";
import {
Image,
Pressable,
StyleSheet,
Text,
View,
} from "react-native";
import { Image } from "expo-image";
import { Ionicons } from "@expo/vector-icons";
import { useRouter } from "expo-router";
import {
@ -43,6 +43,7 @@ export default function ProfileAvatar({
<Image
source={{ uri: imageUri }}
style={styles.avatar}
contentFit="cover"
/>
) : (
<View style={styles.avatar}>

View File

@ -1,5 +1,5 @@
import React, { useEffect, useMemo, useState } from "react";
import { Pressable, StyleSheet, Text, TextInput, View } from "react-native";
import { Platform, Pressable, StyleSheet, Text, TextInput, View } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
import { Ionicons } from "@expo/vector-icons";
import { router } from "expo-router";
@ -325,13 +325,15 @@ export default function FacetedSearchScreen({
}
const styles = StyleSheet.create({
safe: { flex: 1, backgroundColor: Colors.surface },
safe: { flex: 1, backgroundColor: Colors.white },
header: {
height: 60,
minHeight: 64,
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
paddingHorizontal: 16,
paddingTop: Platform.OS === "web" ? 14 : 8,
paddingBottom: 8,
borderBottomWidth: 1,
borderBottomColor: "#ECECEC",
backgroundColor: Colors.white,

View File

@ -1,5 +1,6 @@
import React, { useCallback, useEffect, useMemo } from "react";
import {
Platform,
ScrollView,
StyleSheet,
Text,
@ -119,7 +120,7 @@ export default function ModulesIndexScreen() {
);
return (
<SafeAreaView style={styles.safeArea}>
<SafeAreaView style={styles.safeArea} edges={["top", "left", "right"]}>
<View style={styles.container}>
<View style={styles.header}>
<TouchableOpacity
@ -247,17 +248,20 @@ export default function ModulesIndexScreen() {
const styles = StyleSheet.create({
safeArea: {
flex: 1,
backgroundColor: Colors.background,
backgroundColor: "#FFFFFF",
},
container: {
flex: 1,
backgroundColor: Colors.background,
},
header: {
height: 60,
minHeight: 64,
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
paddingHorizontal: moderateScale(16),
paddingTop: Platform.OS === "web" ? 14 : moderateScale(8),
paddingBottom: moderateScale(8),
borderBottomWidth: 1,
borderBottomColor: "#ECECEC",
backgroundColor: "#FFFFFF",