diff --git a/web/app/routes/logbook.flights/flights-list.tsx b/web/app/routes/logbook.flights/flights-list.tsx index 4ac899e..c5464ec 100644 --- a/web/app/routes/logbook.flights/flights-list.tsx +++ b/web/app/routes/logbook.flights/flights-list.tsx @@ -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,104 +62,116 @@ function FlightsListDisplay({ return ( <> {flights.data ? ( - Object.entries(flights.data).map(([year, months]) => ( - <> - - <> - - {Object.entries(months).map(([month, days]) => ( - - - {Object.entries(days).map(([, logs]) => ( - <> - {logs.map((flight: FlightConciseSchema) => ( - <> - - - {flight.date} - - - {`${Number(flight.time_total).toFixed( - 1 - )} hr`} - - {flight.waypoint_from || - flight.waypoint_to ? ( - / - ) : null} - - {flight.waypoint_from ? ( - {flight.waypoint_from} - ) : ( - "" - )} - {flight.waypoint_from && - flight.waypoint_to ? ( - - ) : null} - {flight.waypoint_to ? ( - {flight.waypoint_to} - ) : ( - "" - )} - - - } - description={ - - {flight.comments - ? flight.comments - : "(No Comment)"} - - } - rightSection={ - flight.aircraft ? ( - } - color="gray" - size="lg" - > - {flight.aircraft} - - ) : null - } - active={page === flight.id} - /> - - - ))} - + Object.entries(flights.data) + .reverse() + .map(([year, months]) => ( + <> + + <> + + {Object.entries(months) + .reverse() + .map(([month, days]) => ( + + + {Object.entries(days) + .reverse() + .map(([, logs]) => ( + <> + {logs + .reverse() + .map((flight: FlightConciseSchema) => ( + <> + + + {flight.date} + + + {`${Number( + flight.time_total + ).toFixed(1)} hr`} + + {flight.waypoint_from || + flight.waypoint_to ? ( + / + ) : null} + + {flight.waypoint_from ? ( + + {flight.waypoint_from} + + ) : ( + "" + )} + {flight.waypoint_from && + flight.waypoint_to ? ( + + ) : null} + {flight.waypoint_to ? ( + {flight.waypoint_to} + ) : ( + "" + )} + + + } + description={ + + {flight.comments + ? flight.comments + : "(No Comment)"} + + } + rightSection={ + flight.aircraft ? ( + + } + color="gray" + size="lg" + > + {flight.aircraft} + + ) : null + } + active={page === flight.id} + /> + + + ))} + + ))} + ))} - - ))} - - - - )) + + + + )) ) : flights.isLoading ? (