Skip to content

Commit 64dde8d

Browse files
committed
Use normal btns in gear piece instead of icon btns for clarity
1 parent 8042893 commit 64dde8d

17 files changed

+17
-60
lines changed

playwright.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,10 @@ export default defineConfig({
7878
timeout: 120 * 1000,
7979
reuseExistingServer: true,
8080
},
81+
82+
expect: {
83+
toHaveScreenshot: {
84+
maxDiffPixelRatio: 0.05,
85+
},
86+
},
8187
});

src/features/GearOCRModal.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import AddPhotoAlternateIcon from '@mui/icons-material/AddPhotoAlternate';
21
import { Box, Typography } from '@mui/material';
32
import Grid from '@mui/material/Unstable_Grid2';
43
import BigNumber from 'bignumber.js';
@@ -90,8 +89,8 @@ export const GearOCRModal = ({
9089

9190
return (
9291
<ButtonModal
93-
buttonText="Upload gear"
94-
modalTitle="Upload gear by using screenshot"
92+
buttonText="Import gear"
93+
modalTitle="Import gear by using screenshot"
9594
modalContent={
9695
<>
9796
<Grid container>
@@ -158,9 +157,8 @@ export const GearOCRModal = ({
158157
</Grid>
159158
</>
160159
}
161-
icon={<AddPhotoAlternateIcon />}
162160
iconButton={iconButton}
163-
aria-label="upload-gear"
161+
aria-label="import-gear"
164162
showConfirm
165163
showCancel
166164
isConfirmDisabled={!tempGearSnap}

src/features/GearPiece.tsx

Lines changed: 6 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@ import {
55
AccordionSummary,
66
Box,
77
Paper,
8+
Stack,
89
Typography,
910
} from '@mui/material';
1011
import Grid from '@mui/material/Unstable_Grid2';
1112
import type { ReactNode } from 'react';
1213

13-
import { GearStarsSelector } from '../components/GearStarsSelector/GearStarsSelector';
1414
import { GearTypeIcon } from '../components/GearTypeIcon/GearTypeIcon';
1515
import { GearTypeSelector } from '../components/GearTypeSelector/GearTypeSelector';
1616
import type { CoreElementalType } from '../constants/elemental-type';
17-
import { defaultNumOfRandomStats } from '../constants/gear';
1817
import { Gear } from '../models/gear';
1918
import type { GearType } from '../models/gear-type';
2019
import { getPossibleRandomStatTypes } from '../models/gear-type';
@@ -25,7 +24,7 @@ import { GearAttackStatsSummary } from './GearAttackStatsSummary';
2524
import { GearOCRModal } from './GearOCRModal';
2625
import { GearRollBreakdown } from './GearRollBreakdown';
2726
import { GearStars } from './GearStars';
28-
import { DisabledStatEditor, EmptyStatEditor, StatEditor } from './StatEditor';
27+
import { EmptyStatEditor, StatEditor } from './StatEditor';
2928

3029
export interface GearPieceProps {
3130
gearSnap: Gear;
@@ -103,7 +102,6 @@ export const GearPiece = ({
103102
enforceGearType={
104103
disableGearTypeChange ? gearSnap.type.id : undefined
105104
}
106-
iconButton
107105
/>
108106
)}
109107
{showSaveGearButton && showSaveGearButton.targetLoadout && (
@@ -164,47 +162,6 @@ export const GearPiece = ({
164162
);
165163
};
166164

167-
export interface EmptyGearPieceProps {
168-
onGearTypeSelect(gearType: GearType): void;
169-
showGearOCRButton?: boolean;
170-
onReplaceGear?(gear: Gear): void;
171-
['data-testid']?: string;
172-
}
173-
174-
export const EmptyGearPiece = ({
175-
onGearTypeSelect,
176-
showGearOCRButton,
177-
onReplaceGear,
178-
'data-testid': dataTestId,
179-
}: EmptyGearPieceProps) => {
180-
return (
181-
<Layout
182-
typeIcon={<GearTypeIcon gearName={undefined} size={80} />}
183-
typeSelector={
184-
<GearTypeSelector
185-
selectedGearType={undefined}
186-
onChange={onGearTypeSelect}
187-
/>
188-
}
189-
starsSelector={<GearStarsSelector stars={0} disabled />}
190-
randomStats={[...Array(defaultNumOfRandomStats)].map((_, i) => (
191-
<DisabledStatEditor key={i} />
192-
))}
193-
additionalActions={
194-
showGearOCRButton && (
195-
<GearOCRModal
196-
onFinalizeGear={(gear) => {
197-
if (onReplaceGear) onReplaceGear(gear);
198-
}}
199-
/>
200-
)
201-
}
202-
summary={undefined}
203-
data-testid={dataTestId}
204-
/>
205-
);
206-
};
207-
208165
function Layout({
209166
typeIcon,
210167
typeSelector,
@@ -224,18 +181,18 @@ function Layout({
224181
}) {
225182
return (
226183
<Paper sx={{ p: 2 }} square elevation={2} data-testid={dataTestId}>
227-
<Grid container spacing={2} mb={2}>
184+
<Grid container spacing={2}>
228185
<Grid maxWidth={90} display="flex" alignItems="center">
229186
{typeIcon}
230187
</Grid>
231188
<Grid xs display="flex" flexDirection="column" justifyContent="center">
232189
{typeSelector}
233190
<Box mt={1}>{starsSelector}</Box>
234191
</Grid>
235-
<Grid display="flex" flexDirection="column">
236-
{additionalActions}
237-
</Grid>
238192
</Grid>
193+
<Stack direction="row-reverse" spacing={1} mb={1}>
194+
{additionalActions}
195+
</Stack>
239196
<Box mb={3}>{randomStats}</Box>
240197
<Box>{summary}</Box>
241198
</Paper>

src/features/gear-comparer/SaveGearModal.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import SaveIcon from '@mui/icons-material/Save';
2-
31
import { ButtonModal } from '../../components/Modal/ButtonModal';
42
import { Gear } from '../../models/gear';
53
import type { Loadout } from '../../models/loadout';
@@ -24,8 +22,6 @@ export function SaveGearModal({ gear, targetLoadout }: SaveGearModalProps) {
2422
Gear.copy(gear, newGear);
2523
targetLoadout.replaceGear(newGear);
2624
}}
27-
icon={<SaveIcon />}
28-
iconButton
2925
/>
3026
</>
3127
);

tests/gear-comparer.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ test('persists element specific user stat values', async ({ page }) => {
3636
await expect(page.getByLabel('Wanderer level')).toHaveValue(characterLevel);
3737
});
3838

39-
test('upload gear, ocr fills in correct gear', async ({ page }) => {
39+
test('import gear, ocr fills in correct gear', async ({ page }) => {
4040
await page.goto('/gear-comparer');
4141
await dismissChangelog(page);
4242

4343
await page
4444
.getByTestId('loadout-gear')
45-
.getByLabel('upload-gear')
45+
.getByLabel('import-gear')
4646
.first()
4747
.click();
4848
const fileChooserPromise = page.waitForEvent('filechooser');

0 commit comments

Comments
 (0)