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; justify-content: center;
margin: auto; margin: auto;
max-width: 761px; max-width: 761px;
@include breakpoint(tablet) {
align-items: center;
}
} }
#grid_characters { #grid_characters {

View file

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

View file

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

View file

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

View file

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