const { cloneList, resolveKind } = require('./shared') const { ROUTES } = require('./route-map') const TCM_HOME_HUB_CARDS = Object.freeze([ { key: 'tcm-library', title: '中医馆', subtitle: '典籍与目录', route: ROUTES.tabs.library, badge: 'TCM' }, { key: 'mingli-hall', title: '易学阁', subtitle: '命理与经典', route: ROUTES.mingli.hall, badge: 'NEW' }, { key: 'bazi', title: '八字排盘', subtitle: '静态排盘结果', route: ROUTES.mingli.bazi, badge: 'BETA' }, { key: 'learning-center', title: '学习中心', subtitle: '继续学习与回顾', route: ROUTES.learning.center, badge: 'GO' } ]) const TCM_ASSET_SURFACES = Object.freeze({ notes: { title: '学习资产', activeKind: 'notes', kinds: ['notes', 'bookshelf', 'favorites', 'history'] }, bookshelf: { title: '学习资产', activeKind: 'bookshelf', kinds: ['notes', 'bookshelf', 'favorites', 'history'] }, favorites: { title: '学习资产', activeKind: 'favorites', kinds: ['notes', 'bookshelf', 'favorites', 'history'] }, history: { title: '学习资产', activeKind: 'history', kinds: ['notes', 'bookshelf', 'favorites', 'history'] } }) function createTcmHomeHubCards() { return cloneList(TCM_HOME_HUB_CARDS) } function createTcmAssetPageData(rawKind) { const activeKind = resolveKind(rawKind, ['notes', 'bookshelf', 'favorites', 'history'], 'notes') return { ...TCM_ASSET_SURFACES[activeKind], cards: createTcmHomeHubCards() } } module.exports = { createTcmHomeHubCards, createTcmAssetPageData }