From 81b1c16c0303bd96630c2532c4e86dcfe73775f0 Mon Sep 17 00:00:00 2001 From: Derick M <58572875+TurtIeSocks@users.noreply.github.com> Date: Fri, 1 Mar 2024 13:07:30 -0500 Subject: [PATCH 1/3] refactor: login page --- src/components/ReactRouter.jsx | 2 +- src/components/layout/auth/Blocked.jsx | 6 +- src/components/layout/auth/Discord.jsx | 2 +- src/components/layout/auth/Local.jsx | 14 +- src/components/layout/auth/Login.jsx | 140 ------------------ src/components/layout/auth/Telegram.jsx | 14 +- src/components/layout/custom/Generator.jsx | 4 +- .../layout/dialogs/profile/LinkAccounts.jsx | 6 +- src/features/login/CustomPage.jsx | 42 ++++++ src/features/login/DefaultPage.jsx | 65 ++++++++ src/features/login/Methods.jsx | 69 +++++++++ src/features/login/index.jsx | 27 ++++ src/hooks/useMemory.js | 2 +- 13 files changed, 233 insertions(+), 160 deletions(-) delete mode 100644 src/components/layout/auth/Login.jsx create mode 100644 src/features/login/CustomPage.jsx create mode 100644 src/features/login/DefaultPage.jsx create mode 100644 src/features/login/Methods.jsx create mode 100644 src/features/login/index.jsx diff --git a/src/components/ReactRouter.jsx b/src/components/ReactRouter.jsx index 071aaa80a..a0f08ca56 100644 --- a/src/components/ReactRouter.jsx +++ b/src/components/ReactRouter.jsx @@ -3,7 +3,7 @@ import * as React from 'react' import { Route, Routes } from 'react-router-dom' import Auth from './layout/auth/Auth' -import Login from './layout/auth/Login' +import Login from '../features/login' import Blocked from './layout/auth/Blocked' import Errors from './Errors' import DataManagement from '../features/data' diff --git a/src/components/layout/auth/Blocked.jsx b/src/components/layout/auth/Blocked.jsx index b30ceb83c..548b26f1f 100644 --- a/src/components/layout/auth/Blocked.jsx +++ b/src/components/layout/auth/Blocked.jsx @@ -17,7 +17,7 @@ import ListItemText from '@mui/material/ListItemText' import { useMemory } from '@hooks/useMemory' -import DiscordLogin from './Discord' +import DiscordButton from './Discord' import ThemeToggle from '../general/ThemeToggle' import { I } from '../general/I' @@ -98,9 +98,9 @@ export default function Blocked() { {t('go_back')} {discordInvite && ( - + {t('join')} - + )} diff --git a/src/components/layout/auth/Discord.jsx b/src/components/layout/auth/Discord.jsx index 934d376e7..0e608b751 100644 --- a/src/components/layout/auth/Discord.jsx +++ b/src/components/layout/auth/Discord.jsx @@ -9,7 +9,7 @@ import { I } from '../general/I' * @param {{ children?: string, bgcolor?: string } & import('@mui/material/Button').ButtonProps} props * @returns {JSX.Element} */ -export default function DiscordLogin({ +export default function DiscordButton({ href = '/auth/discord/callback', children = 'login', size = 'large', diff --git a/src/components/layout/auth/Local.jsx b/src/components/layout/auth/Local.jsx index e2e2a18ce..85d41a75b 100644 --- a/src/components/layout/auth/Local.jsx +++ b/src/components/layout/auth/Local.jsx @@ -59,9 +59,15 @@ export default function LocalLogin({ href, sx, style }) { return (
- + - + {t('local_username')} - + {t('local_password')} e.preventDefault()} - size="large" > {user.showPassword ? : } @@ -116,7 +121,6 @@ export default function LocalLogin({ href, sx, style }) {