diff --git a/frontend/src/pages/TestEdit/index.tsx b/frontend/src/pages/TestEdit/index.tsx index 20b3b70..8e3b6ed 100644 --- a/frontend/src/pages/TestEdit/index.tsx +++ b/frontend/src/pages/TestEdit/index.tsx @@ -127,6 +127,65 @@ export default function TestEdit() { style={{ marginBottom: 16 }} /> + {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: 90, + render: (v: number, record: TestListItem) => ( + + v{v} + {record.id === test.id && (текущая)} + + ), + }, + { + 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', + width: 100, + render: (_: unknown, record: TestListItem) => + record.id !== test.id ? ( + + ) : null, + }, + ] as ColumnsType + } + /> + + )} + {test.title} {test.description && ( @@ -182,65 +241,6 @@ export default function TestEdit() { ))} - {versions.length > 1 && ( - <> - - История версий - - - dataSource={versions} - rowKey="id" - size="small" - pagination={false} - rowClassName={(record) => (record.id === test.id ? 'ant-table-row-selected' : '')} - columns={ - [ - { - title: 'Версия', - dataIndex: 'version', - width: 90, - render: (v: number, record: TestListItem) => ( - - v{v} - {record.id === test.id && (текущая)} - - ), - }, - { - 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', - width: 100, - render: (_: unknown, record: TestListItem) => - record.id !== test.id ? ( - - ) : null, - }, - ] as ColumnsType - } - /> - - )} ) }