Merge pull request #99 from jedmund/fix-job-weapon-select

Fixes various issues with jobs and weapons
This commit is contained in:
Justin Edmund 2022-12-30 06:21:09 -08:00 committed by GitHub
commit 8f1594af68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 4 deletions

View file

@ -4,6 +4,10 @@
justify-content: center;
margin: auto;
max-width: 761px;
@include breakpoint(tablet) {
align-items: center;
}
}
#grid_characters {

View file

@ -12,6 +12,7 @@
height: auto;
min-width: $unit * 48;
min-height: $unit-12x;
min-width: 580px;
padding: $unit * $multiplier;
position: absolute;
top: 50%;

View file

@ -41,7 +41,9 @@ const JobDropdown = React.forwardRef<HTMLSelectElement, Props>(
// Set current job from state on mount
useEffect(() => {
setCurrentJob(party.job)
if (party.job.id !== '-1') {
setCurrentJob(party.job)
}
}, [])
// Organize jobs into groups on mount
@ -107,7 +109,6 @@ const JobDropdown = React.forwardRef<HTMLSelectElement, Props>(
return (
<Select
value={currentJob ? currentJob.id : 'no-job'}
placeholder={'Select a class...'}
open={open}
onClick={openJobSelect}
onOpenChange={() => setOpen(!open)}

View file

@ -1,12 +1,14 @@
#Job {
align-items: center;
box-sizing: border-box;
display: flex;
margin-bottom: $unit * 3;
@include breakpoint(tablet) {
align-items: center;
flex-direction: column;
gap: $unit;
justify-content: center;
max-width: 447px;
}
select {
@ -58,6 +60,10 @@
width: $width;
transition: box-shadow 0.15s ease-in-out;
@include breakpoint(tablet) {
margin-right: 0;
}
@include breakpoint(phone) {
aspect-ratio: 16/9;
margin: 0;

View file

@ -390,7 +390,10 @@ const WeaponUnit = (props: Props) => {
const unitContent = (
<div className={classes}>
{props.editable && gridWeapon && canBeModified(gridWeapon) ? (
{props.editable &&
gridWeapon &&
gridWeapon.id &&
canBeModified(gridWeapon) ? (
<WeaponModal gridWeapon={gridWeapon}>
<div>
<Button accessoryIcon={<SettingsIcon />} />