feat(admin): redesign navigation with grouped secondary sidebar
Replace flat tabs with categorized navigation groups (Content, Config, etc.). Update layout styles to support a responsive secondary sidebar.
This commit is contained in:
@@ -619,6 +619,11 @@ API 暴露边界:
|
|||||||
- UI 风格以 `DesignGuidelines.html` 为准。
|
- UI 风格以 `DesignGuidelines.html` 为准。
|
||||||
- 页面结构以 `AppShell`、`PageHeader`、列表、详情区和管理区为核心。
|
- 页面结构以 `AppShell`、`PageHeader`、列表、详情区和管理区为核心。
|
||||||
- 全局主导航使用 `AppShell` 侧边栏;移动端通过导航按钮打开侧边栏抽屉。
|
- 全局主导航使用 `AppShell` 侧边栏;移动端通过导航按钮打开侧边栏抽屉。
|
||||||
|
- 管理入口在全局侧边栏中保持单一 Admin 入口,`/admin` 内部使用页面内二级菜单分组组织管理模块:
|
||||||
|
- 配置:System config。
|
||||||
|
- 内容:Daily CheckList、Pokemon、物品、材料单和栖息地的维护、排序或删除入口。
|
||||||
|
- 本地化:Languages、System wordings。
|
||||||
|
- 访问权限:Users、Roles、Permissions。
|
||||||
- 登录用户的侧边栏账号入口进入 `/profile`;User Profile 属于账号入口,不作为 Wiki 主内容导航项。
|
- 登录用户的侧边栏账号入口进入 `/profile`;User Profile 属于账号入口,不作为 Wiki 主内容导航项。
|
||||||
- 页面级分类、筛选或辅助内容切换使用 Tabs,避免在内容页继续增加侧边栏。
|
- 页面级分类、筛选或辅助内容切换使用 Tabs,避免在内容页继续增加侧边栏。
|
||||||
- 导航和主要操作使用图标增强识别。
|
- 导航和主要操作使用图标增强识别。
|
||||||
|
|||||||
@@ -4459,11 +4459,102 @@ button:disabled,
|
|||||||
|
|
||||||
.admin-layout {
|
.admin-layout {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
|
grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
align-items: start;
|
align-items: start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.admin-layout--loading {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-secondary-nav {
|
||||||
|
position: sticky;
|
||||||
|
top: 18px;
|
||||||
|
display: grid;
|
||||||
|
align-content: start;
|
||||||
|
gap: 14px;
|
||||||
|
min-width: 0;
|
||||||
|
padding: 12px;
|
||||||
|
border: 2px solid var(--line-strong);
|
||||||
|
border-radius: var(--radius-card);
|
||||||
|
background: var(--surface);
|
||||||
|
box-shadow: var(--shadow-soft);
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-secondary-nav__group {
|
||||||
|
display: grid;
|
||||||
|
gap: 6px;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-secondary-nav__group + .admin-secondary-nav__group {
|
||||||
|
padding-top: 12px;
|
||||||
|
border-top: 1px solid var(--line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-secondary-nav__title {
|
||||||
|
padding: 0 4px;
|
||||||
|
color: var(--muted);
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 900;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-secondary-nav__items {
|
||||||
|
display: grid;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-secondary-nav__item {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 44px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-start;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 9px 10px;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-radius: var(--radius-control);
|
||||||
|
background: transparent;
|
||||||
|
color: var(--ink-soft);
|
||||||
|
font-weight: 850;
|
||||||
|
line-height: 1.2;
|
||||||
|
text-align: left;
|
||||||
|
cursor: pointer;
|
||||||
|
transition:
|
||||||
|
background 0.14s ease,
|
||||||
|
border-color 0.14s ease,
|
||||||
|
color 0.14s ease,
|
||||||
|
box-shadow 0.14s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-secondary-nav__item:hover {
|
||||||
|
border-color: rgba(42, 117, 187, 0.24);
|
||||||
|
background: rgba(255, 203, 5, 0.2);
|
||||||
|
color: var(--pokemon-blue-deep);
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-secondary-nav__item.active {
|
||||||
|
border-color: var(--line-strong);
|
||||||
|
background: var(--pokemon-blue);
|
||||||
|
color: #ffffff;
|
||||||
|
box-shadow: 0 2px 0 var(--line-strong);
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-secondary-nav__item span {
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-secondary-nav__icon {
|
||||||
|
width: 19px;
|
||||||
|
height: 19px;
|
||||||
|
flex: 0 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-content {
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.form-actions,
|
.form-actions,
|
||||||
.row-actions,
|
.row-actions,
|
||||||
.check-row,
|
.check-row,
|
||||||
@@ -4802,6 +4893,26 @@ button:disabled,
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.admin-secondary-nav {
|
||||||
|
position: static;
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
overflow-x: auto;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-secondary-nav__group {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
min-width: min(260px, 76vw);
|
||||||
|
}
|
||||||
|
|
||||||
|
.admin-secondary-nav__group + .admin-secondary-nav__group {
|
||||||
|
padding-top: 0;
|
||||||
|
padding-left: 12px;
|
||||||
|
border-top: 0;
|
||||||
|
border-left: 1px solid var(--line);
|
||||||
|
}
|
||||||
|
|
||||||
.coming-soon-panel {
|
.coming-soon-panel {
|
||||||
grid-template-columns: auto minmax(0, 1fr);
|
grid-template-columns: auto minmax(0, 1fr);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,9 @@ type AdminTab =
|
|||||||
| 'items'
|
| 'items'
|
||||||
| 'recipes'
|
| 'recipes'
|
||||||
| 'habitats';
|
| 'habitats';
|
||||||
|
type AdminGroup = 'content' | 'configuration' | 'localization' | 'access';
|
||||||
|
type AdminNavItem = { key: AdminTab; label: string; permission: string | string[] };
|
||||||
|
type AdminNavGroup = { key: AdminGroup; label: string; items: AdminNavItem[] };
|
||||||
type EditableConfig = (NamedEntity | Skill) & { hasItemDrop?: boolean };
|
type EditableConfig = (NamedEntity | Skill) & { hasItemDrop?: boolean };
|
||||||
|
|
||||||
const adminTabIcons: Record<AdminTab, AppIcon> = {
|
const adminTabIcons: Record<AdminTab, AppIcon> = {
|
||||||
@@ -79,21 +82,48 @@ const adminTabIcons: Record<AdminTab, AppIcon> = {
|
|||||||
|
|
||||||
const { locale, t } = useI18n();
|
const { locale, t } = useI18n();
|
||||||
|
|
||||||
const tabs = computed<Array<{ key: AdminTab; label: string; permission: string | string[] }>>(() =>
|
const adminNavigationGroups = computed<AdminNavGroup[]>(() => {
|
||||||
[
|
const groups: AdminNavGroup[] = [
|
||||||
{ key: 'users' as const, label: t('pages.admin.users'), permission: 'admin.users.read' },
|
{
|
||||||
{ key: 'roles' as const, label: t('pages.admin.roles'), permission: 'admin.roles.read' },
|
key: 'configuration',
|
||||||
{ key: 'permissions' as const, label: t('pages.admin.permissions'), permission: 'admin.permissions.read' },
|
label: t('pages.admin.configurationGroup'),
|
||||||
{ key: 'config' as const, label: t('pages.admin.config'), permission: 'admin.config.read' },
|
items: [{ key: 'config', label: t('pages.admin.config'), permission: 'admin.config.read' }]
|
||||||
{ key: 'languages' as const, label: t('pages.admin.languages'), permission: 'admin.languages.read' },
|
},
|
||||||
{ key: 'wordings' as const, label: t('pages.admin.wordings'), permission: 'admin.wordings.read' },
|
{
|
||||||
{ key: 'checklist' as const, label: t('pages.admin.checklist'), permission: ['checklist.create', 'checklist.update', 'checklist.delete', 'checklist.order'] },
|
key: 'content',
|
||||||
{ key: 'pokemon' as const, label: 'Pokemon', permission: ['pokemon.order', 'pokemon.delete'] },
|
label: t('pages.admin.contentGroup'),
|
||||||
{ key: 'items' as const, label: t('pages.items.title'), permission: ['items.order', 'items.delete'] },
|
items: [
|
||||||
{ key: 'recipes' as const, label: t('pages.recipes.title'), permission: ['recipes.order', 'recipes.delete'] },
|
{ key: 'checklist', label: t('pages.admin.checklist'), permission: ['checklist.create', 'checklist.update', 'checklist.delete', 'checklist.order'] },
|
||||||
{ key: 'habitats' as const, label: t('pages.habitats.title'), permission: ['habitats.order', 'habitats.delete'] }
|
{ key: 'pokemon', label: t('pages.admin.pokemonList'), permission: ['pokemon.order', 'pokemon.delete'] },
|
||||||
].filter((tab) => canAny(tab.permission))
|
{ key: 'items', label: t('pages.admin.itemList'), permission: ['items.order', 'items.delete'] },
|
||||||
);
|
{ key: 'recipes', label: t('pages.admin.recipeList'), permission: ['recipes.order', 'recipes.delete'] },
|
||||||
|
{ key: 'habitats', label: t('pages.admin.habitatList'), permission: ['habitats.order', 'habitats.delete'] }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'localization',
|
||||||
|
label: t('pages.admin.localizationGroup'),
|
||||||
|
items: [
|
||||||
|
{ key: 'languages', label: t('pages.admin.languages'), permission: 'admin.languages.read' },
|
||||||
|
{ key: 'wordings', label: t('pages.admin.wordings'), permission: 'admin.wordings.read' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'access',
|
||||||
|
label: t('pages.admin.accessGroup'),
|
||||||
|
items: [
|
||||||
|
{ key: 'users', label: t('pages.admin.users'), permission: 'admin.users.read' },
|
||||||
|
{ key: 'roles', label: t('pages.admin.roles'), permission: 'admin.roles.read' },
|
||||||
|
{ key: 'permissions', label: t('pages.admin.permissions'), permission: 'admin.permissions.read' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
return groups
|
||||||
|
.map((group) => ({ ...group, items: group.items.filter((tab) => canAny(tab.permission)) }))
|
||||||
|
.filter((group) => group.items.length);
|
||||||
|
});
|
||||||
|
const tabs = computed<AdminNavItem[]>(() => adminNavigationGroups.value.flatMap((group) => group.items));
|
||||||
|
|
||||||
const configTypes = computed<Array<{ key: ConfigType; label: string; supportsItemDrop?: boolean }>>(() => [
|
const configTypes = computed<Array<{ key: ConfigType; label: string; supportsItemDrop?: boolean }>>(() => [
|
||||||
{ key: 'pokemon-types', label: t('config.pokemonTypes') },
|
{ key: 'pokemon-types', label: t('config.pokemonTypes') },
|
||||||
@@ -971,29 +1001,44 @@ onMounted(() => {
|
|||||||
<template>
|
<template>
|
||||||
<section class="page-stack">
|
<section class="page-stack">
|
||||||
<PageHeader :title="t('pages.admin.title')" :subtitle="t('pages.admin.subtitle')">
|
<PageHeader :title="t('pages.admin.title')" :subtitle="t('pages.admin.subtitle')">
|
||||||
<template #kicker>Admin</template>
|
<template #kicker>{{ t('nav.admin') }}</template>
|
||||||
</PageHeader>
|
</PageHeader>
|
||||||
|
|
||||||
<div v-if="canEdit" class="tabs" role="tablist" :aria-label="t('pages.admin.modules')">
|
|
||||||
<button v-for="tab in tabs" :key="tab.key" :class="{ active: activeTab === tab.key }" type="button" @click="setTab(tab.key)">
|
|
||||||
<Icon :icon="adminTabIcons[tab.key]" class="ui-icon" aria-hidden="true" />
|
|
||||||
{{ tab.label }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<StatusMessage v-if="message" variant="warning">{{ message }}</StatusMessage>
|
<StatusMessage v-if="message" variant="warning">{{ message }}</StatusMessage>
|
||||||
|
|
||||||
<section v-if="showAdminSkeleton" class="detail-section skeleton-detail-section" aria-busy="true" :aria-label="t('pages.admin.loading')">
|
<div v-if="canEdit || showAdminSkeleton" class="admin-layout" :class="{ 'admin-layout--loading': !canEdit }">
|
||||||
<h2><Skeleton width="120px" height="24px" /></h2>
|
<nav v-if="canEdit" class="admin-secondary-nav" :aria-label="t('pages.admin.modules')">
|
||||||
<ul class="row-list skeleton-row-list">
|
<div v-for="group in adminNavigationGroups" :key="group.key" class="admin-secondary-nav__group">
|
||||||
<li v-for="index in 6" :key="index">
|
<span class="admin-secondary-nav__title">{{ group.label }}</span>
|
||||||
<Skeleton :width="index % 2 === 0 ? '180px' : '132px'" />
|
<div class="admin-secondary-nav__items">
|
||||||
<span class="row-actions">
|
<button
|
||||||
<Skeleton variant="box" width="50px" height="34px" />
|
v-for="tab in group.items"
|
||||||
</span>
|
:key="tab.key"
|
||||||
</li>
|
class="admin-secondary-nav__item"
|
||||||
</ul>
|
:class="{ active: activeTab === tab.key }"
|
||||||
</section>
|
type="button"
|
||||||
|
:aria-current="activeTab === tab.key ? 'page' : undefined"
|
||||||
|
@click="setTab(tab.key)"
|
||||||
|
>
|
||||||
|
<Icon :icon="adminTabIcons[tab.key]" class="ui-icon admin-secondary-nav__icon" aria-hidden="true" />
|
||||||
|
<span>{{ tab.label }}</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="admin-content">
|
||||||
|
<section v-if="showAdminSkeleton" class="detail-section skeleton-detail-section" aria-busy="true" :aria-label="t('pages.admin.loading')">
|
||||||
|
<h2><Skeleton width="120px" height="24px" /></h2>
|
||||||
|
<ul class="row-list skeleton-row-list">
|
||||||
|
<li v-for="index in 6" :key="index">
|
||||||
|
<Skeleton :width="index % 2 === 0 ? '180px' : '132px'" />
|
||||||
|
<span class="row-actions">
|
||||||
|
<Skeleton variant="box" width="50px" height="34px" />
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section v-else-if="canEdit && activeTab === 'users'" class="detail-section">
|
<section v-else-if="canEdit && activeTab === 'users'" class="detail-section">
|
||||||
<div class="detail-section__header">
|
<div class="detail-section__header">
|
||||||
@@ -1401,6 +1446,8 @@ onMounted(() => {
|
|||||||
</ReorderableList>
|
</ReorderableList>
|
||||||
<p v-else class="meta-line">{{ t('common.noRecords') }}</p>
|
<p v-else class="meta-line">{{ t('common.noRecords') }}</p>
|
||||||
</section>
|
</section>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<Modal v-if="userRoleModalOpen" :title="userRoleModalTitle" :close-label="t('common.close')" size="wide" @close="closeUserRoleModal">
|
<Modal v-if="userRoleModalOpen" :title="userRoleModalTitle" :close-label="t('common.close')" size="wide" @close="closeUserRoleModal">
|
||||||
<form id="admin-user-roles-form" class="modal-edit-form" @submit.prevent="saveUserRoles">
|
<form id="admin-user-roles-form" class="modal-edit-form" @submit.prevent="saveUserRoles">
|
||||||
|
|||||||
@@ -443,8 +443,12 @@ export const systemWordingMessages = {
|
|||||||
},
|
},
|
||||||
admin: {
|
admin: {
|
||||||
title: 'Admin',
|
title: 'Admin',
|
||||||
subtitle: 'Maintain system configuration and manage Wiki records.',
|
subtitle: 'Manage Wiki content, configuration, localization, and access.',
|
||||||
modules: 'Admin modules',
|
modules: 'Admin modules',
|
||||||
|
contentGroup: 'Content',
|
||||||
|
configurationGroup: 'Configuration',
|
||||||
|
localizationGroup: 'Localization',
|
||||||
|
accessGroup: 'Access',
|
||||||
loading: 'Loading admin list',
|
loading: 'Loading admin list',
|
||||||
users: 'Users',
|
users: 'Users',
|
||||||
roles: 'Roles',
|
roles: 'Roles',
|
||||||
@@ -1147,8 +1151,12 @@ export const systemWordingMessages = {
|
|||||||
},
|
},
|
||||||
admin: {
|
admin: {
|
||||||
title: '管理',
|
title: '管理',
|
||||||
subtitle: '维护系统配置,查看并删除 Wiki 数据记录。',
|
subtitle: '管理 Wiki 内容、配置、本地化和访问权限。',
|
||||||
modules: '管理模块',
|
modules: '管理模块',
|
||||||
|
contentGroup: '内容',
|
||||||
|
configurationGroup: '配置',
|
||||||
|
localizationGroup: '本地化',
|
||||||
|
accessGroup: '访问权限',
|
||||||
loading: '正在加载管理列表',
|
loading: '正在加载管理列表',
|
||||||
users: '用户',
|
users: '用户',
|
||||||
roles: '角色',
|
roles: '角色',
|
||||||
|
|||||||
Reference in New Issue
Block a user