fix: move version history section below header on test edit page

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Aleksey Razorvin
2026-03-21 13:37:14 +05:00
parent 6b52bca55f
commit 6178e6cb5f
+59 -59
View File
@@ -127,6 +127,65 @@ export default function TestEdit() {
style={{ marginBottom: 16 }}
/>
{versions.length > 1 && (
<>
<Title level={3}>История версий</Title>
<Table<TestListItem>
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) => (
<Space>
<Tag color={record.id === test.id ? 'blue' : 'default'}>v{v}</Tag>
{record.id === test.id && <Text type="secondary">(текущая)</Text>}
</Space>
),
},
{
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 ? (
<Button size="small" onClick={() => navigate(`/tests/${record.id}/edit`)}>
Открыть
</Button>
) : null,
},
] as ColumnsType<TestListItem>
}
/>
</>
)}
<Title level={2}>{test.title}</Title>
{test.description && (
@@ -182,65 +241,6 @@ export default function TestEdit() {
</Card>
))}
{versions.length > 1 && (
<>
<Title level={3} style={{ marginTop: 32 }}>
История версий
</Title>
<Table<TestListItem>
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) => (
<Space>
<Tag color={record.id === test.id ? 'blue' : 'default'}>v{v}</Tag>
{record.id === test.id && <Text type="secondary">(текущая)</Text>}
</Space>
),
},
{
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 ? (
<Button size="small" onClick={() => navigate(`/tests/${record.id}/edit`)}>
Открыть
</Button>
) : null,
},
] as ColumnsType<TestListItem>
}
/>
</>
)}
</div>
)
}