-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add build selection and build progress
- Loading branch information
Showing
10 changed files
with
343 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/renderer/feature/builds/components/BuildDropdownElement.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import Card from '@mui/material/Card'; | ||
import Box from '@mui/material/Box'; | ||
import Typography from '@mui/material/Typography'; | ||
import { TBuild } from '../../../contexts/buildsContext'; | ||
import { EvoStash } from '../../../components/Stash'; | ||
|
||
interface BuildCardProps { | ||
build: TBuild; | ||
} | ||
export function BuildDropdownElement({ build }: BuildCardProps) { | ||
return ( | ||
<Box sx={{ padding: '1px', margin: '3px' }}> | ||
<Card sx={{ paddingY: '5px', paddingX: '15px', cursor: 'pointer' }}> | ||
<Box | ||
sx={{ | ||
display: 'flex', | ||
flexDirection: 'row', | ||
justifyContent: 'space-between', | ||
alignItems: 'center', | ||
paddingBottom: '1px', | ||
}} | ||
> | ||
<Typography variant="body1">{build.name}</Typography> | ||
</Box> | ||
<Box sx={{ paddingBottom: '2px' }}> | ||
<EvoStash | ||
sx={{ display: 'flex', flexDirection: 'row', gap: '2px' }} | ||
itemIds={build.items} | ||
/> | ||
</Box> | ||
</Card> | ||
</Box> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
src/renderer/feature/builds/components/CharacterBuildComponent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { FC } from 'react'; | ||
import { TBuild } from '../../../contexts/buildsContext'; | ||
import { Autocomplete, Box, TextField } from '@mui/material'; | ||
import { BuildDropdownElement } from './BuildDropdownElement'; | ||
import theme from '../../../theme'; | ||
import { BuildCard } from './BuildCard'; | ||
|
||
interface CharacterBuildComponentProps { | ||
builds: { [id: number]: TBuild }; | ||
selectedBuild: number | null; | ||
items: string[] | null; | ||
handleSelectBuild: (buildId: number) => void; | ||
} | ||
|
||
export const CharacterBuildComponent: FC<CharacterBuildComponentProps> = ({ | ||
builds, | ||
selectedBuild, | ||
items, | ||
handleSelectBuild, | ||
}) => { | ||
return ( | ||
<> | ||
{builds && ( | ||
<Box sx={{ paddingLeft: '36px', justifyContent: 'start' }}> | ||
<Autocomplete | ||
value={selectedBuild} | ||
options={Object.keys(builds).map((key) => Number(key))} | ||
getOptionLabel={(option) => builds[option].name} | ||
style={{ width: 300 }} | ||
renderInput={(params) => ( | ||
<TextField {...params} label="Select Build" /> | ||
)} | ||
renderOption={(props, option) => ( | ||
<li {...props} key={option} style={{ padding: 0 }}> | ||
<BuildDropdownElement build={builds[option]} /> | ||
</li> | ||
)} | ||
PaperComponent={({ children }) => ( | ||
<Box | ||
sx={{ | ||
width: 'fit-content', | ||
background: theme.palette.grey[800], | ||
}} | ||
> | ||
{children} | ||
</Box> | ||
)} | ||
onChange={(_, value) => { | ||
if (value) { | ||
const build = builds[value]; | ||
if (build && build.id) { | ||
handleSelectBuild(build.id); | ||
} | ||
} | ||
}} | ||
/> | ||
{selectedBuild && ( | ||
<BuildCard build={builds[selectedBuild]} playerItems={items} /> | ||
)} | ||
</Box> | ||
)} | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.