loading state
This commit is contained in:
1 parent
0b626f991f
commit
837c4598ff
2 files changed
+20
-3
No files matched your search
@@ -1,6 +1,7 @@
|
|||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import { ErrorFallback, EmptyFallback, EmptyMonitorFallback } from "./Fallback";
|
import { ErrorFallback, EmptyFallback, EmptyMonitorFallback } from "./Fallback";
|
||||||
import { Breadcrumb } from "./Breadcrumb";
|
import { Breadcrumb } from "./Breadcrumb";
|
||||||
|
import CircularProgress from "@mui/material/CircularProgress";
|
||||||
|
|
||||||
import type { StackProps } from "@mui/material/Stack";
|
import type { StackProps } from "@mui/material/Stack";
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
@@ -49,7 +50,15 @@ export const BasePageWithStates = ({
|
|||||||
const showLoading = loading && (!items || items.length === 0);
|
const showLoading = loading && (!items || items.length === 0);
|
||||||
|
|
||||||
if (showLoading) {
|
if (showLoading) {
|
||||||
return null;
|
return (
|
||||||
|
<Stack
|
||||||
|
alignItems="center"
|
||||||
|
justifyContent="center"
|
||||||
|
sx={{ height: "100%" }}
|
||||||
|
>
|
||||||
|
<CircularProgress color="primary" size={28} />
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
@@ -106,7 +115,15 @@ export const MonitorBasePageWithStates = ({
|
|||||||
const showLoading = loading && (!items || items.length === 0);
|
const showLoading = loading && (!items || items.length === 0);
|
||||||
|
|
||||||
if (showLoading) {
|
if (showLoading) {
|
||||||
return null;
|
return (
|
||||||
|
<Stack
|
||||||
|
alignItems="center"
|
||||||
|
justifyContent="center"
|
||||||
|
sx={{ height: "100%" }}
|
||||||
|
>
|
||||||
|
<CircularProgress color="primary" size={28} />
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ const RootLayout = () => {
|
|||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Stack maxWidth={1280} width="100%" paddingY={theme.spacing(6)}>
|
<Stack maxWidth={1280} width="100%" paddingY={theme.spacing(6)} flex={1}>
|
||||||
<Outlet />
|
<Outlet />
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
Reference in new issue
Block a user