Fix flight list ordering
This commit is contained in:
parent
918a705c4c
commit
40108d1070
@ -27,7 +27,7 @@ function useFlights() {
|
||||
const flights = useQuery({
|
||||
queryKey: ["flights-list"],
|
||||
queryFn: async () =>
|
||||
await client.get(`/flights/by-date`).then((res) => res.data),
|
||||
await client.get(`/flights/by-date?order=1`).then((res) => res.data),
|
||||
});
|
||||
|
||||
return flights;
|
||||
@ -62,7 +62,9 @@ function FlightsListDisplay({
|
||||
return (
|
||||
<>
|
||||
{flights.data ? (
|
||||
Object.entries(flights.data).map(([year, months]) => (
|
||||
Object.entries(flights.data)
|
||||
.reverse()
|
||||
.map(([year, months]) => (
|
||||
<>
|
||||
<NavLink
|
||||
key={randomId()}
|
||||
@ -74,7 +76,9 @@ function FlightsListDisplay({
|
||||
>
|
||||
<>
|
||||
<Divider />
|
||||
{Object.entries(months).map(([month, days]) => (
|
||||
{Object.entries(months)
|
||||
.reverse()
|
||||
.map(([month, days]) => (
|
||||
<NavLink
|
||||
key={randomId()}
|
||||
label={monthNames[Number(month) - 1]}
|
||||
@ -83,9 +87,13 @@ function FlightsListDisplay({
|
||||
defaultOpened
|
||||
>
|
||||
<Divider />
|
||||
{Object.entries(days).map(([, logs]) => (
|
||||
{Object.entries(days)
|
||||
.reverse()
|
||||
.map(([, logs]) => (
|
||||
<>
|
||||
{logs.map((flight: FlightConciseSchema) => (
|
||||
{logs
|
||||
.reverse()
|
||||
.map((flight: FlightConciseSchema) => (
|
||||
<>
|
||||
<NavLink
|
||||
key={randomId()}
|
||||
@ -102,9 +110,9 @@ function FlightsListDisplay({
|
||||
{flight.date}
|
||||
</Badge>
|
||||
<Text fw={500}>
|
||||
{`${Number(flight.time_total).toFixed(
|
||||
1
|
||||
)} hr`}
|
||||
{`${Number(
|
||||
flight.time_total
|
||||
).toFixed(1)} hr`}
|
||||
</Text>
|
||||
{flight.waypoint_from ||
|
||||
flight.waypoint_to ? (
|
||||
@ -112,7 +120,9 @@ function FlightsListDisplay({
|
||||
) : null}
|
||||
<Group gap="xs">
|
||||
{flight.waypoint_from ? (
|
||||
<Text>{flight.waypoint_from}</Text>
|
||||
<Text>
|
||||
{flight.waypoint_from}
|
||||
</Text>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
@ -139,7 +149,9 @@ function FlightsListDisplay({
|
||||
flight.aircraft ? (
|
||||
<Badge
|
||||
key={randomId()}
|
||||
leftSection={<IconPlaneTilt size="1rem" />}
|
||||
leftSection={
|
||||
<IconPlaneTilt size="1rem" />
|
||||
}
|
||||
color="gray"
|
||||
size="lg"
|
||||
>
|
||||
|
Loading…
x
Reference in New Issue
Block a user