Merge pull request #570 from bluewave-labs/feat/no-monitors

Added fallback UI in case the user has no monitors created
This commit is contained in:
Alexander Holliday authored and GitHub committed 2024-08-08 09:09:28 -07:00
commit 87066952cd
2 files changed
+70 -34

No files matched your search

+7
View File
@@ -9,6 +9,13 @@
.monitors h2.MuiTypography-root { .monitors h2.MuiTypography-root {
font-size: var(--env-var-font-size-large); font-size: var(--env-var-font-size-large);
} }
.monitors p.MuiTypography-root {
font-size: var(--env-var-font-size-medium);
}
.monitors h2:has(+ p),
.monitors p.MuiTypography-root {
color: var(--env-var-color-5);
}
.monitors .MuiStack-root > button:not(.MuiIconButton-root) { .monitors .MuiStack-root > button:not(.MuiIconButton-root) {
font-size: var(--env-var-font-size-medium); font-size: var(--env-var-font-size-medium);
height: var(--env-var-height-2); height: var(--env-var-height-2);
+63 -34
View File
@@ -253,42 +253,71 @@ const Monitors = () => {
<Typography component="h1"> <Typography component="h1">
Hello, {authState.user.firstName} Hello, {authState.user.firstName}
</Typography> </Typography>
<Button {monitorState.monitors?.length !== 0 && (
level="primary" <Button
label="Create new monitor" level="primary"
onClick={() => { label="Create new monitor"
navigate("/monitors/create"); onClick={() => {
}} navigate("/monitors/create");
/> }}
/>
)}
</Stack> </Stack>
<Stack {monitorState.monitors?.length === 0 ? (
gap={theme.gap.large} <Stack
direction="row" alignItems="center"
justifyContent="space-between" backgroundColor={theme.palette.otherColors.white}
> p={theme.gap.xxl}
<ServerStatus title="Up" value={up} state="up" /> gap={theme.gap.xs}
<ServerStatus title="Down" value={down} state="down" /> border={1}
<ServerStatus title="Paused" value={0} state="pause" /> borderRadius={`${theme.shape.borderRadius}px`}
</Stack> borderColor={theme.palette.otherColors.graishWhite}
<Stack >
gap={theme.gap.large} <Typography component="h2">No monitors found</Typography>
p={theme.gap.xl} <Typography>
border={1} It looks like you don’t have any monitors set up yet.
borderColor={theme.palette.otherColors.graishWhite} </Typography>
backgroundColor={theme.palette.otherColors.white} <Button
sx={{ level="primary"
borderRadius: `${theme.shape.borderRadius}px`, label="Create your first monitor"
}} onClick={() => {
> navigate("/monitors/create");
<Stack direction="row" alignItems="center"> }}
<Typography component="h2">Current monitors</Typography> sx={{ mt: theme.gap.large }}
<Box className="current-monitors-counter"> />
{monitorState.monitors.length}
</Box>
{/* TODO - add search bar */}
</Stack> </Stack>
<BasicTable data={data} paginated={true} /> ) : (
</Stack> <>
<Stack
gap={theme.gap.large}
direction="row"
justifyContent="space-between"
>
<ServerStatus title="Up" value={up} state="up" />
<ServerStatus title="Down" value={down} state="down" />
<ServerStatus title="Paused" value={0} state="pause" />
</Stack>
<Stack
gap={theme.gap.large}
p={theme.gap.xl}
border={1}
borderColor={theme.palette.otherColors.graishWhite}
backgroundColor={theme.palette.otherColors.white}
sx={{
borderRadius: `${theme.shape.borderRadius}px`,
}}
>
<Stack direction="row" alignItems="center">
<Typography component="h2">Current monitors</Typography>
<Box className="current-monitors-counter">
{monitorState.monitors.length}
</Box>
{/* TODO - add search bar */}
</Stack>
<BasicTable data={data} paginated={true} />
</Stack>{" "}
</>
)}
</> </>
)} )}
<Menu <Menu