feat(admin): 页头拆成三个子页签,导航顺序与命名调整
- 首页管理下顺序改为 页头 / 侧边栏 / 内容卡片,默认展开
- 资料 -> 资料管理、系统 -> 系统管理
- 页头面板内用水平页签分为 站点信息 / 操作工具 / 滚动信息
- 滚动信息页列出可用通配符 {count} / {project} / {status} 及含义
This commit is contained in:
@@ -53,6 +53,28 @@
|
|||||||
padding: 0 var(--su-space-5);
|
padding: 0 var(--su-space-5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 通配符说明:两列小表 */
|
||||||
|
.ticker-vars {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: auto minmax(0, 1fr);
|
||||||
|
gap: var(--su-space-2) var(--su-space-4);
|
||||||
|
align-items: center;
|
||||||
|
padding: var(--su-space-3);
|
||||||
|
border: 1px solid var(--su-border);
|
||||||
|
border-radius: var(--su-radius-md);
|
||||||
|
background-color: var(--su-bg-subtle);
|
||||||
|
font-size: var(--su-font-size-sm);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ticker-vars code {
|
||||||
|
padding: 0 var(--su-space-2);
|
||||||
|
border-radius: var(--su-radius-xs);
|
||||||
|
background-color: var(--su-bg-card);
|
||||||
|
color: var(--su-color-primary);
|
||||||
|
font-family: var(--su-font-mono);
|
||||||
|
justify-self: start;
|
||||||
|
}
|
||||||
|
|
||||||
/* 后台:左侧导航 + 右侧内容 */
|
/* 后台:左侧导航 + 右侧内容 */
|
||||||
.admin-shell {
|
.admin-shell {
|
||||||
display: grid;
|
display: grid;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import {
|
|||||||
Select,
|
Select,
|
||||||
Space,
|
Space,
|
||||||
Switch,
|
Switch,
|
||||||
|
Tabs,
|
||||||
Tag,
|
Tag,
|
||||||
Text,
|
Text,
|
||||||
Textarea,
|
Textarea,
|
||||||
@@ -81,13 +82,13 @@ const ADMIN_NAV: MenuItem[] = [
|
|||||||
key: 'home',
|
key: 'home',
|
||||||
label: '首页管理',
|
label: '首页管理',
|
||||||
children: [
|
children: [
|
||||||
|
{ key: 'home-header', label: '页头' },
|
||||||
{ key: 'home-sidebar', label: '侧边栏' },
|
{ key: 'home-sidebar', label: '侧边栏' },
|
||||||
{ key: 'home-cards', label: '内容卡片' },
|
{ key: 'home-cards', label: '内容卡片' },
|
||||||
{ key: 'home-header', label: '页头' },
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{ key: 'profile', label: '资料' },
|
{ key: 'profile', label: '资料管理' },
|
||||||
{ key: 'system', label: '系统' },
|
{ key: 'system', label: '系统管理' },
|
||||||
]
|
]
|
||||||
|
|
||||||
const FORMAT_OPTIONS = [
|
const FORMAT_OPTIONS = [
|
||||||
@@ -308,6 +309,7 @@ export function AdminNext() {
|
|||||||
activeKey={tab}
|
activeKey={tab}
|
||||||
onSelect={(key) => setTab(key as TabKey)}
|
onSelect={(key) => setTab(key as TabKey)}
|
||||||
itemHeight={40}
|
itemHeight={40}
|
||||||
|
defaultOpenKeys={['home']}
|
||||||
/>
|
/>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
@@ -1900,11 +1902,23 @@ function HeaderPanel({
|
|||||||
site: SiteSettings['site']
|
site: SiteSettings['site']
|
||||||
onChangeSite: (site: SiteSettings['site']) => void
|
onChangeSite: (site: SiteSettings['site']) => void
|
||||||
}) {
|
}) {
|
||||||
|
const [tab, setTab] = useState<'site' | 'actions' | 'ticker'>('site')
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Space direction="column" gap="lg" align="stretch" className="admin-form">
|
<Space direction="column" gap="lg" align="stretch" className="admin-form">
|
||||||
<Text size="sm" strong>
|
<Tabs
|
||||||
站点信息
|
className="admin-tabs"
|
||||||
</Text>
|
items={[
|
||||||
|
{ key: 'site', label: '站点信息' },
|
||||||
|
{ key: 'actions', label: '操作工具' },
|
||||||
|
{ key: 'ticker', label: '滚动信息' },
|
||||||
|
]}
|
||||||
|
activeKey={tab}
|
||||||
|
onChange={(key) => setTab(key as 'site' | 'actions' | 'ticker')}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{tab === 'site' && (
|
||||||
|
<Space direction="column" gap="lg" align="stretch">
|
||||||
<FormField label="页面标题" htmlFor="site-title" hint="浏览器标签页上的文字">
|
<FormField label="页面标题" htmlFor="site-title" hint="浏览器标签页上的文字">
|
||||||
<Input
|
<Input
|
||||||
id="site-title"
|
id="site-title"
|
||||||
@@ -1913,7 +1927,11 @@ function HeaderPanel({
|
|||||||
onChange={(event) => onChangeSite({ ...site, title: event.target.value })}
|
onChange={(event) => onChangeSite({ ...site, title: event.target.value })}
|
||||||
/>
|
/>
|
||||||
</FormField>
|
</FormField>
|
||||||
<FormField label="Favicon 地址" htmlFor="site-favicon" hint="留空使用内置图标;支持 .svg / .png 或完整 URL">
|
<FormField
|
||||||
|
label="Favicon 地址"
|
||||||
|
htmlFor="site-favicon"
|
||||||
|
hint="留空使用内置图标;支持 .svg / .png 或完整 URL"
|
||||||
|
>
|
||||||
<Input
|
<Input
|
||||||
id="site-favicon"
|
id="site-favicon"
|
||||||
value={site.favicon}
|
value={site.favicon}
|
||||||
@@ -1933,11 +1951,7 @@ function HeaderPanel({
|
|||||||
首页 Logo
|
首页 Logo
|
||||||
</Text>
|
</Text>
|
||||||
<div className="brand-preview">
|
<div className="brand-preview">
|
||||||
<Brand
|
<Brand name={site.brand.name} mark={site.brand.mark} logo={site.brand.logo} />
|
||||||
name={site.brand.name}
|
|
||||||
mark={site.brand.mark}
|
|
||||||
logo={site.brand.logo}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<FormField label="Logo 图片地址" htmlFor="site-logo" hint="留空则用右侧的首字圆形标记">
|
<FormField label="Logo 图片地址" htmlFor="site-logo" hint="留空则用右侧的首字圆形标记">
|
||||||
<Input
|
<Input
|
||||||
@@ -1971,9 +1985,13 @@ function HeaderPanel({
|
|||||||
/>
|
/>
|
||||||
</FormField>
|
</FormField>
|
||||||
</div>
|
</div>
|
||||||
|
</Space>
|
||||||
|
)}
|
||||||
|
|
||||||
<Text size="sm" strong>
|
{tab === 'actions' && (
|
||||||
操作工具
|
<Space direction="column" gap="md" align="stretch">
|
||||||
|
<Text size="sm" tone="muted">
|
||||||
|
说明:这里控制页头右侧显示哪些图标按钮;关掉的按钮不再出现,也不影响其它页面。
|
||||||
</Text>
|
</Text>
|
||||||
<div className="sidebar-toggle-row">
|
<div className="sidebar-toggle-row">
|
||||||
<Text>明暗切换</Text>
|
<Text>明暗切换</Text>
|
||||||
@@ -2015,10 +2033,11 @@ function HeaderPanel({
|
|||||||
label="页头显示登录或退出按钮"
|
label="页头显示登录或退出按钮"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</Space>
|
||||||
|
)}
|
||||||
|
|
||||||
<Text size="sm" strong>
|
{tab === 'ticker' && (
|
||||||
滚动信息
|
<Space direction="column" gap="md" align="stretch">
|
||||||
</Text>
|
|
||||||
<div className="sidebar-toggle-row">
|
<div className="sidebar-toggle-row">
|
||||||
<Text>显示页头滚动信息</Text>
|
<Text>显示页头滚动信息</Text>
|
||||||
<Switch
|
<Switch
|
||||||
@@ -2038,6 +2057,25 @@ function HeaderPanel({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
|
<Text size="sm" strong>
|
||||||
|
可用通配符
|
||||||
|
</Text>
|
||||||
|
<Text size="sm" tone="muted">
|
||||||
|
说明:下面这些占位符写在「信息文本」里,渲染时会替换成实时值;写别的花括号不会替换。
|
||||||
|
</Text>
|
||||||
|
<div className="ticker-vars">
|
||||||
|
<code>{'{count}'}</code>
|
||||||
|
<span>本地应用数量</span>
|
||||||
|
<code>{'{project}'}</code>
|
||||||
|
<span>第一个本地项目的名字(没有项目时显示 —)</span>
|
||||||
|
<code>{'{status}'}</code>
|
||||||
|
<span>实时同步状态:实时同步已连接 / 等待服务连接</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Text size="sm" strong>
|
||||||
|
信息条目
|
||||||
|
</Text>
|
||||||
{value.items.map((item, index) => (
|
{value.items.map((item, index) => (
|
||||||
<div className="admin-item-row" key={index}>
|
<div className="admin-item-row" key={index}>
|
||||||
<Input
|
<Input
|
||||||
@@ -2086,7 +2124,10 @@ function HeaderPanel({
|
|||||||
icon={<Icon name="delete_2_line" />}
|
icon={<Icon name="delete_2_line" />}
|
||||||
aria-label="删除这一条"
|
aria-label="删除这一条"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
onChange({ ...value, items: value.items.filter((_, current) => current !== index) })
|
onChange({
|
||||||
|
...value,
|
||||||
|
items: value.items.filter((_, current) => current !== index),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -2101,6 +2142,8 @@ function HeaderPanel({
|
|||||||
添加一条
|
添加一条
|
||||||
</Button>
|
</Button>
|
||||||
</Space>
|
</Space>
|
||||||
|
)}
|
||||||
|
</Space>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user