From e4d6df71a15dc3e0a87aaccc89f1b5f123a238d8 Mon Sep 17 00:00:00 2001 From: smanylov Date: Wed, 14 Jan 2026 12:23:07 +0700 Subject: [PATCH] add endpoins for dashboard-files-info --- .../ui/dashboard/new/dashboard-files-info.tsx | 107 +++++++++++------- src/i18n/messages/en.json | 6 +- src/i18n/messages/ru.json | 6 +- 3 files changed, 77 insertions(+), 42 deletions(-) diff --git a/src/app/ui/dashboard/new/dashboard-files-info.tsx b/src/app/ui/dashboard/new/dashboard-files-info.tsx index a466062..3204550 100644 --- a/src/app/ui/dashboard/new/dashboard-files-info.tsx +++ b/src/app/ui/dashboard/new/dashboard-files-info.tsx @@ -1,82 +1,109 @@ +'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'; + export default function DashboardFilesInfo() { + const t = useTranslations("Global"); + + const { + data: filesInfo, + isLoading, + isError, + error, + } = useQuery({ + queryKey: ['userFilesInfo'], + queryFn: getUserFilesInfo, + }); + return (
-
-
ИЗОБРАЖЕНИЯ
-
235
-
Ваши изображения
+
+
+ {t('images')} +
+
{filesInfo.images_quantity ? filesInfo.images_quantity : 0}
+
{t('your-image')}
- 💾 Размер - 340.5 МБ + {t('size')} + {filesInfo.images_size ? convertBytes(filesInfo.images_size) : 0}
- 🛡️ Защищено - 233 файлов + {t('checks')} + {filesInfo.images_check ? filesInfo.images_check : 0}
- ⚠️ Нарушений - 504 + {t('violations')} + {filesInfo.images_violations ? filesInfo.images_violations : 0}
-
-
ВИДЕО
-
25
-
Ваш видео контент
+
+
+ {t('videos')} +
+
{filesInfo.videos_quantity ? filesInfo.videos_quantity : 0}
+
{t('your-videos')}
- 💾 Размер - 196.9 МБ + {t('size')} + {filesInfo.videos_size ? convertBytes(filesInfo.videos_size) : 0}
- 🛡️ Защищено - 23 файлов + {t('checks')} + {filesInfo.videos_check ? filesInfo.videos_check : 0}
- ⚠️ Нарушений - 0 + {t('violations')} + {filesInfo.videos_violations ? filesInfo.videos_violations : 0}
-
-
АУДИО
-
43
-
Ваш аудио контент
+
+
+ {t('audios')} +
+
{filesInfo.audios_quantity ? filesInfo.audios_quantity : 0}
+
{t('your-audios')}
- 💾 Размер - 223.7 МБ + {t('size')} + {filesInfo.audios_size ? convertBytes(filesInfo.audios_size) : 0}
- 🛡️ Защищено - 36 файлов + {t('checks')} + {filesInfo.audios_check ? filesInfo.audios_check : 0}
- ⚠️ Нарушений - 0 + {t('violations')} + {filesInfo.audios_violations ? filesInfo.audios_violations : 0}
-
-
PDF-ФАЙЛЫ
-
73
-
Ваши PDF-файлы
+
+
+ {t('documents')} +
+
{filesInfo.documents_quantity ? filesInfo.documents_quantity : 0}
+
{t('your-documents')}
- 💾 Размер - 28.9 МБ + {t('size')} + {filesInfo.documents_check ? convertBytes(filesInfo.documents_check) : 0}
- 🛡️ Защищено - 70 файлов + {t('checks')} + {filesInfo.documents_check ? filesInfo.documents_check : 0}
- ⚠️ Нарушений - 0 + {t('violations')} + {filesInfo.documents_violations ? filesInfo.documents_violations : 0}
diff --git a/src/i18n/messages/en.json b/src/i18n/messages/en.json index facd2fd..304e07e 100644 --- a/src/i18n/messages/en.json +++ b/src/i18n/messages/en.json @@ -162,7 +162,11 @@ "failed-to-download-file": "Failed to download file", "file-is-downloading": "The file is downloading", "status": "status", - "refferal-program": "Referral program" + "refferal-program": "Referral program", + "your-image": "Your images", + "your-videos": "Your videos", + "your-audios": "Your audios", + "your-documents": "Your documents" }, "Login-register-form": { "and": "and", diff --git a/src/i18n/messages/ru.json b/src/i18n/messages/ru.json index 426f6e7..4e45131 100644 --- a/src/i18n/messages/ru.json +++ b/src/i18n/messages/ru.json @@ -162,7 +162,11 @@ "failed-to-download-file": "Не удалось скачать файл", "file-is-downloading": "Скачивается файл", "status": "статус", - "refferal-program": "Реферальная программа" + "refferal-program": "Реферальная программа", + "your-image": "Ваши изображения", + "your-videos": "Ваш видео", + "your-audios": "Ваш аудио", + "your-documents": "Ваши документы" }, "Login-register-form": { "and": "и",