Files
web-Iot/src/pages/Downloads.tsx
2026-08-14 09:02:52 +08:00

122 lines
3.3 KiB
TypeScript

import React from 'react';
import { useTranslation } from 'react-i18next';
import {
Table,
Button,
DatePicker,
Space,
Typography,
Card,
Segmented,
Row,
Col,
} from 'antd';
import {
DownloadOutlined,
VideoCameraOutlined,
CalendarOutlined,
SearchOutlined
} from '@ant-design/icons';
const { Text, Title } = Typography;
const { RangePicker } = DatePicker;
export default function Downloads() {
const { t } = useTranslation();
const columns = [
{
title: t('video.fileDetails'),
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>
),
},
{
title: t('video.sourceDevice'),
dataIndex: 'deviceName',
key: 'deviceName',
render: (text: string) => <Text style={{ fontSize: 13 }}>{text}</Text>,
},
{
title: t('video.startEndTime'),
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>
),
},
{
title: t('video.capacity'),
dataIndex: 'size',
key: 'size',
render: (text: string) => <Text type="secondary" style={{ fontSize: 12 }}>{text}</Text>,
},
{
title: t('roles.actions'),
key: 'action',
align: 'right' as const,
render: () => (
<Button
type="link"
icon={<DownloadOutlined />}
style={{ fontSize: 11, fontWeight: 'bold' }}
>
{t('common.download')}
</Button>
),
},
];
return (
<div className="space-y-4">
<div className="flex items-center justify-between">
<Title level={5} style={{ margin: 0 }}>{t('video.videoReplayCenter')}</Title>
<Segmented
options={[t('video.allRecordings'), t('video.todayRecordings')]}
defaultValue={t('video.allRecordings')}
style={{ borderRadius: 2 }}
/>
</div>
<Card size="small" style={{ backgroundColor: '#fafafa', borderRadius: 2 }}>
<Row gutter={16} align="middle">
<Col>
<Space>
<CalendarOutlined style={{ color: 'rgba(0,0,0,0.45)' }} />
<Text strong type="secondary" style={{ fontSize: 11, textTransform: 'uppercase' }}>{t('video.timeSpan')}</Text>
</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 }}>
{t('video.onlineSearch')}
</Button>
</Col>
</Row>
</Card>
<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>
);
}