按 stream-h 收束后台默认入口:实体与前台结果优先;shop/forum 概览标 secondaryEntry;payment 默认落到付费内容;users 将短信/微信后移。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
84 lines
2.2 KiB
JavaScript
84 lines
2.2 KiB
JavaScript
import { globalSection } from './global'
|
|
import { pageDisplaySection } from './page-display'
|
|
import { postListSection } from './post-list'
|
|
import { permissionsSection } from './permissions'
|
|
import { usersSection } from './users'
|
|
import { paymentSection } from './payment'
|
|
import { shopSection } from './shop'
|
|
import { forumSection } from './forum'
|
|
import { extensionsSection } from './extensions'
|
|
import { themeInfoSection } from './theme-info'
|
|
import { docsSection } from './docs'
|
|
import { toolsSection } from './tools'
|
|
|
|
const SECTION_DEFAULT_CHILDREN = {
|
|
global: 'global-common',
|
|
'page-display': 'page-display-header-nav',
|
|
'post-list': 'post-list-page',
|
|
permissions: 'permissions-comment',
|
|
users: 'users-auth',
|
|
payment: 'payment-paid',
|
|
shop: 'shop-products',
|
|
forum: 'forum-boards',
|
|
extensions: 'extensions-ip',
|
|
tools: 'tools-import-export',
|
|
'theme-info': 'theme-info-dashboard',
|
|
docs: 'docs-dashboard',
|
|
}
|
|
|
|
function attachSectionDefaultRoute(section) {
|
|
const defaultChildKey = SECTION_DEFAULT_CHILDREN[section.key]
|
|
const defaultChild = (section.children || []).find((child) => child.key === defaultChildKey)
|
|
|
|
if (!defaultChild) {
|
|
return section
|
|
}
|
|
|
|
return {
|
|
...section,
|
|
defaultRoute: defaultChild.route,
|
|
}
|
|
}
|
|
|
|
export const ADMIN_SECTIONS = [
|
|
attachSectionDefaultRoute(globalSection),
|
|
attachSectionDefaultRoute(pageDisplaySection),
|
|
attachSectionDefaultRoute(postListSection),
|
|
attachSectionDefaultRoute(permissionsSection),
|
|
attachSectionDefaultRoute(usersSection),
|
|
attachSectionDefaultRoute(paymentSection),
|
|
attachSectionDefaultRoute(shopSection),
|
|
attachSectionDefaultRoute(forumSection),
|
|
attachSectionDefaultRoute(extensionsSection),
|
|
attachSectionDefaultRoute(toolsSection),
|
|
attachSectionDefaultRoute(themeInfoSection),
|
|
attachSectionDefaultRoute(docsSection),
|
|
]
|
|
|
|
export function getAdminSections() {
|
|
return ADMIN_SECTIONS
|
|
}
|
|
|
|
export function getAllAdminPages() {
|
|
const pages = []
|
|
|
|
for (const section of ADMIN_SECTIONS) {
|
|
if (section.placeholder) {
|
|
pages.push({
|
|
sectionKey: section.key,
|
|
...section,
|
|
})
|
|
continue
|
|
}
|
|
|
|
for (const child of section.children || []) {
|
|
pages.push({
|
|
sectionKey: section.key,
|
|
...child,
|
|
})
|
|
}
|
|
}
|
|
|
|
return pages
|
|
}
|