diff --git a/services/frontend/bun.lock b/services/frontend/bun.lock index cfa6012..02e8791 100644 --- a/services/frontend/bun.lock +++ b/services/frontend/bun.lock @@ -15,6 +15,7 @@ "autoprefixer": "^10.4.20", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", + "date-fns": "^4.1.0", "dayjs": "^1.11.13", "js-cookie": "^3.0.5", "katex": "^0.16.21", @@ -393,6 +394,8 @@ "csstype": ["csstype@3.1.3", "", {}, "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="], + "date-fns": ["date-fns@4.1.0", "", {}, "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg=="], + "dayjs": ["dayjs@1.11.13", "", {}, "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg=="], "debug": ["debug@4.4.0", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA=="], diff --git a/services/frontend/package.json b/services/frontend/package.json index e7ea22e..6a2fce5 100644 --- a/services/frontend/package.json +++ b/services/frontend/package.json @@ -21,6 +21,7 @@ "autoprefixer": "^10.4.20", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", + "date-fns": "^4.1.0", "dayjs": "^1.11.13", "js-cookie": "^3.0.5", "katex": "^0.16.21", diff --git a/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/components/SolutionStatus/index.tsx b/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/components/SolutionStatus/index.tsx index 33a412a..b67c5ac 100644 --- a/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/components/SolutionStatus/index.tsx +++ b/services/frontend/src/pages/CompetitionSession/modules/TaskSolution/components/SolutionStatus/index.tsx @@ -1,29 +1,31 @@ -import React from 'react'; -import { Solution } from '@/shared/types/task'; -import { getSolutionBgColor, getSolutionTextColor, getStatusText } from '@/pages/CompetitionSession/utils/utils'; + import React from 'react'; + import { Solution } from '@/shared/types/task'; + import { getSolutionBgColor, getSolutionTextColor, getStatusText } from '@/pages/CompetitionSession/utils/utils'; + import { format, parseISO } from 'date-fns'; + import { ru } from 'date-fns/locale'; + + interface SolutionStatusProps { + solution: Solution; + maxPoints: number; + } -interface SolutionStatusProps { - solution: Solution; - maxPoints: number; -} - -const SolutionStatus: React.FC = ({ solution, maxPoints }) => { - - return ( -
-
- - Решение {solution.id} - - - {getStatusText(solution.status, solution.earned_points, maxPoints)} - + const SolutionStatus: React.FC = ({ solution, maxPoints }) => { + const formattedDate = solution.timestamp ? format(parseISO(solution.timestamp), "d MMMM, HH:mm", { locale: ru }) : ''; + return ( +
+
+ + Решение {solution.id} + + + {getStatusText(solution.status, solution.earned_points, maxPoints)} + +
+
+ {formattedDate} +
-
- {solution.timestamp} -
-
- ); -}; + ); + }; -export default SolutionStatus; + export default SolutionStatus;