Improve loading displays
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { client } from "@/util/api";
|
||||
import { List, Stack, Text } from "@mantine/core";
|
||||
import { Center, Container, List, Loader, Stack, Text } from "@mantine/core";
|
||||
import { useParams } from "@remix-run/react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
@@ -13,27 +13,31 @@ export default function Flight() {
|
||||
});
|
||||
|
||||
return (
|
||||
<Stack h="calc(100vh - 95px)" m="0" p="0">
|
||||
{flight.isError ? (
|
||||
<Text c="red">Error fetching flight</Text>
|
||||
) : flight.isPending ? (
|
||||
<Text>Loading...</Text>
|
||||
) : (
|
||||
<List>
|
||||
{Object.entries(flight.data).map(([key, value]) =>
|
||||
value && value.length !== 0 ? (
|
||||
<List.Item key={key}>
|
||||
<Text span>
|
||||
<Text span fw={700}>
|
||||
{key}
|
||||
<Container py="xl">
|
||||
<Stack h="calc(100vh - 95px)" m="0" p="0">
|
||||
{flight.isError ? (
|
||||
<Text c="red">Error fetching flight</Text>
|
||||
) : flight.isPending ? (
|
||||
<Center h="100%">
|
||||
<Loader />
|
||||
</Center>
|
||||
) : (
|
||||
<List>
|
||||
{Object.entries(flight.data).map(([key, value]) =>
|
||||
value && value.length !== 0 ? (
|
||||
<List.Item key={key}>
|
||||
<Text span>
|
||||
<Text span fw={700}>
|
||||
{key}
|
||||
</Text>
|
||||
: <Text span>{value}</Text>
|
||||
</Text>
|
||||
: <Text span>{value}</Text>
|
||||
</Text>
|
||||
</List.Item>
|
||||
) : null
|
||||
)}
|
||||
</List>
|
||||
)}
|
||||
</Stack>
|
||||
</List.Item>
|
||||
) : null
|
||||
)}
|
||||
</List>
|
||||
)}
|
||||
</Stack>
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user