From b638326653bb0c13a0f0cfe54adb654a2a8f5141 Mon Sep 17 00:00:00 2001 From: denis0001-dev Date: Thu, 9 Oct 2025 22:34:18 +0300 Subject: [PATCH] Move auth components to the right place --- .../pages/{chat/ui/components => auth}/Auth.tsx | 17 +++++++++++++++++ frontend/src/pages/auth/LoginPage.tsx | 4 ++-- frontend/src/pages/auth/RegisterPage.tsx | 4 ++-- .../src/pages/chat/ui/components/Alerts.tsx | 16 ---------------- 4 files changed, 21 insertions(+), 20 deletions(-) rename frontend/src/pages/{chat/ui/components => auth}/Auth.tsx (71%) delete mode 100644 frontend/src/pages/chat/ui/components/Alerts.tsx diff --git a/frontend/src/pages/chat/ui/components/Auth.tsx b/frontend/src/pages/auth/Auth.tsx similarity index 71% rename from frontend/src/pages/chat/ui/components/Auth.tsx rename to frontend/src/pages/auth/Auth.tsx index 65da3a3..5c6b48a 100644 --- a/frontend/src/pages/chat/ui/components/Auth.tsx +++ b/frontend/src/pages/auth/Auth.tsx @@ -36,4 +36,21 @@ export function AuthHeader({ title, icon, subtitle }: AuthHeaderProps) {

{subtitle}

) +} + +export type AlertType = "success" | "danger" + +export interface Alert { + type: AlertType; + message: string; +} + +export function AlertsContainer({ alerts }: { alerts: Alert[]}) { + return ( +
+ {alerts.slice(-3).map((alert, i) => { + return
{alert.message}
+ })} +
+ ) } \ No newline at end of file diff --git a/frontend/src/pages/auth/LoginPage.tsx b/frontend/src/pages/auth/LoginPage.tsx index be27b3a..a293c19 100644 --- a/frontend/src/pages/auth/LoginPage.tsx +++ b/frontend/src/pages/auth/LoginPage.tsx @@ -1,6 +1,6 @@ import { useImmer } from "use-immer"; -import { AlertsContainer, type Alert, type AlertType } from "../chat/ui/components/Alerts"; -import { AuthContainer, AuthHeader } from "../chat/ui/components/Auth"; +import { AlertsContainer, type Alert, type AlertType } from "./Auth"; +import { AuthContainer, AuthHeader } from "./Auth"; import type { ErrorResponse, LoginRequest, LoginResponse } from "../../core/types"; import { ensureKeysOnLogin } from "../../core/api/authApi"; import { API_BASE_URL } from "../../core/config"; diff --git a/frontend/src/pages/auth/RegisterPage.tsx b/frontend/src/pages/auth/RegisterPage.tsx index 1bddf1e..3e06a4a 100644 --- a/frontend/src/pages/auth/RegisterPage.tsx +++ b/frontend/src/pages/auth/RegisterPage.tsx @@ -1,6 +1,6 @@ import { useImmer } from "use-immer"; -import { AuthContainer, AuthHeader } from "../chat/ui/components/Auth"; -import { AlertsContainer, type Alert, type AlertType } from "../chat/ui/components/Alerts"; +import { AuthContainer, AuthHeader } from "./Auth"; +import { AlertsContainer, type Alert, type AlertType } from "./Auth"; import { useRef } from "react"; import { TextField } from "mdui/components/text-field"; import type { ErrorResponse, RegisterRequest, LoginResponse } from "../../core/types"; diff --git a/frontend/src/pages/chat/ui/components/Alerts.tsx b/frontend/src/pages/chat/ui/components/Alerts.tsx deleted file mode 100644 index 3284ac3..0000000 --- a/frontend/src/pages/chat/ui/components/Alerts.tsx +++ /dev/null @@ -1,16 +0,0 @@ -export type AlertType = "success" | "danger" - -export interface Alert { - type: AlertType; - message: string; -} - -export function AlertsContainer({ alerts }: { alerts: Alert[]}) { - return ( -
- {alerts.slice(-3).map((alert, i) => { - return
{alert.message}
- })} -
- ) -} \ No newline at end of file