fix app.json merge
This commit is contained in:
parent
354c3f48ae
commit
3990957f54
|
|
@ -32,6 +32,7 @@ yarn-error.*
|
||||||
|
|
||||||
# local env files
|
# local env files
|
||||||
.env*.local
|
.env*.local
|
||||||
|
.idea/
|
||||||
|
|
||||||
# typescript
|
# typescript
|
||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,8 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "expo start",
|
"start": "expo start",
|
||||||
"reset-project": "node ./scripts/reset-project.js",
|
"reset-project": "node ./scripts/reset-project.js",
|
||||||
"android": "expo start --android",
|
"android": "expo run:android",
|
||||||
"ios": "expo start --ios",
|
"ios": "expo run:ios",
|
||||||
"web": "expo start --web",
|
"web": "expo start --web",
|
||||||
"lint": "expo lint"
|
"lint": "expo lint"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ export interface ModuleSummary {
|
||||||
|
|
||||||
export interface ModuleResponse extends ModuleSummary {
|
export interface ModuleResponse extends ModuleSummary {
|
||||||
description: string | null;
|
description: string | null;
|
||||||
|
default_template_code: string | null;
|
||||||
thumbnail_media_asset_id: string | null;
|
thumbnail_media_asset_id: string | null;
|
||||||
status: ModuleStatus;
|
status: ModuleStatus;
|
||||||
is_active: boolean;
|
is_active: boolean;
|
||||||
|
|
|
||||||
|
|
@ -27,98 +27,97 @@ export interface ModuleIndexItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
const MODULE_VISUALS: Record<string, ModuleVisualConfig> = {
|
const MODULE_VISUALS: Record<string, ModuleVisualConfig> = {
|
||||||
M0001: {
|
m0001: {
|
||||||
icon: "water-outline",
|
icon: "water-outline",
|
||||||
color: "#2563EB",
|
color: "#2563EB",
|
||||||
isDefaultFree: true,
|
isDefaultFree: true,
|
||||||
planCode: "POINTS_ACU",
|
planCode: "POINTS_ACU",
|
||||||
entryTemplateCode: "M0001_CT0001",
|
|
||||||
},
|
},
|
||||||
M0002: {
|
m0002: {
|
||||||
icon: "ear-outline",
|
icon: "ear-outline",
|
||||||
color: "#F59E0B",
|
color: "#F59E0B",
|
||||||
isDefaultFree: false,
|
isDefaultFree: false,
|
||||||
planCode: "POINTS_EAR",
|
planCode: "POINTS_EAR",
|
||||||
},
|
},
|
||||||
M0003: {
|
m0003: {
|
||||||
icon: "accessibility-outline",
|
icon: "accessibility-outline",
|
||||||
color: "#EF4444",
|
color: "#EF4444",
|
||||||
isDefaultFree: false,
|
isDefaultFree: false,
|
||||||
planCode: "POINTS_SCALP",
|
planCode: "POINTS_SCALP",
|
||||||
},
|
},
|
||||||
M0011: {
|
m0011: {
|
||||||
icon: "git-network-outline",
|
icon: "git-network-outline",
|
||||||
color: "#7C3AED",
|
color: "#7C3AED",
|
||||||
isDefaultFree: true,
|
isDefaultFree: true,
|
||||||
planCode: "PATTERN_CORE",
|
planCode: "PATTERN_CORE",
|
||||||
},
|
},
|
||||||
M0012: {
|
m0012: {
|
||||||
icon: "pulse-outline",
|
icon: "pulse-outline",
|
||||||
color: "#06B6D4",
|
color: "#06B6D4",
|
||||||
isDefaultFree: false,
|
isDefaultFree: false,
|
||||||
planCode: "PATTERN_CORE",
|
planCode: "PATTERN_CORE",
|
||||||
},
|
},
|
||||||
M0013: {
|
m0013: {
|
||||||
icon: "water-outline",
|
icon: "water-outline",
|
||||||
color: "#3B82F6",
|
color: "#3B82F6",
|
||||||
isDefaultFree: false,
|
isDefaultFree: false,
|
||||||
planCode: "PATTERN_CORE",
|
planCode: "PATTERN_CORE",
|
||||||
},
|
},
|
||||||
M0014: {
|
m0014: {
|
||||||
icon: "flame-outline",
|
icon: "flame-outline",
|
||||||
color: "#F59E0B",
|
color: "#F59E0B",
|
||||||
isDefaultFree: false,
|
isDefaultFree: false,
|
||||||
planCode: "PATTERN_CORE",
|
planCode: "PATTERN_CORE",
|
||||||
},
|
},
|
||||||
M0015: {
|
m0015: {
|
||||||
icon: "layers-outline",
|
icon: "layers-outline",
|
||||||
color: "#10B981",
|
color: "#10B981",
|
||||||
isDefaultFree: false,
|
isDefaultFree: false,
|
||||||
planCode: "PATTERN_CORE",
|
planCode: "PATTERN_CORE",
|
||||||
},
|
},
|
||||||
M0016: {
|
m0016: {
|
||||||
icon: "trending-up-outline",
|
icon: "trending-up-outline",
|
||||||
color: "#EF4444",
|
color: "#EF4444",
|
||||||
isDefaultFree: false,
|
isDefaultFree: false,
|
||||||
planCode: "PATTERN_CORE",
|
planCode: "PATTERN_CORE",
|
||||||
},
|
},
|
||||||
M0017: {
|
m0017: {
|
||||||
icon: "thermometer-outline",
|
icon: "thermometer-outline",
|
||||||
color: "#EC4899",
|
color: "#EC4899",
|
||||||
isDefaultFree: false,
|
isDefaultFree: false,
|
||||||
planCode: "PATTERN_CORE",
|
planCode: "PATTERN_CORE",
|
||||||
},
|
},
|
||||||
M0018: {
|
m0018: {
|
||||||
icon: "pulse-outline",
|
icon: "pulse-outline",
|
||||||
color: "#06B6D4",
|
color: "#06B6D4",
|
||||||
isDefaultFree: false,
|
isDefaultFree: false,
|
||||||
planCode: "PATTERN_CORE",
|
planCode: "PATTERN_CORE",
|
||||||
},
|
},
|
||||||
M0019: {
|
m0019: {
|
||||||
icon: "flower-outline",
|
icon: "flower-outline",
|
||||||
color: "#6366F1",
|
color: "#6366F1",
|
||||||
isDefaultFree: false,
|
isDefaultFree: false,
|
||||||
planCode: "PATTERN_CORE",
|
planCode: "PATTERN_CORE",
|
||||||
},
|
},
|
||||||
M0020: {
|
m0020: {
|
||||||
icon: "git-branch-outline",
|
icon: "git-branch-outline",
|
||||||
color: "#8B5CF6",
|
color: "#8B5CF6",
|
||||||
isDefaultFree: false,
|
isDefaultFree: false,
|
||||||
planCode: "POINTS_ACU",
|
planCode: "POINTS_ACU",
|
||||||
},
|
},
|
||||||
M0031: {
|
m0031: {
|
||||||
icon: "nutrition-outline",
|
icon: "nutrition-outline",
|
||||||
color: "#10B981",
|
color: "#10B981",
|
||||||
isDefaultFree: true,
|
isDefaultFree: true,
|
||||||
planCode: "NUTRITION_CORE",
|
planCode: "NUTRITION_CORE",
|
||||||
},
|
},
|
||||||
M0041: {
|
m0041: {
|
||||||
icon: "body-outline",
|
icon: "body-outline",
|
||||||
color: "#8B5CF6",
|
color: "#8B5CF6",
|
||||||
isDefaultFree: false,
|
isDefaultFree: false,
|
||||||
planCode: "LIFETIME_ALL",
|
planCode: "LIFETIME_ALL",
|
||||||
},
|
},
|
||||||
M0042: {
|
m0042: {
|
||||||
icon: "woman-outline",
|
icon: "woman-outline",
|
||||||
color: "#EC4899",
|
color: "#EC4899",
|
||||||
isDefaultFree: false,
|
isDefaultFree: false,
|
||||||
|
|
@ -177,18 +176,12 @@ export function resolveModuleCategory(module: ModuleResponse): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function resolveModuleEntryTemplateCode(module: ModuleResponse): string {
|
export function resolveModuleEntryTemplateCode(module: ModuleResponse): string {
|
||||||
const configured = MODULE_VISUALS[module.code]?.entryTemplateCode;
|
const defaultTemplateCode = asNonBlankString(module.default_template_code);
|
||||||
const metadataConfigured =
|
if (defaultTemplateCode) return defaultTemplateCode.toLowerCase();
|
||||||
readMetadataString(module, "entry_template_code") ??
|
|
||||||
readMetadataString(module, "index_template_code") ??
|
|
||||||
readMetadataString(module, "root_template_code");
|
|
||||||
|
|
||||||
if (metadataConfigured) return metadataConfigured;
|
// Defensive fallback for modules not yet reseeded with default_template_code.
|
||||||
if (configured) return configured;
|
// Canonical module/template identities are lowercase.
|
||||||
|
return `${module.code.toLowerCase()}_ct0001`;
|
||||||
// Canonical convention used by seeded modules: the module entry/index
|
|
||||||
// template is CT0001 unless explicitly overridden in module metadata.
|
|
||||||
return `${module.code}_CT0001`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function buildModuleTemplateReference(module: ModuleResponse): TemplateReference {
|
export function buildModuleTemplateReference(module: ModuleResponse): TemplateReference {
|
||||||
|
|
@ -203,7 +196,7 @@ export function buildModuleTemplateReference(module: ModuleResponse): TemplateRe
|
||||||
}
|
}
|
||||||
|
|
||||||
export function toModuleIndexItem(module: ModuleResponse): ModuleIndexItem {
|
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 metadataIcon = readMetadataString(module, "icon");
|
||||||
const metadataColor = readMetadataString(module, "color");
|
const metadataColor = readMetadataString(module, "color");
|
||||||
const metadataPlanCode = readMetadataString(module, "plan_code");
|
const metadataPlanCode = readMetadataString(module, "plan_code");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue