import { ArrowLeftOutlined, PlayCircleOutlined } from '@ant-design/icons' import { useQuery } from '@tanstack/react-query' import { Button, Card, Descriptions, List, Space, Spin, Tag, Typography } from 'antd' import { useNavigate, useParams } from 'react-router-dom' import { Answer, testsApi } from '../../api/tests' const { Title, Text } = Typography export default function TestDetail() { const { id } = useParams<{ id: string }>() const navigate = useNavigate() const { data: test, isLoading } = useQuery({ queryKey: ['tests', id], queryFn: () => testsApi.get(Number(id)).then((r) => r.data), }) if (isLoading) { return } if (!test) return null return (
{test.title} {test.description && ( {test.description} )} {test.questions.length} {test.passing_score}% {test.time_limit ? `${test.time_limit} мин` : 'Без ограничений'} {test.allow_navigation_back ? ( Разрешён ) : ( Запрещён )} {test.version} {new Date(test.created_at).toLocaleDateString('ru-RU')} Вопросы ({test.questions.length}) {test.questions.map((question, index) => ( {index + 1}. {question.text} ( {answer.text} )} /> ))}
) }