diff --git a/app/routes/admin.sports.$id.tsx b/app/routes/admin.sports.$id.tsx index e98813a..e029541 100644 --- a/app/routes/admin.sports.$id.tsx +++ b/app/routes/admin.sports.$id.tsx @@ -34,8 +34,17 @@ export async function loader({ params }: Route.LoaderArgs) { const sports = await findAllSports(); + const simulatorOptions = [...SIMULATOR_TYPES] + .toSorted((a, b) => { + const nameA = getSimulatorInfo(a)?.name ?? a; + const nameB = getSimulatorInfo(b)?.name ?? b; + return nameA.localeCompare(nameB); + }) + .map((type) => ({ value: type, label: getSimulatorInfo(type)?.name ?? type })); + return { sport, + simulatorOptions, existingIconOptions: sports .filter((option) => option.id !== sport.id && Boolean(option.iconUrl)) .map((option) => ({ id: option.id, name: option.name, iconUrl: option.iconUrl as string })), @@ -116,7 +125,7 @@ export async function action({ request, params }: Route.ActionArgs) { } export default function EditSport({ loaderData, actionData }: Route.ComponentProps) { - const { sport, existingIconOptions } = loaderData; + const { sport, simulatorOptions, existingIconOptions } = loaderData; return (
@@ -185,17 +194,11 @@ export default function EditSport({ loaderData, actionData }: Route.ComponentPro className={SELECT_CLASS} > - {[...SIMULATOR_TYPES] - .toSorted((a, b) => { - const nameA = getSimulatorInfo(a)?.name ?? a; - const nameB = getSimulatorInfo(b)?.name ?? b; - return nameA.localeCompare(nameB); - }) - .map((type) => ( - - ))} + {simulatorOptions.map((option) => ( + + ))}

Algorithm used when running EV simulations for this sport