diff --git a/src/api/problem.ts b/src/api/problem.ts index 23e0d97..7943e83 100644 --- a/src/api/problem.ts +++ b/src/api/problem.ts @@ -15,6 +15,7 @@ export interface ProblemInfo { meta: Meta; title: string; statement: string; + tags: { Elements: string[] }; provider: UserProfile; is_enabled: boolean; } @@ -34,13 +35,15 @@ export interface DetailsResp { } export interface SearchReq { - search: string; + keyword: string; + tag: string; } export interface UpdateReq { pid: number; title: string; statement: string; + tags: string[]; is_enabled: boolean; } diff --git a/src/components/problem-details.tsx b/src/components/problem-details.tsx index 36aff7f..a9c44a2 100644 --- a/src/components/problem-details.tsx +++ b/src/components/problem-details.tsx @@ -27,6 +27,11 @@ export default function ProblemDetails(props: ProblemDetailsProps) { ))} + + {details.problem.tags.Elements.map((tag) => { + return {tag}; + })} + {details.context.Tasks.length} ); diff --git a/src/components/status-table.tsx b/src/components/status-table.tsx index 44d4eaf..f72a2ec 100644 --- a/src/components/status-table.tsx +++ b/src/components/status-table.tsx @@ -121,9 +121,6 @@ export default function StatusTable(props: StatusTableProps) { columns={columns} request={request} rowKey={(record) => record.id} - pagination={{ - pageSize: 10, - }} search={false} scroll={{ x: "max-content" }} dateFormatter="string" diff --git a/src/pages/search.tsx b/src/pages/search.tsx index 3673763..323240f 100644 --- a/src/pages/search.tsx +++ b/src/pages/search.tsx @@ -1,13 +1,14 @@ import { Link } from "react-router-dom"; import { ProColumns, ProTable } from "@ant-design/pro-components"; -import { Button, Space } from "antd"; +import { Button, Space, Tag } from "antd"; import { ProblemApi } from "../api/problem.ts"; interface ProblemList { id: number; title: string; + tags: string[]; provider: string; } @@ -23,6 +24,20 @@ const columns: ProColumns[] = [ dataIndex: "title", align: "left", }, + { + title: "Tags", + dataIndex: "tags", + align: "left", + render: (_node, entity) => { + return ( + + {entity.tags.map((tag) => { + return {tag}; + })} + + ); + }, + }, { title: "Provider", hideInSearch: true, @@ -53,12 +68,14 @@ export default function SearchPage() { const request = async (params: Record) => { try { const info = await ProblemApi.Search({ - search: params.title || "", + keyword: params.title || "", + tag: params.tags || "", }); const data = info.map((i) => { return { id: i.meta.ID, title: i.title, + tags: i.tags.Elements, provider: i.provider.nick_name, }; }); @@ -75,12 +92,6 @@ export default function SearchPage() { columns={columns} request={request} rowKey={(record) => record.id} - pagination={{ - pageSize: 10, - }} - search={{ - labelWidth: "auto", - }} scroll={{ x: "max-content" }} dateFormatter="string" headerTitle="Problem Lists"