diff --git a/src/app/lib/convertBytes.ts b/src/app/lib/convertBytes.ts new file mode 100644 index 0000000..b1886fe --- /dev/null +++ b/src/app/lib/convertBytes.ts @@ -0,0 +1,19 @@ +export function convertBytes(bytes: number) { + if (!bytes) { + return 0; + } + + const units = ['B', 'KB', 'MB', 'GB', 'TB']; + + if (bytes === 0) return '0 B'; + + let i = 0; + let value = bytes; + + while (value >= 1024 && i < units.length - 1) { + value /= 1024; + i++; + } + + return `${value.toFixed(1)} ${units[i]}`; +} diff --git a/src/app/lib/formatDate.ts b/src/app/lib/formatDate.ts new file mode 100644 index 0000000..0fa749c --- /dev/null +++ b/src/app/lib/formatDate.ts @@ -0,0 +1,25 @@ +// Форматирование даты из timestamp +export const formatDate = (timestamp: number | string) => { + if (!timestamp) { + return '---' + } + + const date = new Date(timestamp); + const day = date.getDate().toString().padStart(2, '0'); + const month = (date.getMonth() + 1).toString().padStart(2, '0'); + const year = date.getFullYear(); + + return `${day}.${month}.${year}`; +}; + +export const formatDateTime = (timestamp: number | string) => { + if (!timestamp) { + return '---' + } + + const date = new Date(timestamp); + const hours = date.getHours().toString().padStart(2, '0'); + const minutes = date.getMinutes().toString().padStart(2, '0'); + + return `${hours}:${minutes}`; +}; \ No newline at end of file diff --git a/src/app/ui/dashboard/general-info.tsx/general-info-users.tsx b/src/app/ui/dashboard/general-info.tsx/general-info-users.tsx index 2194c61..c3d58ea 100644 --- a/src/app/ui/dashboard/general-info.tsx/general-info-users.tsx +++ b/src/app/ui/dashboard/general-info.tsx/general-info-users.tsx @@ -16,6 +16,21 @@ export default function GeneralInfoUsers() { +
+
+ Новых за 30 дней +
0
+
+
+ Новых за предыдущие 30 дней +
0
+
+
+ Дельта +
0
+
+
+
Новых за текущий месяц @@ -25,9 +40,6 @@ export default function GeneralInfoUsers() { Новых за прошлый месяц
0
-
- -
Дельта
0
diff --git a/src/app/ui/dashboard/users-top.tsx b/src/app/ui/dashboard/users-top.tsx index 4b6b087..90a277f 100644 --- a/src/app/ui/dashboard/users-top.tsx +++ b/src/app/ui/dashboard/users-top.tsx @@ -14,6 +14,7 @@ export default function UsersTop() { +
Сидоров Станислав Андреевич
@@ -22,6 +23,7 @@ export default function UsersTop() { 0 0 MB +
Валерка
@@ -30,6 +32,7 @@ export default function UsersTop() { 0 0 MB +
Игорь Викторович
@@ -38,6 +41,7 @@ export default function UsersTop() { 0 0 MB +
Синицын Игорь Владимирович
@@ -46,6 +50,16 @@ export default function UsersTop() { 0 0 MB + + + +
test test
+
test@no-copy.ru
+ + 0 + 0 MB + +