From 3990957f54bf417d0079a8e6432984e01be44e65 Mon Sep 17 00:00:00 2001 From: Amit Salunke Date: Mon, 21 Sep 2026 07:50:53 +0530 Subject: [PATCH] fix app.json merge --- .gitignore | 1 + package.json | 4 +- src/features/content/types/content.types.ts | 1 + src/features/modules/module-index.ts | 51 +++++++++------------ 4 files changed, 26 insertions(+), 31 deletions(-) diff --git a/.gitignore b/.gitignore index 72b51c6..068a392 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ yarn-error.* # local env files .env*.local +.idea/ # typescript *.tsbuildinfo diff --git a/package.json b/package.json index 199db92..e09c599 100644 --- a/package.json +++ b/package.json @@ -45,8 +45,8 @@ "scripts": { "start": "expo start", "reset-project": "node ./scripts/reset-project.js", - "android": "expo start --android", - "ios": "expo start --ios", + "android": "expo run:android", + "ios": "expo run:ios", "web": "expo start --web", "lint": "expo lint" }, diff --git a/src/features/content/types/content.types.ts b/src/features/content/types/content.types.ts index 70b3f65..44f0d72 100644 --- a/src/features/content/types/content.types.ts +++ b/src/features/content/types/content.types.ts @@ -22,6 +22,7 @@ export interface ModuleSummary { export interface ModuleResponse extends ModuleSummary { description: string | null; + default_template_code: string | null; thumbnail_media_asset_id: string | null; status: ModuleStatus; is_active: boolean; diff --git a/src/features/modules/module-index.ts b/src/features/modules/module-index.ts index c51df0d..8b52d1d 100644 --- a/src/features/modules/module-index.ts +++ b/src/features/modules/module-index.ts @@ -27,98 +27,97 @@ export interface ModuleIndexItem { } const MODULE_VISUALS: Record = { - M0001: { + m0001: { icon: "water-outline", color: "#2563EB", isDefaultFree: true, planCode: "POINTS_ACU", - entryTemplateCode: "M0001_CT0001", }, - M0002: { + m0002: { icon: "ear-outline", color: "#F59E0B", isDefaultFree: false, planCode: "POINTS_EAR", }, - M0003: { + m0003: { icon: "accessibility-outline", color: "#EF4444", isDefaultFree: false, planCode: "POINTS_SCALP", }, - M0011: { + m0011: { icon: "git-network-outline", color: "#7C3AED", isDefaultFree: true, planCode: "PATTERN_CORE", }, - M0012: { + m0012: { icon: "pulse-outline", color: "#06B6D4", isDefaultFree: false, planCode: "PATTERN_CORE", }, - M0013: { + m0013: { icon: "water-outline", color: "#3B82F6", isDefaultFree: false, planCode: "PATTERN_CORE", }, - M0014: { + m0014: { icon: "flame-outline", color: "#F59E0B", isDefaultFree: false, planCode: "PATTERN_CORE", }, - M0015: { + m0015: { icon: "layers-outline", color: "#10B981", isDefaultFree: false, planCode: "PATTERN_CORE", }, - M0016: { + m0016: { icon: "trending-up-outline", color: "#EF4444", isDefaultFree: false, planCode: "PATTERN_CORE", }, - M0017: { + m0017: { icon: "thermometer-outline", color: "#EC4899", isDefaultFree: false, planCode: "PATTERN_CORE", }, - M0018: { + m0018: { icon: "pulse-outline", color: "#06B6D4", isDefaultFree: false, planCode: "PATTERN_CORE", }, - M0019: { + m0019: { icon: "flower-outline", color: "#6366F1", isDefaultFree: false, planCode: "PATTERN_CORE", }, - M0020: { + m0020: { icon: "git-branch-outline", color: "#8B5CF6", isDefaultFree: false, planCode: "POINTS_ACU", }, - M0031: { + m0031: { icon: "nutrition-outline", color: "#10B981", isDefaultFree: true, planCode: "NUTRITION_CORE", }, - M0041: { + m0041: { icon: "body-outline", color: "#8B5CF6", isDefaultFree: false, planCode: "LIFETIME_ALL", }, - M0042: { + m0042: { icon: "woman-outline", color: "#EC4899", isDefaultFree: false, @@ -177,18 +176,12 @@ export function resolveModuleCategory(module: ModuleResponse): string { } export function resolveModuleEntryTemplateCode(module: ModuleResponse): string { - const configured = MODULE_VISUALS[module.code]?.entryTemplateCode; - const metadataConfigured = - readMetadataString(module, "entry_template_code") ?? - readMetadataString(module, "index_template_code") ?? - readMetadataString(module, "root_template_code"); + const defaultTemplateCode = asNonBlankString(module.default_template_code); + if (defaultTemplateCode) return defaultTemplateCode.toLowerCase(); - if (metadataConfigured) return metadataConfigured; - if (configured) return configured; - - // Canonical convention used by seeded modules: the module entry/index - // template is CT0001 unless explicitly overridden in module metadata. - return `${module.code}_CT0001`; + // Defensive fallback for modules not yet reseeded with default_template_code. + // Canonical module/template identities are lowercase. + return `${module.code.toLowerCase()}_ct0001`; } export function buildModuleTemplateReference(module: ModuleResponse): TemplateReference { @@ -203,7 +196,7 @@ export function buildModuleTemplateReference(module: ModuleResponse): TemplateRe } export function toModuleIndexItem(module: ModuleResponse): ModuleIndexItem { - const visual = MODULE_VISUALS[module.code]; + const visual = MODULE_VISUALS[module.code.toLowerCase()]; const metadataIcon = readMetadataString(module, "icon"); const metadataColor = readMetadataString(module, "color"); const metadataPlanCode = readMetadataString(module, "plan_code");