Skip to content

Commit 2b84e7a

Browse files
authored
Merge branch 'dev' into juhaj77/enhancement/575-enhancement-site-wide-uiux-improvements
2 parents 0f27689 + b353bb2 commit 2b84e7a

File tree

36 files changed

+842
-438
lines changed

36 files changed

+842
-438
lines changed

frontend-next-migration/src/entities/Auth/ui/BaseAuthForm/BaseAuthForm.module.scss

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,34 @@
1+
.baseAuthForm {
2+
@media (max-width: breakpoint(xl)) {
3+
width: 280px;
4+
}
5+
}
6+
17
.fields {
2-
gap: 16px;
8+
gap: 4px;
9+
font: var(--font-dm-bold-s);
10+
11+
input {
12+
background-color: var(--background-color);
13+
color: white;
14+
border: 2px solid rgba(18, 18, 18, 1);
15+
border-radius: 25px;
16+
}
17+
input::placeholder {
18+
color: var(--primary-color);
19+
}
20+
input:focus::placeholder {
21+
color: transparent;
22+
}
23+
}
24+
.header {
25+
font: var(--font-dm-bold-m);
26+
display: flex;
27+
font-size: 0.7em;
28+
justify-content: start;
29+
font-weight: 300;
330
}
431

532
.actions {
6-
gap: 12px;
733
text-align: center;
834
}
9-
10-
.submitButton {
11-
width: 100%;
12-
}

frontend-next-migration/src/entities/Auth/ui/BaseAuthForm/BaseAuthForm.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,15 @@ const BaseAuthForm: FC<BaseAuthFormProps> & {
3030
};
3131

3232
BaseAuthForm.Header = ({ children }: { children: ReactNode }) => (
33-
<CustomForm.Header>{children}</CustomForm.Header>
33+
<CustomForm.Header>
34+
<div className={cls.header}>{children}</div>
35+
</CustomForm.Header>
3436
);
3537
BaseAuthForm.Header.displayName = 'BaseAuthForm.Header';
3638

3739
BaseAuthForm.SubmitButton = ({ children }: { children: ReactNode }) => (
38-
<CustomForm.Button
39-
type="submit"
40-
className={cls.submitButton}
41-
>
42-
{children}
40+
<CustomForm.Button type="submit">
41+
<div className={cls.submit}>{children}</div>
4342
</CustomForm.Button>
4443
);
4544
BaseAuthForm.SubmitButton.displayName = 'BaseAuthForm.SubmitButton';

frontend-next-migration/src/entities/Hero/model/heroGroupsData.part1.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ import darkBlue from '@/shared/assets/images/heros/textBgColors/dark-blue_croppe
2828
import greenBg from '@/shared/assets/images/heros/textBgColors/green2.webp';
2929
import purpleBg from '@/shared/assets/images/heros/textBgColors/purple.webp';
3030
import comingSoon from '@/shared/assets/images/heros/ComingSoon.webp';
31-
import { statData, statData2, statData3 } from '@/entities/Hero';
31+
import { statData } from '../model/stats/statsDataV2';
32+
import { statData2 } from '../model/stats/statsDataV3';
33+
import { statData3 } from '../model/stats/statsDataV4';
3234
import { GroupInfo, HeroGroup, HeroSlug } from '../types/hero';
3335

3436
export const buildHeroGroupsPart1 = (

frontend-next-migration/src/entities/Hero/model/heroGroupsData.part2.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import desensitizer from '@/shared/assets/images/descriptionCard/desensitizer.pn
1212
import orange from '@/shared/assets/images/heros/textBgColors/orange.webp';
1313
import lightBlue from '@/shared/assets/images/heros/textBgColors/light-blue.webp';
1414
import comingSoon from '@/shared/assets/images/heros/ComingSoon.webp';
15-
import { statData2, statData3 } from '@/entities/Hero';
15+
import { statData2 } from '../model/stats/statsDataV3';
16+
import { statData3 } from '../model/stats/statsDataV4';
1617
import { GroupInfo, HeroGroup, HeroSlug } from '../types/hero';
1718

1819
export const buildHeroGroupsPart2 = (

frontend-next-migration/src/entities/Hero/model/initializeHeroGroups.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { GroupInfo, HeroGroup } from '../types/hero';
2-
import { buildHeroGroups } from './heroGroupsData';
1+
import { type GroupInfo, HeroGroup, HeroSlug } from '../types/hero';
2+
import { buildHeroGroups } from '@/entities/Hero/model/heroGroupsData';
33

44
export const initializeHeroGroups = (t: (key: string) => string): Record<HeroGroup, GroupInfo> => {
55
// Local data or overrides specific to initialize step can be defined here and merged in.

frontend-next-migration/src/entities/Hero/model/stats/statsDataV3.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Stat } from '@/entities/Hero';
1+
import type { Stat } from '@/entities/Hero/types/hero';
22

33
type NamedStatArray = {
44
[key: string]: Stat[];

frontend-next-migration/src/entities/Leaderboard/ui/Leaderboard/Leaderboard.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { memo } from 'react';
2-
import { LeaderboardPodiums, LeaderboardCard } from '@/entities/Leaderboard';
2+
import LeaderboardPodiums from '../LeaderboardPodiums/LeaderboardPodiums';
3+
import LeaderboardCard from '../LeaderboardCard/LeaderboardCard';
34
import { LeaderboardItem } from '../../types/leaderboard';
45
import cls from './Leaderboard.module.scss';
56

frontend-next-migration/src/features/AuthByUsername/model/useLoginForm.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,10 @@ describe('useLoginForm', () => {
133133

134134
it('should show error toast if there is an error', () => {
135135
const mockError = { data: { message: 'Login failed' } };
136+
const mockReset = jest.fn();
136137
(useLoginMutation as jest.Mock).mockReturnValue([
137138
jest.fn(),
138-
{ data: null, isLoading: false, error: mockError },
139+
{ data: null, isLoading: false, error: mockError, reset: mockReset },
139140
]);
140141

141142
const { result, rerender } = renderHook(() =>
@@ -147,5 +148,6 @@ describe('useLoginForm', () => {
147148
});
148149

149150
expect(toast.error).toHaveBeenCalledWith(mockError.data.message);
151+
expect(mockReset).toHaveBeenCalled();
150152
});
151153
});

frontend-next-migration/src/features/AuthByUsername/model/useLoginForm.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const useLoginForm = (props: Props) => {
2828

2929
const dispatch = useDispatch();
3030

31-
const [login, { data, isLoading, error }] = useLoginMutation();
31+
const [login, { data, isLoading, error, reset }] = useLoginMutation();
3232

3333
async function onFormSubmit(fieldValues: FieldValues) {
3434
await login(fieldValues as IUserLoginDto);
@@ -59,6 +59,7 @@ export const useLoginForm = (props: Props) => {
5959
if (error) {
6060
// @ts-ignore todo it works but ts for some reason doesnt recognise the type, figure our why and fix
6161
toast.error(error?.data?.message);
62+
reset();
6263
return;
6364
}
6465
}, [data, isLoading, error, dispatch, onSuccessLogin, t]);

frontend-next-migration/src/features/AuthByUsername/ui/LoginForm/LoginForm.test.tsx

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,10 @@ describe('LoginForm', () => {
3838
it('should render form with username and password fields', () => {
3939
render(<LoginForm {...defaultProps} />);
4040

41-
expect(screen.getByText('log_in')).toBeInTheDocument();
42-
expect(screen.getByLabelText('username')).toBeInTheDocument();
43-
expect(screen.getByLabelText('password')).toBeInTheDocument();
44-
expect(screen.getByRole('button', { name: 'send' })).toBeInTheDocument();
45-
expect(screen.getByRole('link', { name: 'text_to_register' })).toHaveAttribute(
46-
'href',
47-
'/register',
48-
);
41+
expect(screen.getAllByText('log_in').length).toBeGreaterThanOrEqual(1);
42+
expect(screen.getByPlaceholderText('username')).toBeInTheDocument();
43+
expect(screen.getByPlaceholderText('password')).toBeInTheDocument();
44+
expect(screen.getByRole('button', { name: 'log_in' })).toBeInTheDocument();
4945
});
5046

5147
// todo
@@ -76,12 +72,4 @@ describe('LoginForm', () => {
7672
expect(screen.getByText('username_required')).toBeInTheDocument();
7773
expect(screen.getByText('password_required')).toBeInTheDocument();
7874
});
79-
80-
it('should render the AppLink component with correct props', () => {
81-
render(<LoginForm {...defaultProps} />);
82-
83-
const registerLink = screen.getByRole('link', { name: 'text_to_register' });
84-
expect(registerLink).toBeInTheDocument();
85-
expect(registerLink).toHaveAttribute('href', '/register');
86-
});
8775
});

0 commit comments

Comments
 (0)