added sorting and Connected Icon on Station

This commit is contained in:
PxlLoewe
2025-06-08 17:03:23 -07:00
parent fc3272bca5
commit b553f8107d
2 changed files with 33 additions and 12 deletions

View File

@@ -259,16 +259,23 @@ export const MissionForm = () => {
placeholder="Wähle ein oder mehrere Rettungsmittel aus"
isMulti
form={form}
options={stations?.map((s) => ({
label: (
/* TODO: Only show radio icon if station online and sort online stations to the top */
<span className="flex items-center gap-2">
<Radio className="text-success" size={15} />
{s.bosCallsign}
</span>
),
value: s.id,
}))}
options={stations
?.sort((a, b) => {
const aHasAircraft = aircrafts?.some((ac) => ac.stationId === a.id) ? 0 : 1;
const bHasAircraft = aircrafts?.some((ac) => ac.stationId === b.id) ? 0 : 1;
return aHasAircraft - bHasAircraft;
})
.map((s) => ({
label: (
<span className="flex items-center gap-2">
{aircrafts?.some((a) => a.stationId === s.id) && (
<Radio className="text-success" size={15} />
)}
{s.bosCallsign}
</span>
),
value: s.id,
}))}
/>
</div>