feat: 支持4种OpenBridge主题切换,统一项目命名和端口配置

- 添加 OpenBridge 四种主题切换 (day/bright/dusk/night)
- 实现 DJB2 hash 算法生成项目专用端口 (14323)
- 统一项目名称为 openbridge-token-usage-viewer
- 更新 Tauri 应用名称、sidecar 命名和窗口标题
- 开发服务器端口从 3000 改为基于项目名称的稳定端口
This commit is contained in:
2026-01-22 13:02:43 +08:00
parent d077dfdd90
commit b520cdaf35
10 changed files with 189 additions and 36 deletions

View File

@@ -7,10 +7,12 @@
* 特性:
* - 多账户配额可视化 (根据 API 返回的账户数量动态显示)
* - 实时告警通知 (低于 20% 警告,低于 5% 紧急)
* - 支持日间/夜间主题切换
* - 支持 OpenBridge 四种主题切换 (day/bright/dusk/night)
* - OpenBridge 组件懒加载以避免 SSR 问题
*/
import '@oicl/openbridge-webcomponents/dist/icons/icon-palette-day.js'
import '@oicl/openbridge-webcomponents/dist/icons/icon-palette-day-bright.js'
import '@oicl/openbridge-webcomponents/dist/icons/icon-palette-dusk.js'
import '@oicl/openbridge-webcomponents/dist/icons/icon-palette-night.js'
import { AlertType } from '@oicl/openbridge-webcomponents/dist/types'
import { lazy, Suspense, useCallback, useMemo, useState } from 'react'
@@ -291,6 +293,37 @@ export const TokenUsageDashboard = ({ data }: TokenUsageDashboardProps) => {
/>
</ObcNavigationItem>
{/* 明亮模式选项 */}
<ObcNavigationItem
label="明亮模式"
checked={theme === 'bright'}
onClick={() => handleThemeChange('bright')}
>
<span
slot="icon"
// biome-ignore lint: custom element
dangerouslySetInnerHTML={{
__html:
'<obi-palette-day-bright></obi-palette-day-bright>',
}}
/>
</ObcNavigationItem>
{/* 黄昏模式选项 */}
<ObcNavigationItem
label="黄昏模式"
checked={theme === 'dusk'}
onClick={() => handleThemeChange('dusk')}
>
<span
slot="icon"
// biome-ignore lint: custom element
dangerouslySetInnerHTML={{
__html: '<obi-palette-dusk></obi-palette-dusk>',
}}
/>
</ObcNavigationItem>
{/* 夜间模式选项 */}
<ObcNavigationItem
label="夜间模式"