Lib: Display full driver names in dropdown labels + sort alphabetically
This commit is contained in:
@ -13,7 +13,9 @@ import {
|
||||
* Generates a list of [DropdownOptions] for a <Dropdown> component.
|
||||
*/
|
||||
export const team_dropdown_options = (teams: Team[]): DropdownOption[] =>
|
||||
teams.map((team: Team) => {
|
||||
teams
|
||||
.sort((a: Team, b: Team) => a.name.localeCompare(b.name))
|
||||
.map((team: Team) => {
|
||||
return {
|
||||
label: team.name,
|
||||
value: team.id,
|
||||
@ -27,9 +29,11 @@ export const team_dropdown_options = (teams: Team[]): DropdownOption[] =>
|
||||
* Generates a list of [DropdownOptions] for a <Dropdown> component.
|
||||
*/
|
||||
export const driver_dropdown_options = (drivers: Driver[]): DropdownOption[] =>
|
||||
drivers.map((driver: Driver) => {
|
||||
drivers
|
||||
.sort((a: Driver, b: Driver) => a.firstname.localeCompare(b.firstname))
|
||||
.map((driver: Driver) => {
|
||||
return {
|
||||
label: driver.code,
|
||||
label: `${driver.firstname} ${driver.lastname}`,
|
||||
value: driver.id,
|
||||
icon_url: driver.headshot_url,
|
||||
icon_width: DRIVER_HEADSHOT_WIDTH,
|
||||
@ -41,7 +45,9 @@ export const driver_dropdown_options = (drivers: Driver[]): DropdownOption[] =>
|
||||
* Generates a list of [DropdownOptions] for a <Dropdown> component.
|
||||
*/
|
||||
export const race_dropdown_options = (races: Race[]): DropdownOption[] =>
|
||||
races.map((race: Race) => {
|
||||
races
|
||||
.sort((a: Race, b: Race) => a.step - b.step)
|
||||
.map((race: Race) => {
|
||||
return {
|
||||
label: race.name,
|
||||
value: race.id,
|
||||
|
Reference in New Issue
Block a user