fix: 后台外壳容忍异常品牌成员数据
CI / Taro builds (linjing-editorial) (push) Has been cancelled
CI / Browser regression (push) Has been cancelled
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Taro builds (acheng-campus-food) (push) Has been cancelled
CI / Taro builds (atelier-solopreneur) (push) Has been cancelled

This commit is contained in:
que01 committed 2026-10-21 11:03:55 +08:00
1 parent ec84988e57
commit 737010ea03
4 files changed
+107 -16

No files matched your search

+6 -6
View File
@@ -42,6 +42,7 @@ import { AdminOverviewRedirect } from "./AdminRouter.js";
import { createBrandRouteElement } from "./route-access.js";
import { Suspense } from "react";
import { AdminErrorBoundary } from "../components/AdminErrorBoundary.js";
import { toBrandDisplayName, toBrandSwitcherOptions } from "../lib/brand-switcher.js";
export function Dashboard({
onLogout,
@@ -72,6 +73,8 @@ export function Dashboard({
}
};
const page = location.pathname.split("/")[2] || "overview";
const brandName = toBrandDisplayName(brand.data?.name, "当前品牌");
const brandOptions = toBrandSwitcherOptions(memberships.data);
const items = [
{
type: "group" as const,
@@ -108,7 +111,7 @@ export function Dashboard({
<AdminLayout className="admin-shell">
<AdminLayout.Sider className="admin-sider" breakpoint="lg" collapsedWidth={0} width={232}>
<div className="admin-sider-brand">
<BrandMark name={brand.data?.name} />
<BrandMark name={toBrandDisplayName(brand.data?.name, "")} />
<span className="admin-sider-brand-name">品牌工作区</span>
</div>
<AdminMenu
@@ -120,7 +123,7 @@ export function Dashboard({
<AdminLayout className="admin-main">
<AdminLayout.Header className="admin-header">
<div className="admin-header-left">
<span className="admin-header-brand">{brand.data?.name || "当前品牌"}</span>
<span className="admin-header-brand">{brandName}</span>
<span className="admin-header-context">品牌工作区</span>
<StatusTag
tone={role === "owner" ? "info" : "neutral"}
@@ -135,10 +138,7 @@ export function Dashboard({
onChange={(value: string | undefined) => {
if (value) void switchBrand(value);
}}
options={(memberships.data ?? []).map((item) => ({
value: item.brand.id,
label: item.brand.name,
}))}
options={brandOptions}
/>
</div>
<AdminButton type="text" onClick={onLogout}>