fix app.json merge
This commit is contained in:
parent
354c3f48ae
commit
3990957f54
|
|
@ -32,6 +32,7 @@ yarn-error.*
|
|||
|
||||
# local env files
|
||||
.env*.local
|
||||
.idea/
|
||||
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -27,98 +27,97 @@ export interface ModuleIndexItem {
|
|||
}
|
||||
|
||||
const MODULE_VISUALS: Record<string, ModuleVisualConfig> = {
|
||||
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");
|
||||
|
|
|
|||
Loading…
Reference in New Issue