Files
no-copy-frontend/src/app/ui/dashboard/new/dashboard-files-info.tsx
T

112 lines
4.5 KiB
TypeScript
Raw Normal View History

2026-01-14 12:23:07 +07:00
'use client'
import { useTranslations } from 'next-intl';
import { useQuery } from '@tanstack/react-query';
import { getUserFilesInfo } from '@/app/actions/action';
import {convertBytes} from '@/app/lib/convertBytes';
2026-01-13 15:29:34 +07:00
export default function DashboardFilesInfo() {
2026-01-14 12:23:07 +07:00
const t = useTranslations("Global");
const {
data: filesInfo,
isLoading,
isError,
error,
} = useQuery({
queryKey: ['userFilesInfo'],
queryFn: getUserFilesInfo,
});
2026-01-13 15:29:34 +07:00
return (
<div className="dashboard-files-info">
2026-01-14 12:23:07 +07:00
<div className="type-card images">
<div className="stat-type">
{t('images')}
</div>
2026-01-20 16:53:11 +07:00
<div className="stat-value">{filesInfo?.images_quantity ? filesInfo?.images_quantity : 0}</div>
2026-01-14 12:23:07 +07:00
<div className="stat-label">{t('your-image')}</div>
2026-01-13 15:29:34 +07:00
<div className="type-card-stats">
<div className="type-card-stat-row">
2026-01-14 12:23:07 +07:00
<span className="type-card-stat-label">{t('size')}</span>
2026-01-20 16:53:11 +07:00
<span className="type-card-stat-value">{filesInfo?.images_size ? convertBytes(filesInfo?.images_size) : 0}</span>
2026-01-13 15:29:34 +07:00
</div>
<div className="type-card-stat-row">
2026-01-14 12:23:07 +07:00
<span className="type-card-stat-label">{t('checks')}</span>
2026-01-20 16:53:11 +07:00
<span className="type-card-stat-value">{filesInfo?.images_check ? filesInfo?.images_check : 0}</span>
2026-01-13 15:29:34 +07:00
</div>
<div className="type-card-stat-row">
2026-01-14 12:23:07 +07:00
<span className="type-card-stat-label">{t('violations')}</span>
2026-01-20 16:53:11 +07:00
<span className="type-card-stat-value">{filesInfo?.images_violations ? filesInfo?.images_violations : 0}</span>
2026-01-13 15:29:34 +07:00
</div>
</div>
</div>
2026-01-14 12:23:07 +07:00
<div className="type-card videos">
<div className="stat-type">
{t('videos')}
</div>
2026-01-20 16:53:11 +07:00
<div className="stat-value">{filesInfo?.videos_quantity ? filesInfo?.videos_quantity : 0}</div>
2026-01-14 12:23:07 +07:00
<div className="stat-label">{t('your-videos')}</div>
2026-01-13 15:29:34 +07:00
<div className="type-card-stats">
<div className="type-card-stat-row">
2026-01-14 12:23:07 +07:00
<span className="type-card-stat-label">{t('size')}</span>
2026-01-20 16:53:11 +07:00
<span className="type-card-stat-value">{filesInfo?.videos_size ? convertBytes(filesInfo?.videos_size) : 0}</span>
2026-01-13 15:29:34 +07:00
</div>
<div className="type-card-stat-row">
2026-01-14 12:23:07 +07:00
<span className="type-card-stat-label">{t('checks')}</span>
2026-01-20 16:53:11 +07:00
<span className="type-card-stat-value">{filesInfo?.videos_check ? filesInfo?.videos_check : 0}</span>
2026-01-13 15:29:34 +07:00
</div>
<div className="type-card-stat-row">
2026-01-14 12:23:07 +07:00
<span className="type-card-stat-label">{t('violations')}</span>
2026-01-20 16:53:11 +07:00
<span className="type-card-stat-value">{filesInfo?.videos_violations ? filesInfo?.videos_violations : 0}</span>
2026-01-13 15:29:34 +07:00
</div>
</div>
</div>
2026-01-14 12:23:07 +07:00
<div className="type-card audio">
<div className="stat-type">
{t('audios')}
</div>
2026-01-20 16:53:11 +07:00
<div className="stat-value">{filesInfo?.audios_quantity ? filesInfo?.audios_quantity : 0}</div>
2026-01-14 12:23:07 +07:00
<div className="stat-label">{t('your-audios')}</div>
2026-01-13 15:29:34 +07:00
<div className="type-card-stats">
<div className="type-card-stat-row">
2026-01-14 12:23:07 +07:00
<span className="type-card-stat-label">{t('size')}</span>
2026-01-20 16:53:11 +07:00
<span className="type-card-stat-value">{filesInfo?.audios_size ? convertBytes(filesInfo?.audios_size) : 0}</span>
2026-01-13 15:29:34 +07:00
</div>
<div className="type-card-stat-row">
2026-01-14 12:23:07 +07:00
<span className="type-card-stat-label">{t('checks')}</span>
2026-01-20 16:53:11 +07:00
<span className="type-card-stat-value">{filesInfo?.audios_check ? filesInfo?.audios_check : 0}</span>
2026-01-13 15:29:34 +07:00
</div>
<div className="type-card-stat-row">
2026-01-14 12:23:07 +07:00
<span className="type-card-stat-label">{t('violations')}</span>
2026-01-20 16:53:11 +07:00
<span className="type-card-stat-value">{filesInfo?.audios_violations ? filesInfo?.audios_violations : 0}</span>
2026-01-13 15:29:34 +07:00
</div>
</div>
</div>
2026-01-14 12:23:07 +07:00
<div className="type-card scripts">
<div className="stat-type">
{t('documents')}
</div>
2026-01-20 16:53:11 +07:00
<div className="stat-value">{filesInfo?.documents_quantity ? filesInfo?.documents_quantity : 0}</div>
2026-01-14 12:23:07 +07:00
<div className="stat-label">{t('your-documents')}</div>
2026-01-13 15:29:34 +07:00
<div className="type-card-stats">
<div className="type-card-stat-row">
2026-01-14 12:23:07 +07:00
<span className="type-card-stat-label">{t('size')}</span>
2026-01-20 16:53:11 +07:00
<span className="type-card-stat-value">{filesInfo?.documents_check ? convertBytes(filesInfo?.documents_check) : 0}</span>
2026-01-13 15:29:34 +07:00
</div>
<div className="type-card-stat-row">
2026-01-14 12:23:07 +07:00
<span className="type-card-stat-label">{t('checks')}</span>
2026-01-20 16:53:11 +07:00
<span className="type-card-stat-value">{filesInfo?.documents_check ? filesInfo?.documents_check : 0}</span>
2026-01-13 15:29:34 +07:00
</div>
<div className="type-card-stat-row">
2026-01-14 12:23:07 +07:00
<span className="type-card-stat-label">{t('violations')}</span>
2026-01-20 16:53:11 +07:00
<span className="type-card-stat-value">{filesInfo?.documents_violations ? filesInfo?.documents_violations : 0}</span>
2026-01-13 15:29:34 +07:00
</div>
</div>
</div>
</div>
)
}