} onClick={() => navigate('/')}>
К списку тестов
{versions.length > 1 && (!test.is_active || versions.some(v => v.id !== test.id && v.is_active)) && (
)}
}
onClick={() => setEditMode(true)}
>
Редактировать
}
onClick={() => navigate(`/tests/${test.id}/take`)}
>
Пройти тест
{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')}
{versions.length > 1 && (
<>
История версий
dataSource={versions}
rowKey="id"
size="small"
pagination={false}
style={{ marginBottom: 24 }}
rowClassName={(record) => (record.id === test.id ? 'ant-table-row-selected' : '')}
columns={
[
{
title: 'Версия',
dataIndex: 'version',
width: 70,
render: (v: number) => v{v},
},
{
title: 'Статус',
dataIndex: 'is_active',
width: 130,
render: (active: boolean) =>
active ? (
Активная
) : (
Неактивная
),
},
{
title: 'Дата',
dataIndex: 'created_at',
width: 120,
render: (d: string) => new Date(d).toLocaleDateString('ru-RU'),
},
{
title: 'Вопросов',
dataIndex: 'questions_count',
width: 100,
align: 'center' as const,
},
{
title: 'Порог зачёта',
dataIndex: 'passing_score',
width: 120,
align: 'center' as const,
render: (s: number) => `${s}%`,
},
{
title: '',
key: 'action',
render: (_: unknown, record: TestListItem) => (
{record.id !== test.id && (
)}
{(record.id !== test.id || !record.is_active) && (
)}
),
},
] as ColumnsType
}
/>
>
)}
Вопросы ({test.questions.length})
{test.questions.map((question, index) => (
{index + 1}. {question.text}
(
{answer.is_correct ? (
) : (
)}
{answer.text}
)}
/>
))}
)
}