import { Button, Divider, Form, Typography } from "antd"; import { AdminPageHeader } from "../../components/AdminPageHeader.js"; import { QueryState } from "../../components/QueryState.js"; import { TrustContentEditorModal } from "./components/TrustContentEditorModal.js"; import { TrustContentTable } from "./components/TrustContentTable.js"; import { TrustRequirementsList } from "./components/TrustRequirementsList.js"; import type { TrustTypeOption } from "./domain/trust-content-domain.js"; import { createTrustPageLabelResolver, groupTrustContentByType, selectTrustTypeOptions, } from "./domain/trust-content-domain.js"; import { useTrustContentEditor } from "./hooks/useTrustContentEditor.js"; import { useTrustContentQueries } from "./hooks/useTrustContentQueries.js"; export function TrustContentPage() { const { query, workspace } = useTrustContentQueries(); const availableTypes = selectTrustTypeOptions(workspace.data?.templateContent?.trustContentTypes); const pageLabel = createTrustPageLabelResolver(workspace.data?.templateContent?.navigation); const contentByType = groupTrustContentByType(query.data ?? []); const firstMissingRequiredType = availableTypes.find((item) => item.required && !contentByType.has(item.type))?.type ?? availableTypes[0]?.type ?? "credential"; const { begin, closeEditor, editing, form: editorForm, open, remove, save, } = useTrustContentEditor({ availableTypes, contentByType, firstMissingRequiredType, }); const selectedType = Form.useWatch("type", editorForm); const selectedTypeMeta: TrustTypeOption | undefined = availableTypes.find( (item) => item.type === selectedType, ); const trustPageLabels = [ ...new Set(availableTypes.flatMap((item) => item.pages ?? []).map(pageLabel)), ]; const trustPlacement = trustPageLabels.length ? `小程序的${trustPageLabels.join("、")}中` : "小程序对应的信任展示区域中"; return ( void Promise.all([query.refetch(), workspace.refetch()])} > begin()}> 添加品牌内容 } />
当前模板需要配置的内容 标记为“发布必填”的项目需要填写完整后,才能发布小程序。
begin(item)} onDelete={(id) => remove.mutate(id)} /> save.mutate(values)} />
); }