2026-01-07 13:03:50 +07:00
|
|
|
'use client'
|
|
|
|
|
|
2025-12-11 18:28:35 +07:00
|
|
|
import { useTranslations } from 'next-intl';
|
|
|
|
|
import { IconImageFile, IconVideoFile, IconAudioFile } from '@/app/ui/icons/icons';
|
2026-01-07 13:03:50 +07:00
|
|
|
import { useQuery } from '@tanstack/react-query';
|
|
|
|
|
import { getUserFilesInfo } from '@/app/actions/action';
|
|
|
|
|
import {convertBytes} from '@/app/lib/convertBytes';
|
|
|
|
|
|
2025-11-26 17:18:20 +07:00
|
|
|
export default function StatsGrid() {
|
2025-12-11 18:28:35 +07:00
|
|
|
const t = useTranslations("Global");
|
2025-11-26 17:18:20 +07:00
|
|
|
|
2026-01-07 13:03:50 +07:00
|
|
|
const {
|
|
|
|
|
data: filesInfo,
|
|
|
|
|
isLoading,
|
|
|
|
|
isError,
|
|
|
|
|
error,
|
|
|
|
|
} = useQuery({
|
|
|
|
|
queryKey: ['userFilesInfo'],
|
|
|
|
|
queryFn: getUserFilesInfo,
|
|
|
|
|
});
|
|
|
|
|
|
2025-12-11 18:28:35 +07:00
|
|
|
return (
|
2026-01-05 15:07:10 +07:00
|
|
|
<div className="block-wrapper stats-wrapper">
|
2025-12-11 18:28:35 +07:00
|
|
|
<h3>
|
|
|
|
|
{t('your-content')}
|
|
|
|
|
</h3>
|
|
|
|
|
<div className="stats-grid">
|
|
|
|
|
<div className="stats-item left-top-corner stats-header">
|
|
|
|
|
{t('content-type')}
|
|
|
|
|
</div>
|
|
|
|
|
<div className="stats-item stats-header">
|
|
|
|
|
{t('quantity')}
|
|
|
|
|
</div>
|
|
|
|
|
<div className="stats-item stats-header">
|
|
|
|
|
{t('size')}
|
|
|
|
|
</div>
|
|
|
|
|
<div className="stats-item stats-header">
|
|
|
|
|
{t('violations')}
|
|
|
|
|
</div>
|
|
|
|
|
<div className="stats-item last-column right-top-corner stats-header">
|
|
|
|
|
{t('checks')}
|
|
|
|
|
</div>
|
|
|
|
|
|
2025-12-18 17:21:18 +07:00
|
|
|
<div className="stats-item first-column second-row images">
|
2025-12-11 18:28:35 +07:00
|
|
|
<IconImageFile />
|
|
|
|
|
{t('images')}
|
|
|
|
|
</div>
|
2025-12-18 17:21:18 +07:00
|
|
|
<div className="stats-item second-row">
|
2026-01-20 16:53:11 +07:00
|
|
|
{filesInfo?.images_quantity ? filesInfo?.images_quantity : 0}
|
2025-12-11 18:28:35 +07:00
|
|
|
</div>
|
2025-12-18 17:21:18 +07:00
|
|
|
<div className="stats-item second-row">
|
2026-01-20 16:53:11 +07:00
|
|
|
{filesInfo?.images_size ? convertBytes(filesInfo?.images_size) : 0}
|
2025-12-11 18:28:35 +07:00
|
|
|
</div>
|
2025-12-18 17:21:18 +07:00
|
|
|
<div className="stats-item second-row">
|
2025-12-11 18:28:35 +07:00
|
|
|
0
|
|
|
|
|
</div>
|
2025-12-18 17:21:18 +07:00
|
|
|
<div className="stats-item second-row last-column">
|
2025-12-11 18:28:35 +07:00
|
|
|
0
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="stats-item first-column videos">
|
|
|
|
|
<IconVideoFile />
|
|
|
|
|
{t('videos')}
|
|
|
|
|
</div>
|
|
|
|
|
<div className="stats-item">
|
2026-01-20 16:53:11 +07:00
|
|
|
{filesInfo?.videos_quantity ? filesInfo?.videos_quantity : 0}
|
2025-12-11 18:28:35 +07:00
|
|
|
</div>
|
|
|
|
|
<div className="stats-item">
|
2026-01-20 16:53:11 +07:00
|
|
|
{filesInfo?.videos_size ? convertBytes(filesInfo?.videos_size) : 0}
|
2025-12-11 18:28:35 +07:00
|
|
|
</div>
|
|
|
|
|
<div className="stats-item">
|
|
|
|
|
0
|
|
|
|
|
</div>
|
|
|
|
|
<div className="stats-item last-column">
|
|
|
|
|
0
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="stats-item last-row left-bottom-corner first-column audio">
|
|
|
|
|
<IconAudioFile />
|
|
|
|
|
{t('audios')}
|
|
|
|
|
</div>
|
|
|
|
|
<div className="stats-item last-row">
|
2026-01-20 16:53:11 +07:00
|
|
|
{filesInfo?.audios_quantity ? filesInfo?.audios_quantity : 0}
|
2025-12-11 18:28:35 +07:00
|
|
|
</div>
|
|
|
|
|
<div className="stats-item last-row">
|
2026-01-20 16:53:11 +07:00
|
|
|
{filesInfo?.audios_size ? convertBytes(filesInfo?.audios_size) : 0}
|
2025-12-11 18:28:35 +07:00
|
|
|
</div>
|
|
|
|
|
<div className="stats-item last-row">
|
|
|
|
|
0
|
|
|
|
|
</div>
|
|
|
|
|
<div className="stats-item last-row last-column right-bottom-corner">
|
|
|
|
|
0
|
|
|
|
|
</div>
|
2025-11-26 17:18:20 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-12-11 18:28:35 +07:00
|
|
|
|
2025-11-26 17:18:20 +07:00
|
|
|
)
|
|
|
|
|
}
|