feat: 前台页头加明暗切换,刷新图标换成闪电

- settings.site.actions 新增 theme(默认开),后台「操作工具」可关
- 前台页头:月亮/太阳按钮,点击写回 site.theme,前后台同步;
  未登录时不显示(设置接口需要会话)
- 刷新图标 refresh_3_line -> lightning_line,刷新期间仍旋转
This commit is contained in:
2026-11-01 16:26:57 +08:00
parent 5c170f8819
commit 84fc148a39
5 changed files with 56 additions and 3 deletions
+13 -1
View File
@@ -28,7 +28,10 @@ type SiteHeaderProps = {
username?: string
/** 刷新中:刷新按钮转圈 */
refreshing?: boolean
/** 当前是否为深色,决定明暗按钮的图标与文案 */
dark?: boolean
onRefresh: () => void
onToggleTheme: () => void
onLogin: () => void
onLogout: () => void
onSettings: () => void
@@ -52,7 +55,9 @@ export function SiteHeader({
authenticated,
username,
refreshing = false,
dark = false,
onRefresh,
onToggleTheme,
onLogin,
onLogout,
onSettings,
@@ -84,10 +89,17 @@ export function SiteHeader({
)}
<div className="header-actions">
{site.actions.theme && (
<IconButton
label={dark ? '切换到浅色' : '切换到深色'}
icon={<Icon name={dark ? 'sun_line' : 'moon_line'} />}
onClick={onToggleTheme}
/>
)}
{site.actions.refresh && (
<IconButton
label="刷新(重扫项目并重拉内容)"
icon={<Icon name="refresh_3_line" />}
icon={<Icon name="lightning_line" />}
spinning={refreshing}
onClick={onRefresh}
/>