From 10f7fe3556e4d3a4f0cb9aea391c185bde065985 Mon Sep 17 00:00:00 2001 From: Fovway Date: Sun, 2 Nov 2025 23:07:56 +0700 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=B8=D0=BD=D0=B4=D0=B8=D0=BA=D0=B0=D1=82=D0=BE=D1=80?= =?UTF-8?q?=20=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BA=D0=B8=20=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=B3=D0=BB=D0=B0=D0=B2=D0=BD=D0=BE=D0=B9=20=D1=81?= =?UTF-8?q?=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D0=B5=20=D0=B8=20=D0=BE?= =?UTF-8?q?=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=20=D0=BA=D0=BE=D0=BC?= =?UTF-8?q?=D0=BF=D0=BE=D0=BD=D0=B5=D0=BD=D1=82=20ProtectedRoute=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B8?= =?UTF-8?q?=20=D0=B0=D1=83=D1=82=D0=B5=D0=BD=D1=82=D0=B8=D1=84=D0=B8=D0=BA?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D0=B8.=20=D0=98=D0=B7=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D1=81=D1=82=D0=B8=D0=BB=D0=B8=20=D0=B7?= =?UTF-8?q?=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BE=D1=87=D0=BD=D0=BE=D0=B3?= =?UTF-8?q?=D0=BE=20=D0=BE=D0=B2=D0=B5=D1=80=D0=BB=D0=B5=D1=8F=20=D0=B8=20?= =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=20=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=BC=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=BD=D1=8B?= =?UTF-8?q?=D0=B9=20=D1=81=D0=BF=D0=B8=D0=BD=D0=BD=D0=B5=D1=80=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D1=83=D0=BB=D1=83=D1=87=D1=88=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D1=81=D0=BA=D0=BE=D0=B3=D0=BE=20=D0=BE=D0=BF?= =?UTF-8?q?=D1=8B=D1=82=D0=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 70 +++++++++++++++++++++++- src/components/ProtectedRoute.tsx | 10 ++-- src/components/common/LoadingOverlay.tsx | 2 +- src/styles/style.css | 26 +++++++-- 4 files changed, 94 insertions(+), 14 deletions(-) diff --git a/index.html b/index.html index d84e83d..83b682b 100644 --- a/index.html +++ b/index.html @@ -160,7 +160,75 @@ -
+
+ +
+ +
+
+
+ diff --git a/src/components/ProtectedRoute.tsx b/src/components/ProtectedRoute.tsx index e9f4bb0..0310ba3 100644 --- a/src/components/ProtectedRoute.tsx +++ b/src/components/ProtectedRoute.tsx @@ -33,12 +33,10 @@ export const ProtectedRoute: React.FC<{ children: React.ReactNode }> = ({ } }; - if (isAuthenticated) { - checkAuth(); - } else { - setIsChecking(false); - } - }, [dispatch, isAuthenticated]); + // Всегда проверяем статус аутентификации при монтировании, + // независимо от начального состояния Redux (localStorage может быть устаревшим) + checkAuth(); + }, [dispatch]); if (isChecking) { return ; diff --git a/src/components/common/LoadingOverlay.tsx b/src/components/common/LoadingOverlay.tsx index 4eec3be..81c6f89 100644 --- a/src/components/common/LoadingOverlay.tsx +++ b/src/components/common/LoadingOverlay.tsx @@ -4,7 +4,7 @@ export const LoadingOverlay: React.FC = () => { return (
-
Загрузка...
+
); diff --git a/src/styles/style.css b/src/styles/style.css index c984662..a1cb390 100644 --- a/src/styles/style.css +++ b/src/styles/style.css @@ -4866,14 +4866,28 @@ textarea:focus { display: flex; align-items: center; justify-content: center; - min-width: 150px; + min-width: 80px; + min-height: 80px; } -.loading-text { - color: var(--text-color); - font-size: 16px; - font-weight: 500; - text-align: center; +/* Анимированный спиннер */ +.loading-spinner { + width: 50px; + height: 50px; + border: 4px solid transparent; + border-top: 4px solid var(--accent-color, #007bff); + border-right: 4px solid var(--accent-color, #007bff); + border-bottom: 4px solid transparent; + border-left: 4px solid transparent; + border-radius: 50%; + animation: loading-spin 0.8s linear infinite; + opacity: 0.8; +} + +@keyframes loading-spin { + to { + transform: rotate(360deg); + } } /* Темная тема для загрузочного оверлея */