37 lines
1.9 KiB
TypeScript
37 lines
1.9 KiB
TypeScript
|
import { Typography, Space, Skeleton } from 'antd';
|
|||
|
import { FileOutlined } from '@ant-design/icons';
|
|||
|
import DashboardCard from '@web/src/components/presentation/dashboard-card';
|
|||
|
import ActivityItem from './ActivityItem';
|
|||
|
import { useDashboardContext } from '../DashboardContext';
|
|||
|
import { ShareCodeResponse } from '../../quick-file/quickFileContext';
|
|||
|
import { useNavigate } from 'react-router-dom';
|
|||
|
const { Title, Text } = Typography;
|
|||
|
export default function Activate() {
|
|||
|
const { shareCodeList, isShareCodeListLoading } = useDashboardContext();
|
|||
|
const navigate = useNavigate()
|
|||
|
const handleClick = (item: ShareCodeResponse) => {
|
|||
|
navigate(`/manage/share-code?keyword=${encodeURIComponent(item.code)}`)
|
|||
|
}
|
|||
|
return <>
|
|||
|
<div className="mt-6">
|
|||
|
<Title level={4} className="mb-4">最新上传活动</Title>
|
|||
|
<DashboardCard className="w-full">
|
|||
|
<Space direction="vertical" className="w-full" size="middle">
|
|||
|
{isShareCodeListLoading ?
|
|||
|
<Skeleton active />
|
|||
|
:
|
|||
|
shareCodeList.map((item) => (
|
|||
|
<div className='my-1 cursor-pointer' onClick={() => handleClick(item)}>
|
|||
|
<ActivityItem
|
|||
|
key={item.id}
|
|||
|
icon={<FileOutlined className="text-blue-500" />}
|
|||
|
title={`来自${item.uploadIp}的用户上传了文件:"${item.fileName}",文件大小:${Math.max(Number(item.resource.meta.size) / 1024 / 1024, 0.01).toFixed(2)}MB,分享码:${item.code}`}
|
|||
|
time={item.createdAt?.toLocaleString()}
|
|||
|
/>
|
|||
|
</div>
|
|||
|
))}
|
|||
|
</Space>
|
|||
|
</DashboardCard>
|
|||
|
</div>
|
|||
|
</>
|
|||
|
}
|