Add an optional All option to raid select
This commit is contained in:
parent
bf85f9d99c
commit
a9f14c8a38
2 changed files with 17 additions and 2 deletions
|
|
@ -79,6 +79,7 @@ const PartyDetails = (props: Props) => {
|
||||||
ref={nameInput}
|
ref={nameInput}
|
||||||
/>
|
/>
|
||||||
<RaidDropdown
|
<RaidDropdown
|
||||||
|
allOption={false}
|
||||||
selected={appSnapshot.party.raid?.id || ''}
|
selected={appSnapshot.party.raid?.id || ''}
|
||||||
onBlur={updateDetails}
|
onBlur={updateDetails}
|
||||||
ref={raidSelect}
|
ref={raidSelect}
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,10 @@ import './index.scss'
|
||||||
|
|
||||||
// Props
|
// Props
|
||||||
interface Props {
|
interface Props {
|
||||||
|
allOption: boolean
|
||||||
selected?: string
|
selected?: string
|
||||||
onBlur: (event: React.ChangeEvent<HTMLSelectElement>) => void
|
onChange?: (event: React.ChangeEvent<HTMLSelectElement>) => void
|
||||||
|
onBlur?: (event: React.ChangeEvent<HTMLSelectElement>) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const RaidDropdown = React.forwardRef<HTMLSelectElement, Props>(function useFieldSet(props, ref) {
|
const RaidDropdown = React.forwardRef<HTMLSelectElement, Props>(function useFieldSet(props, ref) {
|
||||||
|
|
@ -63,6 +65,18 @@ const RaidDropdown = React.forwardRef<HTMLSelectElement, Props>(function useFiel
|
||||||
groupedRaids[i] = raids.filter(raid => raid.group == i)
|
groupedRaids[i] = raids.filter(raid => raid.group == i)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (props.allOption)
|
||||||
|
groupedRaids[0].unshift({
|
||||||
|
id: '0',
|
||||||
|
name: {
|
||||||
|
en: 'All raids',
|
||||||
|
jp: '全て'
|
||||||
|
},
|
||||||
|
level: 0,
|
||||||
|
group: 0,
|
||||||
|
element: 0
|
||||||
|
})
|
||||||
|
|
||||||
setRaids(groupedRaids)
|
setRaids(groupedRaids)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -82,7 +96,7 @@ const RaidDropdown = React.forwardRef<HTMLSelectElement, Props>(function useFiel
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<select key={props.selected} defaultValue={props.selected} onBlur={props.onBlur} ref={ref}>
|
<select key={props.selected} defaultValue={props.selected} onBlur={props.onBlur} onChange={props.onChange} ref={ref}>
|
||||||
{ Array.from(Array(raids?.length)).map((x, i) => {
|
{ Array.from(Array(raids?.length)).map((x, i) => {
|
||||||
return raidGroup(i)
|
return raidGroup(i)
|
||||||
})}
|
})}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue