feat: 完善后台设计语言细节

- 统一说明文案层级:Typography.Paragraph 次要文案迁移到 admin-section-description
- 状态色补齐边框与中间调令牌,Alert/错误条/Descriptions 与 StatusTag 同源
- 咨询详情描述列表去表格线,改为键值展示并统一令牌
- 新增 BrandMark,侧栏与登录页标识改用品牌首字
- 信任内容改用列表行,空状态、表格骨架屏、主按钮脏检查落地
- design.md 同步令牌映射、切换控件选型与组件清单
This commit is contained in:
que01 committed 2026-10-14 11:21:31 +08:00
1 parent 2f26828f09
commit 3ef46b0aa8
25 files changed
+836 -393

No files matched your search

@@ -3,7 +3,7 @@ import { AdminPageHeader } from "../../components/AdminPageHeader.js";
import { AdminSection } from "../../components/AdminSection.js";
import { QueryState } from "../../components/QueryState.js";
import { TrustContentEditorModal } from "./components/TrustContentEditorModal.js";
import { TrustContentTable } from "./components/TrustContentTable.js";
import { TrustContentList } from "./components/TrustContentList.js";
import { TrustRequirementsList } from "./components/TrustRequirementsList.js";
import type { TrustTypeOption } from "./domain/trust-content-domain.js";
import {
@@ -74,11 +74,12 @@ export function TrustContentPage() {
/>
</AdminSection>
<AdminSection title="已配置的品牌内容">
<TrustContentTable
<TrustContentList
availableTypes={availableTypes}
items={query.data ?? []}
removeError={remove.error}
removePending={remove.isPending}
onCreate={() => begin()}
onEdit={(item) => begin(item)}
onDelete={(id) => remove.mutate(id)}
/>
@@ -1,4 +1,4 @@
import { Form, Input, Modal, Select, Typography } from "antd";
import { Form, Input, Modal, Select } from "antd";
import type { FormInstance } from "antd";
import type { TrustContent, TrustContentInput } from "@personal-brand/api-client";
import { ImageUrlField } from "../../../components/ImageUrlField.js";
@@ -49,9 +49,9 @@ export function TrustContentEditorModal({
/>
</Form.Item>
{selectedTypeMeta?.pages?.length ? (
<Typography.Paragraph type="secondary">
<p className="admin-section-description admin-offset-bottom">
这类内容会显示在:{selectedTypeMeta.pages.map(pageLabel).join("、")}
</Typography.Paragraph>
</p>
) : null}
<Form.Item
name="title"
@@ -0,0 +1,89 @@
import { Button, Popconfirm } from "antd";
import { FileTextOutlined } from "@ant-design/icons";
import type { TrustContent } from "@personal-brand/api-client";
import { EmptyState } from "../../../components/EmptyState.js";
import { MutationError } from "../../../components/QueryState.js";
import { StatusTag } from "../../../components/StatusTag.js";
import type { TrustTypeOption } from "../domain/trust-content-domain.js";
import { getTrustContentPreview } from "../domain/trust-content-domain.js";
export function TrustContentList({
availableTypes,
items,
removeError,
removePending,
onCreate,
onEdit,
onDelete,
}: {
availableTypes: TrustTypeOption[];
items: TrustContent[];
removeError: unknown;
removePending: boolean;
onCreate: () => void;
onEdit: (item: TrustContent) => void;
onDelete: (id: string) => void;
}) {
if (!items.length) {
return (
<section aria-label="已配置的品牌内容">
<EmptyState
icon={<FileTextOutlined />}
title="还没有品牌内容"
description="按上方模板要求逐项添加,访客才能看到你的经历与证明。"
action={
<Button type="primary" onClick={onCreate}>
添加品牌内容
</Button>
}
/>
</section>
);
}
return (
<section aria-label="已配置的品牌内容">
<ul className="admin-list">
{items.map((item) => {
const typeMeta = availableTypes.find((type) => type.type === item.type);
return (
<li key={item.id} className="admin-row admin-record">
<div className="admin-record__thumb">
{item.coverUrl ? (
<img src={item.coverUrl} alt="" loading="lazy" />
) : (
<FileTextOutlined />
)}
</div>
<div className="admin-row-main">
<div className="admin-row-line">
<span className="admin-row-title">{item.title}</span>
<StatusTag tone="neutral" label={typeMeta?.label ?? item.type} />
<StatusTag
tone={item.isPublished ? "success" : "neutral"}
label={item.isPublished ? "随发布展示" : "草稿"}
/>
</div>
<p className="admin-row-summary">{getTrustContentPreview(item, typeMeta)}</p>
</div>
<div className="admin-record__actions">
<Button type="link" size="small" onClick={() => onEdit(item)}>
编辑
</Button>
<Popconfirm
title="确认删除这条信任内容?"
description="删除后需发布品牌,才会更新小程序展示。"
onConfirm={() => onDelete(item.id)}
>
<Button type="link" size="small" danger loading={removePending}>
删除
</Button>
</Popconfirm>
</div>
</li>
);
})}
</ul>
<MutationError error={removeError} />
</section>
);
}
@@ -1,84 +0,0 @@
import { Button, Popconfirm, Space, Table } from "antd";
import type { TrustContent } from "@personal-brand/api-client";
import type { TrustTypeOption } from "../domain/trust-content-domain.js";
import { getTrustContentPreview } from "../domain/trust-content-domain.js";
import { MutationError } from "../../../components/QueryState.js";
import { StatusTag } from "../../../components/StatusTag.js";
export function TrustContentTable({
availableTypes,
items,
removeError,
removePending,
onEdit,
onDelete,
}: {
availableTypes: TrustTypeOption[];
items: TrustContent[];
removeError: unknown;
removePending: boolean;
onEdit: (item: TrustContent) => void;
onDelete: (id: string) => void;
}) {
return (
<section aria-label="已配置的品牌内容">
<Table
rowKey="id"
dataSource={items}
locale={{ emptyText: "还没有品牌内容,请先按上方模板要求添加。" }}
columns={[
{
title: "内容类型",
dataIndex: "type",
render: (value) => (
<StatusTag
tone="neutral"
label={availableTypes.find((item) => item.type === value)?.label ?? String(value)}
/>
),
},
{ title: "标题", dataIndex: "title" },
{
title: "内容预览",
ellipsis: { showTitle: true },
render: (_value: unknown, item: TrustContent) =>
getTrustContentPreview(
item,
availableTypes.find((type) => type.type === item.type),
),
},
{
title: "发布状态",
dataIndex: "isPublished",
render: (value) => (
<StatusTag
tone={value ? "success" : "neutral"}
label={value ? "随发布展示" : "草稿"}
/>
),
},
{
title: "操作",
render: (_: unknown, item: TrustContent) => (
<Space>
<Button type="link" size="small" onClick={() => onEdit(item)}>
编辑
</Button>
<Popconfirm
title="确认删除这条信任内容?"
description="删除后需发布品牌,才会更新小程序展示。"
onConfirm={() => onDelete(item.id)}
>
<Button type="link" size="small" danger loading={removePending}>
删除
</Button>
</Popconfirm>
</Space>
),
},
]}
/>
<MutationError error={removeError} />
</section>
);
}