From bac1151c8e80f38e73b16e171d519bdcc5490edb Mon Sep 17 00:00:00 2001 From: smanylov Date: Mon, 6 Apr 2026 17:04:53 +0700 Subject: [PATCH] update login page --- src/app/[locale]/layout.tsx | 16 +------- src/app/[locale]/login/layout.tsx | 29 --------------- src/app/[locale]/login/page.tsx | 11 ++---- src/app/[locale]/pages/layout.tsx | 2 +- src/app/actions/session.ts | 5 ++- src/app/styles/global-styles.scss | 32 ++++++++++++++++ src/app/styles/module/login.module.scss | 12 ++++-- src/app/ui/forms/login-form.tsx | 12 +++--- src/proxy.ts | 49 ++++++++++++++----------- 9 files changed, 82 insertions(+), 86 deletions(-) delete mode 100644 src/app/[locale]/login/layout.tsx diff --git a/src/app/[locale]/layout.tsx b/src/app/[locale]/layout.tsx index 731123d..807f482 100644 --- a/src/app/[locale]/layout.tsx +++ b/src/app/[locale]/layout.tsx @@ -1,23 +1,13 @@ -import type { Metadata } from "next"; import Providers from '@/app/providers/getQueryServer' import { NextIntlClientProvider, hasLocale } from 'next-intl'; import { notFound } from 'next/navigation'; -import { getQueryClient } from '@/app/providers/getQueryClient'; -import { HydrationBoundary, dehydrate } from '@tanstack/react-query'; -import { prefetchLayoutQueries } from '@/app/lib/prefetch-queries'; import { routing } from '@/i18n/routing'; -import AdminLayoutWrapper from '@/app/components/admin-layout-wrapper'; // @ts-expect-error - CSS modules types not defined import "../styles/globals.css"; // @ts-expect-error - CSS modules types not defined import "../styles/global-styles.scss" -export const metadata: Metadata = { - title: "Admin panel no copy", - description: "Admin panel no copy", -}; - export async function generateStaticParams() { return routing.locales.map((locale: any) => ({ locale })); } @@ -30,16 +20,12 @@ export default async function RootLayout({ params: Promise<{ locale: string }>; }>) { const { locale } = await params; - if (!hasLocale(routing.locales, locale)) { notFound(); } - const queryClient = getQueryClient(); - await prefetchLayoutQueries(queryClient); - return ( - + diff --git a/src/app/[locale]/login/layout.tsx b/src/app/[locale]/login/layout.tsx deleted file mode 100644 index 3ef8b22..0000000 --- a/src/app/[locale]/login/layout.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { hasLocale } from 'next-intl'; -import { notFound } from 'next/navigation'; -import { getQueryClient } from '@/app/providers/getQueryClient'; -import { prefetchLayoutQueries } from '@/app/lib/prefetch-queries'; -import { routing } from '@/i18n/routing'; - -export default async function RootLayout({ - children, - params -}: Readonly<{ - children: React.ReactNode; - params: Promise<{ locale: string }>; -}>) { - const { locale } = await params; - if (!hasLocale(routing.locales, locale)) { - notFound(); - } - - const queryClient = getQueryClient(); - await prefetchLayoutQueries(queryClient); - - return ( -
-
- {children} -
-
- ); -} diff --git a/src/app/[locale]/login/page.tsx b/src/app/[locale]/login/page.tsx index f0ee5df..6a166f9 100644 --- a/src/app/[locale]/login/page.tsx +++ b/src/app/[locale]/login/page.tsx @@ -1,18 +1,13 @@ import LoginForm from '@/app/ui/forms/login-form'; -import Link from 'next/link'; export default function Page() { return ( -
+

- - - link -
) } \ No newline at end of file diff --git a/src/app/[locale]/pages/layout.tsx b/src/app/[locale]/pages/layout.tsx index d102dc0..c94be5d 100644 --- a/src/app/[locale]/pages/layout.tsx +++ b/src/app/[locale]/pages/layout.tsx @@ -36,7 +36,7 @@ export default async function RootLayout({ } const queryClient = getQueryClient(); - await prefetchLayoutQueries(queryClient); + await prefetchLayoutQueries(queryClient); return ( diff --git a/src/app/actions/session.ts b/src/app/actions/session.ts index dbd8b07..486b465 100644 --- a/src/app/actions/session.ts +++ b/src/app/actions/session.ts @@ -1,9 +1,10 @@ 'use server'; /* import 'server-only'; */ -import { cookies } from 'next/headers' -import { SignJWT, jwtVerify } from 'jose' +import { cookies } from 'next/headers'; +import { SignJWT, jwtVerify } from 'jose'; import { redirect } from 'next/navigation'; +import { headers } from 'next/headers'; /* const secretKey = process.env.SESSION_SECRET */ const secretKey = 'AAA+sq1yKte/gMgUUu/B/OyXqr45/LMYplPVOlWc+uo=' diff --git a/src/app/styles/global-styles.scss b/src/app/styles/global-styles.scss index 4c7121a..356ddda 100644 --- a/src/app/styles/global-styles.scss +++ b/src/app/styles/global-styles.scss @@ -88,6 +88,38 @@ } } +.login-page { + height: 100vh; + display: flex; + justify-content: center; + align-items: center; + + .show-password-button { + cursor: pointer; + position: absolute; + top: 50%; + right: 0px; + padding: 10px; + transform: translateY(-50%); + + svg { + width: 16px; + color: var(--secondary-hover); + transition: color 0.2s ease; + + &:hover { + color: var(--primary-hover); + } + } + + &.show { + svg { + color: var(--primary-hover); + } + } + } +} + .admin-panel { .admin-sidebar { width: var(--side-bar-width); diff --git a/src/app/styles/module/login.module.scss b/src/app/styles/module/login.module.scss index cfd57fc..9187940 100644 --- a/src/app/styles/module/login.module.scss +++ b/src/app/styles/module/login.module.scss @@ -39,6 +39,12 @@ } } +.form-wrapper { + max-width: 640px; + width: 100%; + padding: 20px; +} + .form-group { margin-bottom: 18px; } @@ -83,7 +89,7 @@ display: block; margin-bottom: 8px; font-weight: 500; - color: #374151; + color: #2563eb; font-size: 14px; } @@ -170,7 +176,7 @@ .btn { width: 100%; padding: 14px; - background: linear-gradient(135deg, #6366f1, #8b5cf6); + background: #2563eb; color: white; border: none; border-radius: 10px; @@ -182,7 +188,7 @@ margin: 20px 0 0 0; &:hover:not(:disabled) { - transform: translateY(-2px); + background: #1d4ed8; } &:disabled { diff --git a/src/app/ui/forms/login-form.tsx b/src/app/ui/forms/login-form.tsx index a93d601..99bd41e 100644 --- a/src/app/ui/forms/login-form.tsx +++ b/src/app/ui/forms/login-form.tsx @@ -28,7 +28,10 @@ export default function LoginForm() { }, []) return ( -
+