fix: center and constrain empty placeholder layout with format

This commit is contained in:
karenvicent committed 2025-06-25 18:27:37 -04:00
1 parent fd51af97fa
commit eecdb7e552
2 files changed
+106 -109

No files matched your search

+2 -2
View File
@@ -39,6 +39,6 @@
background-repeat: no-repeat; background-repeat: no-repeat;
} }
.fallback__status>.MuiStack-root { .fallback__status > .MuiStack-root {
margin-left: var(--env-var-spacing-2); margin-left: var(--env-var-spacing-2);
} }
+104 -107
View File
@@ -69,132 +69,129 @@ const Fallback = ({
}; };
return ( return (
<Box <Box
position="relative" position="relative"
sx={{
height: "100vh",
width: "100%",
display: "flex",
justifyContent: "center",
alignItems: "center",
}}>
<Box
border={1}
borderColor={theme.palette.primary.lowContrast}
borderRadius={theme.shape.borderRadius}
backgroundColor={theme.palette.primary.main}
overflow="hidden"
sx={{ sx={{
height: "100vh",
width: "100%",
display: "flex", display: "flex",
borderStyle: "dashed", justifyContent: "center",
height: "60vh", alignItems: "center",
width: "45%",
minWidth: "400px",
maxHeight:"700px",
maxWidth: "800px",
}} }}
> >
<Stack <Box
className={`fallback__${title?.trim().split(" ")[0]}`} border={1}
alignItems="center" borderColor={theme.palette.primary.lowContrast}
gap={theme.spacing(20)} borderRadius={theme.shape.borderRadius}
backgroundColor={theme.palette.primary.main}
overflow="hidden"
sx={{ sx={{
maxHeight:"70vh", display: "flex",
justifyContent:"center" borderStyle: "dashed",
height: "60vh",
width: "45%",
}} minWidth: "400px",
maxHeight: "700px",
maxWidth: "800px",
}}
> >
{mode === "light" ? ( <Stack
<Skeleton style={{ zIndex: 1 }} /> className={`fallback__${title?.trim().split(" ")[0]}`}
) : ( alignItems="center"
<SkeletonDark style={{ zIndex: 1 }} /> gap={theme.spacing(20)}
)}
<Box
className="background-pattern-svg"
sx={{ sx={{
"& svg g g:last-of-type path": { maxHeight: "70vh",
stroke: theme.palette.primary.lowContrast, justifyContent: "center",
},
}} }}
> >
<Background style={{ width: "100%" }} /> {mode === "light" ? (
</Box> <Skeleton style={{ zIndex: 1 }} />
<Stack ) : (
gap={theme.spacing(4)} <SkeletonDark style={{ zIndex: 1 }} />
maxWidth={"300px"} )}
zIndex={1} <Box
> className="background-pattern-svg"
<Typography sx={{
component="h1" "& svg g g:last-of-type path": {
marginY={theme.spacing(4)} stroke: theme.palette.primary.lowContrast,
color={theme.palette.primary.contrastTextTertiary} },
>
{vowelStart ? "An" : "A"} {title} is used to:
</Typography>
{checks?.map((check, index) => (
<Check
text={check}
key={`${title.trim().split(" ")[0]}-${index}`}
outlined={true}
/>
))}
</Stack>
{/* TODO - display a different fallback if user is not an admin*/}
{isAdmin && (
<>
<Button
variant="contained"
color="accent"
sx={{ alignSelf: "center"
}} }}
onClick={() => navigate(link)} >
<Background style={{ width: "100%" }} />
</Box>
<Stack
gap={theme.spacing(4)}
maxWidth={"300px"}
zIndex={1}
>
<Typography
component="h1"
marginY={theme.spacing(4)}
color={theme.palette.primary.contrastTextTertiary}
> >
Let's create your first {title} {vowelStart ? "An" : "A"} {title} is used to:
</Button> </Typography>
{/* Bulk create of uptime monitors */} {checks?.map((check, index) => (
{title === "uptime monitor" && ( <Check
text={check}
key={`${title.trim().split(" ")[0]}-${index}`}
outlined={true}
/>
))}
</Stack>
{/* TODO - display a different fallback if user is not an admin*/}
{isAdmin && (
<>
<Button <Button
variant="contained" variant="contained"
color="accent" color="accent"
sx={{ alignSelf: "center" }} sx={{ alignSelf: "center" }}
onClick={() => navigate("/uptime/bulk-import")} onClick={() => navigate(link)}
> >
{t("bulkImport.fallbackPage")} Let's create your first {title}
</Button> </Button>
)} {/* Bulk create of uptime monitors */}
{title === "uptime monitor" && (
{/* Warning box for PageSpeed monitor */} <Button
{title === "pagespeed monitor" && showPageSpeedWarning && ( variant="contained"
<Box sx={{ width: "80%", maxWidth: "600px", zIndex: 1 }}> color="accent"
<Box sx={{ alignSelf: "center" }}
sx={{ onClick={() => navigate("/uptime/bulk-import")}
"& .alert.row-stack": {
backgroundColor: theme.palette.warningSecondary.main,
borderColor: theme.palette.warningSecondary.lowContrast,
"& .MuiTypography-root": {
color: theme.palette.warningSecondary.contrastText,
},
"& .MuiBox-root > svg": {
color: theme.palette.warningSecondary.contrastText,
},
},
}}
> >
{settingsData?.pagespeedKeySet === false && ( {t("bulkImport.fallbackPage")}
<Alert </Button>
variant="warning" )}
hasIcon={true}
body={renderWarningMessage()} {/* Warning box for PageSpeed monitor */}
/> {title === "pagespeed monitor" && showPageSpeedWarning && (
)} <Box sx={{ width: "80%", maxWidth: "600px", zIndex: 1 }}>
<Box
sx={{
"& .alert.row-stack": {
backgroundColor: theme.palette.warningSecondary.main,
borderColor: theme.palette.warningSecondary.lowContrast,
"& .MuiTypography-root": {
color: theme.palette.warningSecondary.contrastText,
},
"& .MuiBox-root > svg": {
color: theme.palette.warningSecondary.contrastText,
},
},
}}
>
{settingsData?.pagespeedKeySet === false && (
<Alert
variant="warning"
hasIcon={true}
body={renderWarningMessage()}
/>
)}
</Box>
</Box> </Box>
</Box> )}
)} </>
</> )}
)} </Stack>
</Stack> </Box>
</Box>
</Box> </Box>
); );
}; };