feat: 完善后台设计语言细节
- 统一说明文案层级:Typography.Paragraph 次要文案迁移到 admin-section-description - 状态色补齐边框与中间调令牌,Alert/错误条/Descriptions 与 StatusTag 同源 - 咨询详情描述列表去表格线,改为键值展示并统一令牌 - 新增 BrandMark,侧栏与登录页标识改用品牌首字 - 信任内容改用列表行,空状态、表格骨架屏、主按钮脏检查落地 - design.md 同步令牌映射、切换控件选型与组件清单
This commit is contained in:
1 parent
2f26828f09
commit
3ef46b0aa8
25 files changed
+836
-393
No files matched your search
@@ -1,10 +1,14 @@
|
||||
import { Card, Col, Empty, Row } from "antd";
|
||||
import { Button, Card, Col, Row } from "antd";
|
||||
import { AppstoreOutlined } from "@ant-design/icons";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { AdminPageHeader } from "../../components/AdminPageHeader.js";
|
||||
import { EmptyState } from "../../components/EmptyState.js";
|
||||
import { QueryState } from "../../components/QueryState.js";
|
||||
import { CapabilityCard } from "./components/CapabilityCard.js";
|
||||
import { useCapabilityQuery } from "./hooks/useCapabilityQueries.js";
|
||||
|
||||
export function CapabilitiesPage() {
|
||||
const navigate = useNavigate();
|
||||
const query = useCapabilityQuery();
|
||||
|
||||
return (
|
||||
@@ -23,7 +27,14 @@ export function CapabilitiesPage() {
|
||||
</Row>
|
||||
) : (
|
||||
<Card>
|
||||
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="当前模板没有可配置能力。" />
|
||||
<EmptyState
|
||||
icon={<AppstoreOutlined />}
|
||||
title="当前模板没有可配置能力"
|
||||
description="安装行业模板后,这里会列出可开关的能力插件。"
|
||||
action={
|
||||
<Button onClick={() => navigate("/admin/workspace")}>前往模板与表单设置</Button>
|
||||
}
|
||||
/>
|
||||
</Card>
|
||||
)}
|
||||
<p className="admin-page-header-description admin-offset-top">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Button, Card, Input, Switch, Typography } from "antd";
|
||||
import { Button, Card, Input, Space, Switch, Typography } from "antd";
|
||||
import { useState } from "react";
|
||||
import { ErrorNote } from "../../../components/QueryState.js";
|
||||
import { StatusTag } from "../../../components/StatusTag.js";
|
||||
@@ -29,10 +29,21 @@ function readSwitchValue(value: unknown): boolean {
|
||||
return value === true;
|
||||
}
|
||||
|
||||
function sameConfig(current: Record<string, unknown>, baseline: Record<string, unknown>): boolean {
|
||||
const currentKeys = Object.keys(current ?? {}).sort();
|
||||
const baselineKeys = Object.keys(baseline ?? {}).sort();
|
||||
if (currentKeys.length !== baselineKeys.length) return false;
|
||||
return currentKeys.every(
|
||||
(key, index) =>
|
||||
key === baselineKeys[index] && JSON.stringify(current[key]) === JSON.stringify(baseline[key]),
|
||||
);
|
||||
}
|
||||
|
||||
export function CapabilityCard({ capability }: { capability: AdminCapability }) {
|
||||
const [status, setStatus] = useState<CapabilityStatus>(capability.status);
|
||||
const [config, setConfig] = useState<Record<string, unknown>>(capability.config);
|
||||
const mutation = useCapabilityMutation();
|
||||
const dirty = status !== capability.status || !sameConfig(config, capability.config ?? {});
|
||||
|
||||
const save = async () => {
|
||||
await mutation.mutateAsync({
|
||||
@@ -55,9 +66,17 @@ export function CapabilityCard({ capability }: { capability: AdminCapability })
|
||||
</span>
|
||||
}
|
||||
extra={
|
||||
<Button type="primary" loading={mutation.isPending} onClick={() => void save()}>
|
||||
保存草稿
|
||||
</Button>
|
||||
<Space>
|
||||
{dirty ? <StatusTag tone="warning" label="有未保存修改" /> : null}
|
||||
<Button
|
||||
type={dirty ? "primary" : "default"}
|
||||
disabled={!dirty}
|
||||
loading={mutation.isPending}
|
||||
onClick={() => void save()}
|
||||
>
|
||||
保存草稿
|
||||
</Button>
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
{mutation.isError ? (
|
||||
|
||||
Reference in new issue
Block a user