feat: 支持深色主题顶栏 Logo 位置配置

This commit is contained in:
fengxiangdebaozi committed 2026-07-17 21:07:48 +08:00
1 parent 82dd9fb08f
commit a699545c4c
3 files changed
+48 -13

No files matched your search

+33 -13
View File
@@ -14,6 +14,7 @@ import { getStoredAuth } from "@/core/auth";
import { useLiveAccount } from "@/core/auth/use-live-account";
import { getHeaderBrandAsset, getHeaderBrandFallback } from "@/core/branding/brand-assets";
import { isWujieEnv } from "@/core/embed/wujie";
import { readRuntimeEnv } from "@/env";
import { useUnreadCount } from "@/core/notifications";
import { useMyPosition } from "@/core/positions";
import {
@@ -47,6 +48,9 @@ type HeaderProps = {
const Header = ({ collapsed }: HeaderProps) => {
const { theme } = useTheme();
const isDark = theme === "dark";
const darkLogoPosition =
readRuntimeEnv("VITE_DARK_LOGO_POSITION") === "left" ? "left" : "center";
const isDarkLogoOnLeft = darkLogoPosition === "left";
const brandTheme = theme;
const configuredBrandLogo = getHeaderBrandAsset(brandTheme);
const fallbackBrandLogo = getHeaderBrandFallback(brandTheme);
@@ -239,19 +243,26 @@ const Header = ({ collapsed }: HeaderProps) => {
{showTopNav ? (
<>
{/* 左分区(flex-1):菜单靠右贴近中间基座 */}
<div className="flex h-full min-w-0 flex-1 items-center justify-between">
<div
className="flex h-10 w-10 shrink-0 items-center justify-center rounded-lg border border-cyan-300/25 bg-blue-950/55"
title="系统 Logo"
>
<img
src={brandLogo}
alt=""
aria-hidden="true"
className="h-[35px] w-[35px] object-contain"
onError={handleBrandLogoError}
/>
</div>
<div
className={cn(
"flex h-full min-w-0 flex-1 items-center",
isDarkLogoOnLeft ? "justify-between" : "justify-end",
)}
>
{isDarkLogoOnLeft && (
<div
className="flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-blue-950/55"
title="系统 Logo"
>
<img
src={brandLogo}
alt=""
aria-hidden="true"
className="h-[35px] w-[35px] object-contain"
onError={handleBrandLogoError}
/>
</div>
)}
<nav
className="top-submenu-bar top-submenu-bar--group"
aria-label="左侧菜单"
@@ -264,6 +275,15 @@ const Header = ({ collapsed }: HeaderProps) => {
{/* 中:系统 logo + 名称,落在背景图发光基座上。 */}
<div className="header-center-title">
{darkLogoPosition === "center" && (
<img
src={brandLogo}
alt=""
aria-hidden="true"
className="header-center-title__logo"
onError={handleBrandLogoError}
/>
)}
<span className="header-center-title__label">
{desensitizeText("CM业务中心")}
</span>