Lib: Only display active/inactive drivers in SubstitutionCard dropdowns
This commit is contained in:
@ -47,6 +47,12 @@
|
|||||||
race_select_value,
|
race_select_value,
|
||||||
}: SubstitutionCardProps = $props();
|
}: SubstitutionCardProps = $props();
|
||||||
|
|
||||||
|
const active_drivers = (drivers: Driver[]): Driver[] =>
|
||||||
|
drivers.filter((driver: Driver) => driver.active);
|
||||||
|
|
||||||
|
const inactive_drivers = (drivers: Driver[]): Driver[] =>
|
||||||
|
drivers.filter((driver: Driver) => !driver.active);
|
||||||
|
|
||||||
const modalStore: ModalStore = getModalStore();
|
const modalStore: ModalStore = getModalStore();
|
||||||
if ($modalStore[0].meta) {
|
if ($modalStore[0].meta) {
|
||||||
const meta = $modalStore[0].meta;
|
const meta = $modalStore[0].meta;
|
||||||
@ -111,7 +117,7 @@
|
|||||||
name="substitute"
|
name="substitute"
|
||||||
input_variable={substitute_select_value}
|
input_variable={substitute_select_value}
|
||||||
action={register_substitute_preview_handler}
|
action={register_substitute_preview_handler}
|
||||||
options={driver_dropdown_options(drivers)}
|
options={driver_dropdown_options(inactive_drivers(drivers))}
|
||||||
labelwidth="120px"
|
labelwidth="120px"
|
||||||
disabled={disable_inputs}
|
disabled={disable_inputs}
|
||||||
required={require_inputs}
|
required={require_inputs}
|
||||||
@ -123,7 +129,7 @@
|
|||||||
<Dropdown
|
<Dropdown
|
||||||
name="for"
|
name="for"
|
||||||
input_variable={driver_select_value}
|
input_variable={driver_select_value}
|
||||||
options={driver_dropdown_options(drivers)}
|
options={driver_dropdown_options(active_drivers(drivers))}
|
||||||
labelwidth="120px"
|
labelwidth="120px"
|
||||||
disabled={disable_inputs}
|
disabled={disable_inputs}
|
||||||
required={require_inputs}
|
required={require_inputs}
|
||||||
|
Reference in New Issue
Block a user