From 55e6ad8462377de192c23a7d43f8175ce1edeb7e Mon Sep 17 00:00:00 2001 From: Kostya Bats Date: Tue, 10 Sep 2024 23:46:13 +0300 Subject: [PATCH] Some frontend fixes --- .../admin/src/components/pages/Analytics.tsx | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/src/frontend/admin/src/components/pages/Analytics.tsx b/src/frontend/admin/src/components/pages/Analytics.tsx index d0cb4e70..eedf906c 100644 --- a/src/frontend/admin/src/components/pages/Analytics.tsx +++ b/src/frontend/admin/src/components/pages/Analytics.tsx @@ -12,7 +12,14 @@ import { DataGrid, GridColDef, GridRenderCellParams } from "@mui/x-data-grid"; import { activeRowColor } from "@/styles.js"; import { timeMsToDuration, unixTimeMsToLocalTime } from "@/utils"; import { FeaturedRunStatus, useAnalyticsService } from "@/services/analytics"; -import { AnalyticsMessage, AnalyticsMessageComment, ProblemInfo, TeamInfo, TeamMediaType } from "@shared/api.ts"; +import { + AnalyticsMessage, + AnalyticsMessageComment, + ProblemInfo, + RunResult, + TeamInfo, + TeamMediaType +} from "@shared/api.ts"; import TeamMediaSwitcher from "@/components/controls/TeamMediaSwitcher"; import ButtonGroup from "@/components/atoms/ButtonGroup"; @@ -36,6 +43,7 @@ const EventTagsIcons = ({ tags }: { tags: string[] }) => { const buildMessagesTableColumns = ( teams: { [id: string]: TeamInfo }, problems: { [id: string]: ProblemInfo }, + selectedMessageId: string | undefined, selectedCommentId: string | undefined, onSelectComment: (messageId: string, commentId: string) => void, ): GridColDef[] => [ @@ -54,10 +62,11 @@ const buildMessagesTableColumns = ( field: "comments", headerName: "Messages", flex: 3, + sortable: false, valueGetter: (v: AnalyticsMessageComment[]) => v.map(c => c.message).join(" "), renderCell: ({ row: { id, comments, featuredRun } }: GridRenderCellParams) => ( <> - {[].concat(comments).reverse().map((m: AnalyticsMessageComment) => ( + {comments.map((m: AnalyticsMessageComment) => ( ))} + {comments.length === 0 && } ), - colSpan: (_, message) => message.comments.length > 0 ? 3 : 1, + colSpan: (_, message) => message.comments.length > 0 ? 2 : 1, }, { field: "teamId", @@ -84,7 +94,7 @@ const buildMessagesTableColumns = ( { field: "problemId", headerName: "Problem", - flex: 1, + width: 70, valueGetter: (_, message) => message.runInfo && (problems[message.runInfo.problemId]?.letter + " - " + problems[message.runInfo.problemId]?.name), valueFormatter: (_, message) => message.runInfo && problems[message.runInfo.problemId]?.letter || "", @@ -95,10 +105,23 @@ const buildMessagesTableColumns = ( width: 70, valueGetter: (_, message) => message.runInfo?.id ?? "", }, + { + field: "runInfoResult", + headerName: "Result", + width: 50, + valueGetter: (_, message): string => { + if (message.runInfo?.result?.type === RunResult.Type.ICPC) { + return message.runInfo.result.verdict.shortName; + } else if (message.runInfo?.result?.type === RunResult.Type.IOI) { + return message.runInfo.result.scoreAfter.toString(0); + } + return ""; + }, + }, { field: "relativeTimeMs", headerName: "Time", - width: 80, + width: 70, renderCell: (params: GridRenderCellParams) => ( {timeMsToDuration(params.row.relativeTimeMs)} @@ -131,7 +154,7 @@ function MessagesTable({