2025-09-11 09:51:18 +08:00
|
|
|
import { formatDate } from '@/utils/date';
|
|
|
|
|
import { formatBytes } from '@/utils/file-util';
|
2026-03-11 11:27:20 +08:00
|
|
|
import { useTranslation } from 'react-i18next';
|
2025-09-11 09:51:18 +08:00
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
size: number;
|
|
|
|
|
name: string;
|
|
|
|
|
create_date: string;
|
2026-03-11 11:27:20 +08:00
|
|
|
className?: string;
|
2025-09-11 09:51:18 +08:00
|
|
|
};
|
|
|
|
|
|
2026-03-11 11:27:20 +08:00
|
|
|
export default ({ size, name, create_date, className }: Props) => {
|
2025-09-11 09:51:18 +08:00
|
|
|
const sizeName = formatBytes(size);
|
|
|
|
|
const dateStr = formatDate(create_date);
|
2026-03-11 11:27:20 +08:00
|
|
|
|
|
|
|
|
const { t } = useTranslation();
|
|
|
|
|
|
2025-09-11 09:51:18 +08:00
|
|
|
return (
|
2026-03-11 11:27:20 +08:00
|
|
|
<header className={className}>
|
|
|
|
|
<h2 className="text-2xl font-semibold truncate">{name}</h2>
|
|
|
|
|
<dl
|
|
|
|
|
className="
|
|
|
|
|
text-text-secondary text-sm flex
|
|
|
|
|
[&_dt]:after:content-[':'] [&_dt]:after:me-[.5ch]
|
|
|
|
|
[&_dd]:me-[2ch]"
|
|
|
|
|
>
|
|
|
|
|
<dt>{t('chunk.size')}</dt>
|
|
|
|
|
<dd>{sizeName}</dd>
|
|
|
|
|
|
|
|
|
|
<dt>{t('chunk.uploadedTime')}</dt>
|
|
|
|
|
<dd>{dateStr}</dd>
|
|
|
|
|
</dl>
|
|
|
|
|
</header>
|
2025-09-11 09:51:18 +08:00
|
|
|
);
|
|
|
|
|
};
|