Skip to content

Commit 5f5a7fe

Browse files
committed
feat: New arena layout. Fixes #996
1 parent f17ab59 commit 5f5a7fe

File tree

24 files changed

+1066
-82
lines changed

24 files changed

+1066
-82
lines changed
1.27 KB
Binary file not shown.
Binary file not shown.

client/public/images/pets/bear.svg

Lines changed: 175 additions & 0 deletions
Loading

client/public/images/pets/dog.svg

Lines changed: 266 additions & 0 deletions
Loading

client/public/images/pets/panther.svg

Lines changed: 275 additions & 0 deletions
Loading

client/src/assets/i18n/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,6 +1534,7 @@
15341534
"rankingPrioritizeAscensions": "The rankings prioritize the amount of ascensions over experience and level !",
15351535
"fasterFights": "Faster fights",
15361536
"displayVersusPage": "Display versus page",
1537+
"displayOpponentDetails": "Display opponent details",
15371538
"wiki.howToRankup": "How to rank up?",
15381539
"wiki.winDaily": "Win daily tournament(s)",
15391540
"wiki.wins_one": "{{count}} win",

client/src/components/Brute/Body/BruteRender.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,12 @@ const BruteRender = ({
5151

5252
if (p3 === 0) {
5353
width += 15;
54-
shift.y += 7;
5554

5655
if (looking === 'right') {
5756
shift.x += -20;
5857
}
5958
} else if (p3 === 1) {
6059
width += -10;
61-
shift.y += 10;
6260
} else if (p3 === 3) {
6361
width += 40;
6462

@@ -87,12 +85,18 @@ const BruteRender = ({
8785
width += 10;
8886
shift.y += 5;
8987
} else if (p3 === 11) {
90-
shift.y += 10;
88+
width -= 5;
89+
} else if (p3 === 5) {
90+
width += 20;
91+
shift.y -= 10;
92+
} else if (p3 === 3) {
93+
shift.y -= 3;
9194
}
9295

9396
if (p7 === 5) {
94-
if (p3 === 9 || p3 === 4 || p3 === 6) {
95-
width += 10;
97+
if (p3 === 9 || p3 === 4 || p3 === 6 || p3 === 3) {
98+
width += 20;
99+
shift.y -= 5;
96100

97101
if (looking === 'right') {
98102
shift.x += -15;

client/src/components/Brute/PetTooltip.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { useTranslation } from 'react-i18next';
55
import { useBrute } from '../../hooks/useBrute';
66
import StatColor from '../../utils/StatColor';
77
import Text from '../Text';
8+
import { Brute } from '@labrute/prisma';
89

910
const textShadowBase = '-1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000';
1011
const textProps = {
@@ -14,19 +15,23 @@ const textProps = {
1415

1516
export interface PetTooltipProps extends Omit<TooltipProps, 'title'> {
1617
pet?: Pet;
18+
brute?: Pick<Brute, 'hp' | 'strengthValue' | 'agilityValue' | 'speedValue'>;
1719
}
1820

1921
const PetTooltip = ({
2022
pet,
23+
brute: specificBrute,
2124
children,
2225
...rest
2326
}: PetTooltipProps) => {
2427
const { t } = useTranslation();
25-
const { brute } = useBrute();
28+
const { brute: authedBrute } = useBrute();
2629
const theme = useTheme();
2730

2831
const textShadow = useMemo(() => (theme.palette.mode === 'dark' ? textShadowBase : undefined), [theme.palette.mode]);
2932

33+
const brute = specificBrute || authedBrute;
34+
3035
return (
3136
<Tooltip
3237
{...rest}

client/src/components/StyledButton.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Box, BoxProps, useTheme } from '@mui/material';
22
import React, { useCallback } from 'react';
3+
import { useNavigate } from 'react-router';
34

45
export interface StyledButtonProps extends Omit<BoxProps, 'translate'> {
56
image?: string;
@@ -9,6 +10,7 @@ export interface StyledButtonProps extends Omit<BoxProps, 'translate'> {
910
contrast?: boolean;
1011
shift?: string;
1112
shadowColor?: string;
13+
to?: string;
1214
}
1315

1416
export const StyledButtonWidth = 207;
@@ -26,10 +28,12 @@ const StyledButton = React.forwardRef<HTMLDivElement, StyledButtonProps>(({
2628
contrast = true,
2729
shift = '4px',
2830
shadowColor = 'rgba(0, 0, 0, 0.2)',
31+
to,
2932
sx,
3033
...rest
3134
}: StyledButtonProps, ref) => {
3235
const { palette: { mode } } = useTheme();
36+
const navigate = useNavigate();
3337

3438
const themedImage = mode === 'dark' ? image.replace('/images/', '/images/dark/') : image;
3539
const themedImageHover = mode === 'dark' ? imageHover.replace('/images/', '/images/dark/') : imageHover;
@@ -43,10 +47,18 @@ const StyledButton = React.forwardRef<HTMLDivElement, StyledButtonProps>(({
4347
const handleMouseLeave = useCallback(() => {
4448
setHover(false);
4549
}, []);
50+
51+
const handleClick = () => {
52+
if (to) {
53+
navigate(to);
54+
}
55+
};
56+
4657
return (
4758
<Box
4859
onMouseEnter={handleMouseEnter}
4960
onMouseLeave={handleMouseLeave}
61+
onClick={handleClick}
5062
ref={ref}
5163
sx={{
5264
display: 'flex',

client/src/layouts/Main.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { getFightsLeft, getGoldNeededForNewBrute, UserUpdateSettingsRequest } from '@labrute/core';
22
import { Lang } from '@labrute/prisma';
3-
import { Add, AdminPanelSettings, DarkMode, Info, LightMode, Logout, Menu, MilitaryTech, MoreHoriz, MusicNote, NewReleases, Person, Policy, RssFeed, Speed, SportsKabaddi } from '@mui/icons-material';
3+
import { Add, AdminPanelSettings, DarkMode, Info, LightMode, Logout, Menu, MilitaryTech, MoreHoriz, MusicNote, NewReleases, Person, PersonSearch, Policy, RssFeed, Speed, SportsKabaddi } from '@mui/icons-material';
44
import { Badge, Box, Button, Divider, Drawer, GlobalStyles, IconButton, List, ListItem, ListItemIcon, ListItemText, ListSubheader, Alert as MuiAlert, Switch, ThemeProvider, Tooltip, useTheme } from '@mui/material';
55
import React, { useCallback, useContext, useEffect, useState } from 'react';
66
import { useTranslation } from 'react-i18next';
@@ -34,6 +34,7 @@ const Main = () => {
3434
fightSpeed: 2,
3535
backgroundMusic: false,
3636
displayVersusPage: true,
37+
displayOpponentDetails: true,
3738
});
3839

3940
const favoriteCount = user?.brutes.filter((b) => b.favorite).length || 0;
@@ -46,6 +47,7 @@ const Main = () => {
4647
fightSpeed: user.fightSpeed,
4748
backgroundMusic: user.backgroundMusic,
4849
displayVersusPage: user.displayVersusPage,
50+
displayOpponentDetails: user.displayOpponentDetails,
4951
});
5052
}, [user]);
5153

@@ -100,6 +102,7 @@ const Main = () => {
100102
fightSpeed: settings.fightSpeed,
101103
backgroundMusic: settings.backgroundMusic,
102104
displayVersusPage: settings.displayVersusPage,
105+
displayOpponentDetails: settings.displayOpponentDetails,
103106
};
104107

105108
if (key === 'fightSpeed') {
@@ -116,6 +119,7 @@ const Main = () => {
116119
fightSpeed: newSettings.fightSpeed,
117120
backgroundMusic: newSettings.backgroundMusic,
118121
displayVersusPage: newSettings.displayVersusPage,
122+
displayOpponentDetails: newSettings.displayOpponentDetails,
119123
} : null));
120124
}).catch(catchError(Alert));
121125
};
@@ -444,6 +448,8 @@ const Main = () => {
444448
</Button>
445449
)}
446450
sx={{
451+
mt: 0,
452+
mb: 1,
447453
'& .MuiAlert-action': {
448454
alignItems: 'center',
449455
}
@@ -503,6 +509,21 @@ const Main = () => {
503509
}}
504510
/>
505511
</ListItem>
512+
<ListItem>
513+
<ListItemIcon>
514+
<PersonSearch />
515+
</ListItemIcon>
516+
<ListItemText id="switch-displayOpponentDetails" primary={t('displayOpponentDetails')} />
517+
<Switch
518+
edge="end"
519+
size="small"
520+
onChange={toggle('displayOpponentDetails')}
521+
checked={settings.displayOpponentDetails}
522+
inputProps={{
523+
'aria-labelledby': 'switch-displayOpponentDetails',
524+
}}
525+
/>
526+
</ListItem>
506527
</List>
507528
</ThemeProvider>
508529
</>

0 commit comments

Comments
 (0)