Files
web-Iot/src/pages/Downloads.tsx

122 lines
3.3 KiB
TypeScript
Raw Normal View History

2026-04-17 17:20:41 +08:00
import React from 'react';
2026-08-12 11:29:44 +08:00
import { useTranslation } from 'react-i18next';
2026-05-15 17:32:58 +08:00
import {
Table,
Button,
DatePicker,
Space,
Typography,
Card,
Segmented,
Row,
Col,
2026-04-17 17:20:41 +08:00
} from 'antd';
2026-05-15 17:32:58 +08:00
import {
DownloadOutlined,
VideoCameraOutlined,
CalendarOutlined,
SearchOutlined
2026-04-17 17:20:41 +08:00
} from '@ant-design/icons';
const { Text, Title } = Typography;
const { RangePicker } = DatePicker;
export default function Downloads() {
2026-08-12 11:29:44 +08:00
const { t } = useTranslation();
2026-05-15 17:32:58 +08:00
const columns = [
{
2026-08-14 09:02:52 +08:00
title: t('video.fileDetails'),
2026-05-15 17:32:58 +08:00
key: 'file',
render: (record: any) => (
<Space size="middle">
<div className="w-8 h-8 bg-blue-50 text-blue-500 rounded flex items-center justify-center border border-blue-100">
<VideoCameraOutlined style={{ fontSize: 16 }} />
</div>
<Space direction="vertical" size={0}>
<Text strong style={{ fontSize: 13 }}>ROB_{record.id}_RAW.mp4</Text>
<Text type="secondary" style={{ fontSize: 10, fontFamily: 'monospace', fontStyle: 'italic' }}>Cloud-Storage-01</Text>
</Space>
</Space>
),
},
{
2026-08-14 09:02:52 +08:00
title: t('video.sourceDevice'),
2026-05-15 17:32:58 +08:00
dataIndex: 'deviceName',
key: 'deviceName',
render: (text: string) => <Text style={{ fontSize: 13 }}>{text}</Text>,
},
{
2026-08-14 09:02:52 +08:00
title: t('video.startEndTime'),
2026-05-15 17:32:58 +08:00
key: 'duration',
render: (record: any) => (
<Space direction="vertical" size={0}>
<Text type="secondary" style={{ fontSize: 11, fontFamily: 'monospace' }}>{record.startTime.split(' ')[1]}</Text>
<div className="h-[1px] w-4 bg-gray-200" />
<Text type="secondary" style={{ fontSize: 11, fontFamily: 'monospace' }}>{record.endTime.split(' ')[1]}</Text>
</Space>
),
},
{
2026-08-14 09:02:52 +08:00
title: t('video.capacity'),
2026-05-15 17:32:58 +08:00
dataIndex: 'size',
key: 'size',
render: (text: string) => <Text type="secondary" style={{ fontSize: 12 }}>{text}</Text>,
},
{
2026-08-12 11:29:44 +08:00
title: t('roles.actions'),
2026-05-15 17:32:58 +08:00
key: 'action',
align: 'right' as const,
render: () => (
<Button
type="link"
icon={<DownloadOutlined />}
style={{ fontSize: 11, fontWeight: 'bold' }}
>
2026-08-14 09:02:52 +08:00
{t('common.download')}
2026-05-15 17:32:58 +08:00
</Button>
),
},
];
2026-04-17 17:20:41 +08:00
2026-05-15 17:32:58 +08:00
return (
<div className="space-y-4">
<div className="flex items-center justify-between">
2026-08-14 09:02:52 +08:00
<Title level={5} style={{ margin: 0 }}>{t('video.videoReplayCenter')}</Title>
2026-05-15 17:32:58 +08:00
<Segmented
2026-08-14 09:02:52 +08:00
options={[t('video.allRecordings'), t('video.todayRecordings')]}
defaultValue={t('video.allRecordings')}
2026-05-15 17:32:58 +08:00
style={{ borderRadius: 2 }}
/>
</div>
2026-04-17 17:20:41 +08:00
2026-05-15 17:32:58 +08:00
<Card size="small" style={{ backgroundColor: '#fafafa', borderRadius: 2 }}>
<Row gutter={16} align="middle">
<Col>
<Space>
<CalendarOutlined style={{ color: 'rgba(0,0,0,0.45)' }} />
2026-08-14 09:02:52 +08:00
<Text strong type="secondary" style={{ fontSize: 11, textTransform: 'uppercase' }}>{t('video.timeSpan')}</Text>
2026-05-15 17:32:58 +08:00
</Space>
</Col>
<Col>
<RangePicker size="small" style={{ borderRadius: 2 }} />
</Col>
<Col flex="auto" className="text-right">
<Button type="primary" size="small" icon={<SearchOutlined />} style={{ borderRadius: 2 }}>
2026-08-14 09:02:52 +08:00
{t('video.onlineSearch')}
2026-05-15 17:32:58 +08:00
</Button>
</Col>
</Row>
</Card>
2026-04-17 17:20:41 +08:00
2026-05-15 17:32:58 +08:00
<Card styles={{ body: { padding: 0 } }} className="overflow-hidden">
<Table
size="small"
columns={columns}
dataSource={VIDEOS.map(v => ({ ...v, key: v.id }))}
pagination={{ pageSize: 12, size: 'small' }}
/>
</Card>
</div>
);
2026-04-17 17:20:41 +08:00
}