From b5b66695df4d13a6cce01106397472f9cc1b1d72 Mon Sep 17 00:00:00 2001 From: smanylov Date: Fri, 12 Dec 2025 11:00:23 +0700 Subject: [PATCH] add translate --- src/app/components/PieChartComponent.tsx | 8 +- src/app/styles/dashboard.scss | 89 ++------------------ src/app/ui/dashboard/activity-chart.tsx | 72 ++++++++++++++++ src/app/ui/dashboard/protection-overview.tsx | 24 +++--- src/app/ui/header/headerPanel.tsx | 11 ++- src/app/ui/header/userMenuButton.tsx | 12 +-- src/app/ui/nav-link-dropdown.tsx | 12 ++- src/app/ui/nav-links.tsx | 86 ++++++++++--------- src/i18n/messages/en.json | 25 +++++- src/i18n/messages/ru.json | 25 +++++- 10 files changed, 215 insertions(+), 149 deletions(-) diff --git a/src/app/components/PieChartComponent.tsx b/src/app/components/PieChartComponent.tsx index df09dc2..e6431a4 100644 --- a/src/app/components/PieChartComponent.tsx +++ b/src/app/components/PieChartComponent.tsx @@ -1,3 +1,4 @@ +import { useTranslations } from 'next-intl'; import { PieChart, Pie, Cell, ResponsiveContainer } from 'recharts'; export const PieChartComponent = ({ data }: { @@ -7,7 +8,8 @@ export const PieChartComponent = ({ data }: { color: string }[] }) => { - console.log(data) + const t = useTranslations('Global'); + return (
- из + {t('out-of')} 0 @@ -42,7 +44,7 @@ export const PieChartComponent = ({ data }: { {data.map((entry, index) => (
- {entry.name} + {t(entry.name)}
))}
diff --git a/src/app/styles/dashboard.scss b/src/app/styles/dashboard.scss index 83ec0d7..369a144 100644 --- a/src/app/styles/dashboard.scss +++ b/src/app/styles/dashboard.scss @@ -130,7 +130,7 @@ .stats-wrapper { border-radius: 20px; overflow: hidden; - background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); + background: white; box-shadow: 0 4px 20px #00000014; margin-bottom: 30px; padding: 20px; @@ -138,14 +138,13 @@ h3 { font-size: 20px; margin-bottom: 10px; - color: white; } } .stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); - --boder-collor: #e4eaf028; + --boder-collor: #f3f4f6; .stats-item.images { --card-color-1: #f08c00; @@ -162,32 +161,32 @@ .stats-item { border: 1px solid var(--boder-collor); border-right: none; + border-left: none; border-bottom: none; display: flex; justify-content: center; align-items: center; height: 40px; background: #ffffff1a; - color: white; &.stats-header { - /* background: linear-gradient(180deg, #6366f1 0%, #8587f7 80%); */ - color: white; + background: #f9fafb; border-left: none; font-size: 18px; } &.first-column { font-size: 18px; - border-left: 1px solid var(--boder-collor); + justify-content: start; + padding-left: 20px; .icon { color: var(--card-color-1); + margin-right: 10px; } } &.last-column { - border-right: 1px solid var(--boder-collor); } &.last-row { @@ -197,6 +196,8 @@ &.left-top-corner { border-top-left-radius: 10px; border-left: 1px solid var(--boder-collor); + justify-content: start; + padding-left: 20px; } &.right-top-corner { @@ -347,75 +348,3 @@ } } } - -.activity-chart { - background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); - color: white; - border-radius: 20px; - padding: 25px; - box-shadow: 0 8px 30px rgba(102, 126, 234, 0.3); - border: none; - position: relative; - overflow: hidden; - - h3 { - margin: 0 0 15px 0; - font-size: 18px; - color: white; - position: relative; - z-index: 1; - } - - .activity-grid { - display: grid; - grid-template-columns: repeat(7, 1fr); - gap: 12px; - margin: 20px 0; - position: relative; - z-index: 1; - } - - .activity-day { - text-align: center; - padding: 15px; - background: rgba(255, 255, 255, 0.15); - border-radius: 12px; - border: 1px solid rgba(255, 255, 255, 0.2); - transition: all 0.3s ease; - backdrop-filter: blur(10px); - position: relative; - - &:hover { - background: rgba(255, 255, 255, 0.25); - transform: translateY(-3px); - box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2); - } - } - - .activity-day-label { - font-size: 12px; - opacity: 0.8; - margin-bottom: 8px; - font-weight: 500; - } - - .activity-day-value { - font-size: 20px; - font-weight: 700; - margin-bottom: 4px; - } - - .activity-day-files { - font-size: 10px; - opacity: 0.7; - } - - .activity-chart-footer { - text-align: center; - font-size: 12px; - opacity: 0.8; - position: relative; - z-index: 1; - margin-top: 15px; - } -} \ No newline at end of file diff --git a/src/app/ui/dashboard/activity-chart.tsx b/src/app/ui/dashboard/activity-chart.tsx index 726f853..0cd0087 100644 --- a/src/app/ui/dashboard/activity-chart.tsx +++ b/src/app/ui/dashboard/activity-chart.tsx @@ -1,5 +1,77 @@ /* removed */ +/* .activity-chart { + background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); + color: white; + border-radius: 20px; + padding: 25px; + box-shadow: 0 8px 30px rgba(102, 126, 234, 0.3); + border: none; + position: relative; + overflow: hidden; + + h3 { + margin: 0 0 15px 0; + font-size: 18px; + color: white; + position: relative; + z-index: 1; + } + + .activity-grid { + display: grid; + grid-template-columns: repeat(7, 1fr); + gap: 12px; + margin: 20px 0; + position: relative; + z-index: 1; + } + + .activity-day { + text-align: center; + padding: 15px; + background: rgba(255, 255, 255, 0.15); + border-radius: 12px; + border: 1px solid rgba(255, 255, 255, 0.2); + transition: all 0.3s ease; + backdrop-filter: blur(10px); + position: relative; + + &:hover { + background: rgba(255, 255, 255, 0.25); + transform: translateY(-3px); + box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2); + } + } + + .activity-day-label { + font-size: 12px; + opacity: 0.8; + margin-bottom: 8px; + font-weight: 500; + } + + .activity-day-value { + font-size: 20px; + font-weight: 700; + margin-bottom: 4px; + } + + .activity-day-files { + font-size: 10px; + opacity: 0.7; + } + + .activity-chart-footer { + text-align: center; + font-size: 12px; + opacity: 0.8; + position: relative; + z-index: 1; + margin-top: 15px; + } +} */ + export default function ActivityChart() { return (
diff --git a/src/app/ui/dashboard/protection-overview.tsx b/src/app/ui/dashboard/protection-overview.tsx index e1c8130..5e4319c 100644 --- a/src/app/ui/dashboard/protection-overview.tsx +++ b/src/app/ui/dashboard/protection-overview.tsx @@ -2,45 +2,49 @@ import { useState } from 'react'; import { PieChartComponent } from '@/app/components/PieChartComponent'; +import { useTranslations } from 'next-intl'; const data = [ - { name: 'Изображения', value: 33, color: '#f08c00' }, - { name: 'Видео', value: 50, color: '#2f9e44' }, - { name: 'Аудио', value: 25, color: '#1971c2' }, + { name: 'images', value: 33, color: '#f08c00' }, + { name: 'videos', value: 50, color: '#2f9e44' }, + { name: 'audios', value: 25, color: '#1971c2' }, ]; export default function ProtectionOverview() { const [isOpen, setIsOpen] = useState(false); + const t = useTranslations('Global'); return (
-

Защита вашего контента

-

Текущий статус защищенности и активности системы мониторинга

+

{t('protecting-your-content')}

+

{t('current-status-of')}

0
-
Всего файлов
+
{t('total-files')}
0
-
проверок
+
{t('check')}
0
-
нарушений
+
{t('violations')}
{isOpen ? (
- +
) : (
0 / 0
-
Использовано места на диске
+
+ {t('disk-space-used')} +
)}
diff --git a/src/app/ui/header/headerPanel.tsx b/src/app/ui/header/headerPanel.tsx index 1e75321..2b7dc12 100644 --- a/src/app/ui/header/headerPanel.tsx +++ b/src/app/ui/header/headerPanel.tsx @@ -2,22 +2,27 @@ import NotificationsButton from './notificationsButton'; import UserMenuButton from './userMenuButton'; import Link from 'next/link'; import LanguageSwitcher from '@/app/components/LanguageSwitcher'; +import { useTranslations } from 'next-intl'; export default function HeaderPanel() { + const t = useTranslations("Global"); + return (
- + -
+
800 - токенов + + {t('tokens')} +
diff --git a/src/app/ui/header/userMenuButton.tsx b/src/app/ui/header/userMenuButton.tsx index 98336d6..077748d 100644 --- a/src/app/ui/header/userMenuButton.tsx +++ b/src/app/ui/header/userMenuButton.tsx @@ -6,10 +6,12 @@ import Link from 'next/link'; import { getUserData } from '@/app/actions/action'; import { useQuery } from '@tanstack/react-query'; import { logout } from '@/app/actions/auth'; +import { useTranslations } from 'next-intl'; export default function UserMenuButton() { const [isOpen, setIsOpen] = useState(false); const menuRef = useRef(null); + const t = useTranslations("Global"); const { data: userData, isLoading, @@ -61,12 +63,12 @@ export default function UserMenuButton() { {userData?.email ? userData.email : ''}
- Тариф: + {t('rate')}: {userData?.subscriptionType ? userData.subscriptionType : ''}
- Истекает: 00.00.00 + {t('expires')}: 00.00.00
@@ -76,13 +78,13 @@ export default function UserMenuButton() { - Настройки + {t('settings')} - Помощь + {t('help')}
@@ -98,7 +100,7 @@ export default function UserMenuButton() { - Выйти + {t('exit')} diff --git a/src/app/ui/nav-link-dropdown.tsx b/src/app/ui/nav-link-dropdown.tsx index c083c02..53008cc 100644 --- a/src/app/ui/nav-link-dropdown.tsx +++ b/src/app/ui/nav-link-dropdown.tsx @@ -3,10 +3,12 @@ import { useState, useRef } from 'react'; import Link from 'next/link'; import clsx from 'clsx'; import { usePathname } from 'next/navigation'; +import { useTranslations } from 'next-intl'; export default function DropDownList() { const pathname = usePathname(); const [dropDownExpanded, setDropDownExpanded] = useState(false); + const t = useTranslations('Global'); function dropDownHandler() { setDropDownExpanded(!dropDownExpanded); @@ -14,15 +16,15 @@ export default function DropDownList() { const links = [ { - name: 'Маркировка фото', + name: t('photo-marking'), href: '/pages/marking-photo' }, { - name: 'Маркировка видео', + name: t('video-marking'), href: '/pages/marking-video' }, { - name: 'Маркировка аудио', + name: t('audio-marking'), href: '/pages/marking-audio' } ]; @@ -40,7 +42,9 @@ export default function DropDownList() { -

Маркировка

+

+ {t('marking')} +

diff --git a/src/app/ui/nav-links.tsx b/src/app/ui/nav-links.tsx index c459d05..4d7aebe 100644 --- a/src/app/ui/nav-links.tsx +++ b/src/app/ui/nav-links.tsx @@ -7,47 +7,49 @@ import styles from '@/app/styles/ui.module.scss' import Logo from '@/app/ui/logo'; import DropDownList from '@/app/ui/nav-link-dropdown'; import { logout } from '@/app/actions/auth'; - -const links = [ - { - name: 'Отчёты', - href: '/pages/reports', - img: 'M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z' - }, - { - name: 'Настройка', - href: '/pages/settings', - img: 'M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.82,11.69,4.82,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z' - }, - { - name: 'Мой контент', - href: '/pages/emptypage', - img: 'M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.68C10.96 2.54 10 2 9 2 7.34 2 6 3.34 6 5c0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zM9 4c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1z' - }, - { - name: 'Реферальная программа', - href: '/pages/emptypage', - img: 'M16 4c0-1.11.89-2 2-2s2 .89 2 2-.89 2-2 2-2-.89-2-2zm4 18v-6h2.5l-2.54-7.63A1.5 1.5 0 0 0 18.54 8H16c-.8 0-1.54.37-2 1l-3 4v2h2l2.54-3.82L16.5 18H20z' - }, - { - name: 'Нарушения', - href: '/pages/emptypage', - img: 'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z' - }, - { - name: 'Поиск', - href: '/pages/emptypage', - img: 'M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z' - }, - { - name: 'API', - href: '/pages/emptypage', - img: 'M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0L19.2 12l-4.6-4.6L16 6l6 6-6 6-1.4-1.4z' - } -]; +import { useTranslations } from 'next-intl'; export default function NavLinks() { const pathname = usePathname(); + const t = useTranslations('Global'); + + const links = [ + { + name: t('reports'), + href: '/pages/reports', + img: 'M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z' + }, + { + name: t('settings'), + href: '/pages/settings', + img: 'M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.82,11.69,4.82,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z' + }, + { + name: t('my-content'), + href: '/pages/emptypage', + img: 'M20 6h-2.18c.11-.31.18-.65.18-1a2.996 2.996 0 0 0-5.5-1.65l-.5.67-.5-.68C10.96 2.54 10 2 9 2 7.34 2 6 3.34 6 5c0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zM9 4c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1z' + }, + { + name: t('referral-program'), + href: '/pages/emptypage', + img: 'M16 4c0-1.11.89-2 2-2s2 .89 2 2-.89 2-2 2-2-.89-2-2zm4 18v-6h2.5l-2.54-7.63A1.5 1.5 0 0 0 18.54 8H16c-.8 0-1.54.37-2 1l-3 4v2h2l2.54-3.82L16.5 18H20z' + }, + { + name: t('violations'), + href: '/pages/emptypage', + img: 'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z' + }, + { + name: t('search'), + href: '/pages/emptypage', + img: 'M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z' + }, + { + name: 'API', + href: '/pages/emptypage', + img: 'M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0L19.2 12l-4.6-4.6L16 6l6 6-6 6-1.4-1.4z' + } + ]; return (
@@ -55,7 +57,7 @@ export default function NavLinks() {
    -

    Главная

    +

    {t('home')}

    @@ -92,7 +94,7 @@ export default function NavLinks() { ); })} { @@ -103,7 +105,7 @@ export default function NavLinks() { -

    Выход

    +

    {t('exit')}

diff --git a/src/i18n/messages/en.json b/src/i18n/messages/en.json index 83daf4e..ac310ec 100644 --- a/src/i18n/messages/en.json +++ b/src/i18n/messages/en.json @@ -12,9 +12,32 @@ "size": "Size", "violations": "Violations", "checks": "Checks", + "check": "Checks", "videos": "Videos", "audios": "Audio", - "images": "Images" + "images": "Images", + "main": "Main", + "marking": "Marking", + "reports": "Reports", + "settings": "Settings", + "my-content": "My content", + "referral-program": "Referral program", + "search": "Search", + "exit": "Exit", + "photo-marking": "Photo marking", + "video-marking": "Video marking", + "audio-marking": "Audio marking", + "tokens": "tokens", + "current-balance-of-protection": "Current file protection token balance", + "rate": "Rate", + "expires": "Expires", + "help": "Help", + "home": "Home", + "protecting-your-content": "Protecting your content", + "current-status-of": "Current status of security and activity of the monitoring system", + "total-files": "Total files", + "disk-space-used": "Disk space used", + "out-of": "out of" }, "Login-register-form": { "already-have-an-account": "Already have an account", diff --git a/src/i18n/messages/ru.json b/src/i18n/messages/ru.json index 0c2524c..10c3319 100644 --- a/src/i18n/messages/ru.json +++ b/src/i18n/messages/ru.json @@ -12,9 +12,32 @@ "size": "Размер", "violations": "Нарушения", "checks": "Проверки", + "check": "Проверок", "videos": "Видео", "audios": "Аудио", - "images": "Изображения" + "images": "Изображения", + "main": "Главная", + "marking": "Маркировка", + "reports": "Отчёты", + "settings": "Настройки", + "my-content": "Мой контент", + "referral-program": "Реферальная программа", + "search": "Поиск", + "exit": "Выход", + "photo-marking": "Маркировка фото", + "video-marking": "Маркировка видео", + "audio-marking": "Маркировка аудио", + "tokens": "токенов", + "current-balance-of-protection": "Текущий баланс токенов для защиты файлов", + "rate": "Тариф", + "expires": "Истекает", + "help": "Помощь", + "home": "Главная", + "protecting-your-content": "Защита вашего контента", + "current-status-of": "Текущий статус защищенности и активности системы мониторинга", + "total-files": "Всего файлов", + "disk-space-used": "Использовано места на диске", + "out-of": "из" }, "Login-register-form": { "already-have-an-account": "Уже есть аккаунт",