import { Button, Popconfirm, Space, Table, Tag } 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"; 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 (
( {availableTypes.find((item) => item.type === value)?.label ?? 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) => ( {value ? "随发布展示" : "草稿"} ), }, { title: "操作", render: (_: unknown, item: TrustContent) => ( onDelete(item.id)} > ), }, ]} /> ); }