import { LogItem, VerticalLogItem } from "@/ui/display/log-item"; import ErrorDisplay from "@/ui/error-display"; import { client } from "@/util/api"; import { Center, Container, Divider, Grid, Loader, ScrollAreaAutosize, Stack, Title, } from "@mantine/core"; import { useParams } from "@remix-run/react"; import { useQuery } from "@tanstack/react-query"; export default function Flight() { const params = useParams(); const flight = useQuery({ queryKey: [params.id], queryFn: async () => await client.get(`/flights/${params.id}`).then((res) => res.data), }); const log = flight.data; return ( {flight.isError ? (
) : flight.isPending ? (
) : flight.data ? ( <> Flight Log {log.waypoint_from || log.waypoint_to ? ( <> ) : null} {log.route ? ( <> ) : null} {log.hobbs_start || log.hobbs_end ? ( <> ) : null} {log.tach_start || log.tach_end ? ( <> ) : null} {log.time_start || log.time_off ? ( <> ) : null} {log.time_down || log.time_stop ? ( <> ) : null} {log.time_xc && log.dist_xc ? ( <> ) : null} {log.time_instrument || log.time_sim_instrument || log.holds_instrument ? ( <> ) : null} ) : (
)}
); }