Skip to content

Commit

Permalink
Made auto equip mod more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
dragoni7 committed Sep 24, 2024
1 parent 0e95b23 commit 1dfb497
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/features/armor-mods/components/ModCustomization.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RootState, store } from '../../../store';
import { RootState } from '../../../store';
import ArmorConfig from './ArmorConfig';
import { Grid, Stack, styled, Typography } from '@mui/material';
import useArtificeMods from '../../../hooks/use-artifice-mods';
Expand Down Expand Up @@ -32,7 +32,7 @@ const ModCustomization: React.FC = () => {
{requiredMods.length !== 0 ? (
<>
<Grid item md={12} marginLeft={{ md: 4, lg: 8 }}>
<StyledSubTitle>REQUIRED MODS</StyledSubTitle>
<StyledSubTitle>REQUIRED MODS // CLICK MODS TO AUTO EQUIP</StyledSubTitle>
</Grid>
<Grid item md={10} marginBottom={6} marginLeft={{ md: 4, lg: 8 }}>
<Stack direction="row" spacing={2}>
Expand Down
18 changes: 16 additions & 2 deletions src/features/armor-mods/components/RequiredMod.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import { Tooltip, styled } from '@mui/material';
import { autoEquipStatMod } from '../mod-utils';
import { useDispatch } from 'react-redux';
import { D2LTooltip } from '@/components/D2LTooltip';
import { animated, useSpring } from 'react-spring';

interface RequiredModProps {
required: { mod: ManifestArmorStatMod; equipped: boolean };
}

const RequiredModImg = styled('img')(({ theme }) => ({
const RequiredModImg = styled(animated.img)(({ theme }) => ({
maxWidth: '71px',
width: '58%',
height: 'auto',
Expand All @@ -18,6 +19,19 @@ const RequiredModImg = styled('img')(({ theme }) => ({

export default function RequiredMod({ required }: RequiredModProps) {
const dispatch = useDispatch();
const [border, api] = useSpring(
() => ({
from: { border: '3px solid rgba(100, 10, 10, 1)' },
to: async (next) => {
await next({ border: '3px solid rgba(100, 10, 10, 0)' });
await next({ border: '3px solid rgba(100, 10, 10, 1)' });
},
loop: true,

config: { duration: 1900, tension: 120, friction: 14 },
}),
[]
);

function handleOnClick() {
autoEquipStatMod(required.mod, dispatch);
Expand All @@ -28,8 +42,8 @@ export default function RequiredMod({ required }: RequiredModProps) {
<RequiredModImg
src={required.mod.icon}
onClick={handleOnClick}
style={border}
sx={{
border: `3px solid ${required.equipped ? 'rgba(100,100,100,0.35)' : 'red'}`,
'&:hover': { scale: 1.07 },
}}
/>
Expand Down

0 comments on commit 1dfb497

Please sign in to comment.