Add farming raid option

This commit is contained in:
Justin Edmund 2023-06-16 18:23:34 -07:00
parent 7ddd14e335
commit 984075e621

View file

@ -84,6 +84,9 @@ const RaidCombobox = (props: Props) => {
const [currentRaid, setCurrentRaid] = useState<Raid>() const [currentRaid, setCurrentRaid] = useState<Raid>()
const [tabIndex, setTabIndex] = useState(NUM_ELEMENTS + 1) const [tabIndex, setTabIndex] = useState(NUM_ELEMENTS + 1)
// Data
const [farmingRaid, setFarmingRaid] = useState<Raid>()
// Refs // Refs
const listRef = createRef<HTMLDivElement>() const listRef = createRef<HTMLDivElement>()
const inputRef = createRef<HTMLInputElement>() const inputRef = createRef<HTMLInputElement>()
@ -203,6 +206,8 @@ const RaidCombobox = (props: Props) => {
if (group.section > 0) sections[group.section - 1].push(group) if (group.section > 0) sections[group.section - 1].push(group)
}) })
setFarmingRaid(groups[0].raids[0])
setSections(sections) setSections(sections)
}, },
[setSections] [setSections]
@ -322,9 +327,13 @@ const RaidCombobox = (props: Props) => {
// Render the ungrouped raid group // Render the ungrouped raid group
function renderUngroupedRaids() { function renderUngroupedRaids() {
// Render the Untitled group with the allRaids inside of it first if the option is enabled let ungroupedRaids = farmingRaid ? [farmingRaid] : []
if (props.showAllRaidsOption) { if (props.showAllRaidsOption) {
const ungroupedRaids = generateRaidItems([allRaidsOption]) ungroupedRaids.push(allRaidsOption)
}
const options = generateRaidItems(ungroupedRaids)
return ( return (
<CommandGroup <CommandGroup
@ -334,11 +343,10 @@ const RaidCombobox = (props: Props) => {
})} })}
key="ungrouped-raids" key="ungrouped-raids"
> >
{ungroupedRaids} {options}
</CommandGroup> </CommandGroup>
) )
} }
}
// Generates a list of RaidItem components from the specified raids // Generates a list of RaidItem components from the specified raids
function generateRaidItems(raids: Raid[]) { function generateRaidItems(raids: Raid[]) {