Skip to content

Commit 9d189bf

Browse files
MarkusplayKyryloloshkaStepanPotiienko
authored
Minor 1.0.1 (#96)
* bug/make register page non-scrollable, fix background shifting on scroll, add search inputs to dropdowns on register page, fix rotating animation on Iphone/safari, add toggling icon in password field * improved images quality * added header and removed 'flex-row' from div * added avatar component * added destructive color in config * added new media icons * added spinner component * Create build.yml * Create deployment.yml * removed worflow files * fixed: replaced hardcoded colors with 'bg-gray', removed <></> --------- Co-authored-by: Kyryloloshka <[email protected]> Co-authored-by: StepanPotiienko <[email protected]> Co-authored-by: Stepan Potiienko <[email protected]>
1 parent edceec9 commit 9d189bf

File tree

48 files changed

+1013
-254
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1013
-254
lines changed

.env.example

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ NEXT_PUBLIC_CAMPUS_API_BASE_URL=YOUR_CAMPUS
44

55
NEXT_PUBLIC_TINYMCE_API_KEY=YOUR_TINYMCE_API_KEY
66

7-
GA_ID=YOUR_GA_ID
7+
GA_ID=YOUR_GA_ID

app/(auth)/layout.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default function AuthLayout({
99
return (
1010
<>
1111
<AnimatedLogo />
12-
<main className="relative min-h-[100vh] w-full overflow-x-hidden flex">
12+
<main className="relative min-h-screen-dvh w-full overflow-x-hidden flex">
1313
{children}
1414
</main>
1515
<AnimatedBackground />

app/(auth)/login/page.tsx

+24-8
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { useRouter } from 'next/navigation';
88
import { Button } from '@/components/ui/button';
99
import { Checkbox } from '@/components/ui/checkbox';
1010
import { Input } from '@/components/ui/input';
11+
import { useToast } from '@/components/ui/toast/use-toast';
1112
import useAuth from '@/hooks/useAuth';
1213
import { forgetMe, getRememberedEmail, rememberMe } from '@/lib/utils/auth';
1314

@@ -16,6 +17,7 @@ import { LoginFormData, loginSchema } from './_validation';
1617
const LoginPage = () => {
1718
const { login } = useAuth();
1819
const router = useRouter();
20+
const { toast } = useToast();
1921
const [isRememberMe, setIsRememberMe] = useState(false);
2022
const {
2123
register,
@@ -33,14 +35,28 @@ const LoginPage = () => {
3335
};
3436
const { error, success } = await login(dto);
3537
if (error && !success) {
36-
setError('password', {
37-
type: 'manual',
38-
message: 'Неправильний логін або пароль',
39-
});
38+
switch (error) {
39+
case 'Unauthorized':
40+
setError('password', {
41+
type: 'manual',
42+
message: 'Неправильний логін або пароль',
43+
});
44+
break;
45+
default:
46+
toast({
47+
variant: 'destructive',
48+
title: 'Трапилась помилка',
49+
description: error,
50+
});
51+
break;
52+
}
4053
return;
4154
}
4255
isRememberMe ? rememberMe(data.email) : forgetMe();
4356
router.push('/');
57+
toast({
58+
title: 'Ви успішно увійшли до системи',
59+
});
4460
};
4561

4662
return (
@@ -77,10 +93,10 @@ const LoginPage = () => {
7793
type="email"
7894
placeholder="Пошта"
7995
defaultValue={getRememberedEmail() ?? ''}
80-
className={`${errors.email && 'border-red-500 focus-visible:border-red-500'}`}
96+
className={`${errors.email && 'border-destructive focus-visible:border-destructive'}`}
8197
/>
8298
{errors.email && (
83-
<span className="text-red-500 text-m-p md:text-p">
99+
<span className="text-destructive text-m-p md:text-p">
84100
{errors.email.message}
85101
</span>
86102
)}
@@ -90,10 +106,10 @@ const LoginPage = () => {
90106
{...register('password')}
91107
type="password"
92108
placeholder="Пароль"
93-
className={`${errors.password && 'border-red-500 focus-visible:border-red-500'}`}
109+
className={`${errors.password && 'border-destructive focus-visible:border-destructive'}`}
94110
/>
95111
{errors.password && (
96-
<span className="text-red-500 text-m-p md:text-p">
112+
<span className="text-destructive text-m-p md:text-p">
97113
{errors.password.message}
98114
</span>
99115
)}

0 commit comments

Comments
 (0)