Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unauthed page improvements #46

Merged
merged 1 commit into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion app/src/core/components/withTextField.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { TextField as MuiTextField, TextFieldProps } from '@mui/material';
import { useState } from 'react';
import { Control, Controller, FieldPath, FieldValues, Path, RegisterOptions } from 'react-hook-form';
import styled from 'styled-components';
import styled, { css } from 'styled-components';
import { SomeZodObject } from 'zod';

import { getLabelFromSchema } from '~/core/utils/zod';
Expand All @@ -20,6 +20,28 @@ const TextField = styled(MuiTextField)`
background: ${({ theme }) => theme.palette.background.paper};
}

${({ theme }) =>
theme.palette.mode === 'dark' &&
css`
& .MuiOutlinedInput-root {
&.Mui-focused fieldset {
border-color: ${({ theme }) => theme.palette.grey[200]};
}
&.Mui-error fieldset {
border-color: ${({ theme }) => theme.palette.error.main} !important;
}
}

& .MuiFormLabel-root {
&.Mui-focused {
color: ${({ theme }) => theme.palette.grey[200]};
&.Mui-error {
color: ${({ theme }) => theme.palette.error.main};
}
}
}
`}

& .MuiInputBase-input.Mui-disabled {
cursor: not-allowed !important;
}
Expand Down
10 changes: 4 additions & 6 deletions app/src/features/authentication/public/ForgotPasswordView.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Box, Container } from '@mui/material';
import { useEffect, useState } from 'react';
import { useEffect, useMemo, useState } from 'react';
import Lottie from 'react-lottie-player';
import { Link } from 'react-router-dom';
import styled, { css } from 'styled-components';
Expand Down Expand Up @@ -83,6 +83,8 @@ function ForgotPasswordView() {
const { isDesktop } = useWindowSize();
const [animationData, setAnimationData] = useState<object>();

const memoizedGSplash = useMemo(() => <GSplash />, []);

useEffect(() => {
import('~/assets/lottie/ForgotPassword.json').then(setAnimationData);
}, []);
Expand All @@ -91,11 +93,7 @@ function ForgotPasswordView() {
<>
<UnauthorizedRootCss />
<FormBoxContainer>
{isDesktop && (
<ImageBox>
<GSplash />
</ImageBox>
)}
{isDesktop && <ImageBox>{memoizedGSplash}</ImageBox>}
<FormBox>
<ColorModeToggle style={{ position: 'absolute', right: 10, top: 10 }} />
<CenteredContainer>
Expand Down
10 changes: 4 additions & 6 deletions app/src/features/authentication/public/LoginView.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Box, Container, Grid2 } from '@mui/material';
import { useEffect, useState } from 'react';
import { useEffect, useMemo, useState } from 'react';
import Lottie from 'react-lottie-player';
import { useLocation } from 'react-router';
import { Link, useSearchParams } from 'react-router-dom';
Expand Down Expand Up @@ -92,6 +92,8 @@ function Login() {

const [animationData, setAnimationData] = useState<object>();

const memoizedGSplash = useMemo(() => <GSplash />, []);

useEffect(() => {
import('~/assets/lottie/landing.json').then(setAnimationData);
}, []);
Expand All @@ -101,11 +103,7 @@ function Login() {
<UnauthorizedRootCss />

<FormBoxContainer>
{isDesktop && (
<ImageBox>
<GSplash />
</ImageBox>
)}
{isDesktop && <ImageBox>{memoizedGSplash}</ImageBox>}
<FormBox>
<ColorModeToggle style={{ position: 'absolute', right: 10, top: 10 }} />
<CenteredContainer>
Expand Down