nav: 全量 world-catalog + status active/planned 分层
- world-catalog.js: 6洲48国127城市全量 NavNode catalog - 统一 schema(isEnabled → status: active|planned) - 64 个 NavNode 覆盖所有洲/国家/地区 - runtime-nav.js: 从 catalog 自动过滤 active 节点 - MVP_OVERRIDES 机制跳过国家层直连城市 - V1.1+ 删除覆写即恢复完整层级 - 删除 future-catalog.js,旧 shim 指向 world-catalog - game-design 2.3 更新 schema + Framework Ready 说明 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,110 +1,42 @@
|
||||
/**
|
||||
* Runtime Navigation — MVP
|
||||
* Runtime Navigation — 从 world-catalog 自动生成
|
||||
*
|
||||
* 只包含当前版本已启用、childIds 均指向已存在实体的节点。
|
||||
* MVP 导航:直入亚洲城市页,6 城市平铺。
|
||||
* V1.1+ 启用完整洲→国家→地区→城市多级导航时,在此文件追加节点。
|
||||
* 只包含 status === 'active' 的节点。
|
||||
* MVP 阶段手动覆写亚洲的 childType 为 'city'(跳过国家层),
|
||||
* V1.1+ 切换为 catalog 默认的 'country'。
|
||||
*/
|
||||
|
||||
export const runtimeNavNodes = [
|
||||
// ── MVP: 只有 1 个洲,直接列出 6 城市 ──
|
||||
{
|
||||
type: 'continent',
|
||||
id: 'asia',
|
||||
parentId: null,
|
||||
name: '亚洲',
|
||||
nameEn: 'Asia',
|
||||
sortOrder: 1,
|
||||
themeColor: '#FF6B6B',
|
||||
childType: 'city', // MVP: 直接指向城市,跳过国家层
|
||||
import { worldCatalog } from './world-catalog.js'
|
||||
|
||||
// MVP 覆写:亚洲直接指向城市,不经过国家层
|
||||
const MVP_OVERRIDES = {
|
||||
asia: {
|
||||
childType: 'city',
|
||||
childIds: ['beijing', 'tokyo', 'bangkok', 'seoul', 'singapore', 'istanbul'],
|
||||
pageSize: 9,
|
||||
isEnabled: true,
|
||||
isUnlockedByDefault: true,
|
||||
},
|
||||
}
|
||||
|
||||
// ── 未启用的洲(占位,UI 显示锁定态) ──
|
||||
{
|
||||
type: 'continent',
|
||||
id: 'europe',
|
||||
parentId: null,
|
||||
name: '欧洲',
|
||||
nameEn: 'Europe',
|
||||
sortOrder: 2,
|
||||
themeColor: '#6B8CFF',
|
||||
childType: 'country',
|
||||
childIds: [], // 无可消费子节点
|
||||
pageSize: 9,
|
||||
isEnabled: false,
|
||||
isUnlockedByDefault: false,
|
||||
},
|
||||
{
|
||||
type: 'continent',
|
||||
id: 'north_america',
|
||||
parentId: null,
|
||||
name: '北美洲',
|
||||
nameEn: 'North America',
|
||||
sortOrder: 3,
|
||||
themeColor: '#FFB347',
|
||||
childType: 'country',
|
||||
childIds: [],
|
||||
pageSize: 9,
|
||||
isEnabled: false,
|
||||
isUnlockedByDefault: false,
|
||||
},
|
||||
{
|
||||
type: 'continent',
|
||||
id: 'south_america',
|
||||
parentId: null,
|
||||
name: '南美洲',
|
||||
nameEn: 'South America',
|
||||
sortOrder: 4,
|
||||
themeColor: '#4ECDC4',
|
||||
childType: 'country',
|
||||
childIds: [],
|
||||
pageSize: 9,
|
||||
isEnabled: false,
|
||||
isUnlockedByDefault: false,
|
||||
},
|
||||
{
|
||||
type: 'continent',
|
||||
id: 'africa',
|
||||
parentId: null,
|
||||
name: '非洲',
|
||||
nameEn: 'Africa',
|
||||
sortOrder: 5,
|
||||
themeColor: '#F7DC6F',
|
||||
childType: 'country',
|
||||
childIds: [],
|
||||
pageSize: 9,
|
||||
isEnabled: false,
|
||||
isUnlockedByDefault: false,
|
||||
},
|
||||
{
|
||||
type: 'continent',
|
||||
id: 'oceania',
|
||||
parentId: null,
|
||||
name: '大洋洲',
|
||||
nameEn: 'Oceania',
|
||||
sortOrder: 6,
|
||||
themeColor: '#82E0AA',
|
||||
childType: 'country',
|
||||
childIds: [],
|
||||
pageSize: 9,
|
||||
isEnabled: false,
|
||||
isUnlockedByDefault: false,
|
||||
},
|
||||
]
|
||||
function buildRuntimeNav() {
|
||||
const activeNodes = worldCatalog.filter(n => n.status === 'active')
|
||||
return activeNodes.map(node => {
|
||||
const override = MVP_OVERRIDES[node.id]
|
||||
if (override) {
|
||||
return { ...node, ...override }
|
||||
}
|
||||
return { ...node }
|
||||
})
|
||||
}
|
||||
|
||||
export const runtimeNavNodes = buildRuntimeNav()
|
||||
|
||||
// ── 便捷查询 ──
|
||||
export function getNavNode(id) {
|
||||
return runtimeNavNodes.find(n => n.id === id) || null
|
||||
}
|
||||
|
||||
export function getEnabledRoots() {
|
||||
return runtimeNavNodes.filter(n => n.parentId === null && n.isEnabled)
|
||||
return runtimeNavNodes.filter(n => n.parentId === null)
|
||||
}
|
||||
|
||||
export function getChildren(parentId) {
|
||||
return runtimeNavNodes.filter(n => n.parentId === parentId && n.isEnabled)
|
||||
return runtimeNavNodes.filter(n => n.parentId === parentId)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user