From abe30ead6a7847b45ce4953570e4e74483835b32 Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Wed, 3 Jun 2026 16:21:56 +0800 Subject: [PATCH] =?UTF-8?q?refactor(inbox):=20=E4=BE=A7=E8=BE=B9=E6=A0=8F?= =?UTF-8?q?=E7=B4=A0=E6=9D=90=E5=88=97=E8=A1=A8=E6=94=B9=E4=B8=BA=E8=BD=BB?= =?UTF-8?q?=E9=87=8F=20Flex=20=E5=B8=83=E5=B1=80=20=E2=80=94=20Card?= =?UTF-8?q?=E2=86=92Flex,=20=E6=96=B0=E5=A2=9E=E7=8A=B6=E6=80=81=20Tag,=20?= =?UTF-8?q?hover=20=E5=88=87=E6=8D=A2=E5=88=A0=E9=99=A4=E6=8C=89=E9=92=AE,?= =?UTF-8?q?=20=E5=B7=A6=E4=BE=A7=E7=AB=96=E7=BA=BF=E9=80=89=E4=B8=AD?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inbox/components/MaterialCard.tsx | 79 ++++++++++++------- src/web/styles.css | 63 ++++++++++++++- .../web/features/inbox/MaterialCard.test.tsx | 26 ++++-- 3 files changed, 132 insertions(+), 36 deletions(-) diff --git a/src/web/features/inbox/components/MaterialCard.tsx b/src/web/features/inbox/components/MaterialCard.tsx index e09f303..44310d0 100644 --- a/src/web/features/inbox/components/MaterialCard.tsx +++ b/src/web/features/inbox/components/MaterialCard.tsx @@ -1,7 +1,7 @@ import { DeleteOutlined } from "@ant-design/icons"; -import { Button, Card, Flex, Popconfirm, Typography } from "antd"; +import { Button, Flex, Popconfirm, Tag, Typography } from "antd"; -import type { Material } from "../types"; +import type { Material, MaterialStatus } from "../types"; interface MaterialCardProps { material: Material; @@ -10,34 +10,55 @@ interface MaterialCardProps { selected: boolean; } -export function MaterialCard({ material, onDelete, onSelect }: MaterialCardProps) { +const STATUS_MAP: Record = { + approved: { color: "green", label: "已通过" }, + discarded: { color: "red", label: "已放弃" }, + pending: { color: "gold", label: "待审核" }, +}; + +export function MaterialCard({ material, onDelete, onSelect, selected }: MaterialCardProps) { + const statusInfo = STATUS_MAP[material.status]; + const className = selected ? "material-list-item material-list-item--selected" : "material-list-item"; + return ( - - {material.description} - - {formatMaterialTime(material.createdAt)} - e?.stopPropagation()} - onConfirm={(e) => { - e?.stopPropagation(); - onDelete(); - }} - title="确认删除该素材?" - > -