diff --git a/apps/admin/src/features/trust-content/TrustContentPage.tsx b/apps/admin/src/features/trust-content/TrustContentPage.tsx index 67fdbe5..1073c1d 100644 --- a/apps/admin/src/features/trust-content/TrustContentPage.tsx +++ b/apps/admin/src/features/trust-content/TrustContentPage.tsx @@ -15,8 +15,18 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import type { TrustContent, TrustContentInput } from "@personal-brand/api-client"; import { useState } from "react"; import { createApiClient } from "../../lib/api.js"; +import { AdminPageHeader } from "../../components/AdminPageHeader.js"; +import { MutationError, QueryState } from "../../components/QueryState.js"; + +const types = [ + { value: "profile", label: "个人经历" }, + { value: "experience", label: "工作经验" }, + { value: "credential", label: "资历与证明" }, + { value: "portfolio", label: "案例与作品" }, + { value: "process", label: "合作流程" }, + { value: "testimonial", label: "客户反馈" }, +]; -const types = ["profile", "experience", "credential", "portfolio", "process", "testimonial"]; export function TrustContentPage() { const client = createApiClient(); const queryClient = useQueryClient(); @@ -57,49 +67,67 @@ export function TrustContentPage() { title: item.title, summary: item.summary ?? undefined, content: item.content, + coverUrl: item.coverUrl ?? undefined, isPublished: item.isPublished, } - : { type: "profile", isPublished: true }, + : { type: "profile", isPublished: false }, ); }; return ( - begin()}> - 新增内容 - - } - > - {value} }, - { title: "标题", dataIndex: "title" }, - { - title: "状态", - dataIndex: "isPublished", - render: (value) => (value ? "已发布" : "草稿"), - }, - { - title: "操作", - render: (_: unknown, item: TrustContent) => ( - - - remove.mutate(item.id)}> - - - - ), - }, - ]} + void query.refetch()}> + begin()}> + 新增信任内容 + + } /> + +
( + {types.find((item) => item.value === value)?.label ?? value} + ), + }, + { title: "标题", dataIndex: "title" }, + { title: "摘要", dataIndex: "summary", render: (value) => value || "未填写" }, + { + title: "状态", + dataIndex: "isPublished", + render: (value) => ( + {value ? "已公开" : "草稿"} + ), + }, + { + title: "操作", + render: (_: unknown, item: TrustContent) => ( + + + remove.mutate(item.id)} + > + + + + ), + }, + ]} + /> + + form.submit()} confirmLoading={save.isPending} + destroyOnClose >
save.mutate(values)}> - - - + - - + + - + + + +