fix: add global Typography variants for monitor text truncation

This commit is contained in:
varunrmantri23 committed 2025-06-08 23:12:48 +05:30
1 parent e4ade39db7
commit 5e2fa7a8f0
6 files changed
+38 -71

No files matched your search

@@ -27,34 +27,14 @@ const Status = ({ monitor }) => {
return ( return (
<Stack> <Stack>
<Typography <Typography variant="monitorName">{monitor?.name}</Typography>
variant="h1"
sx={{
maxWidth: "45vw",
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
}}
>
{monitor?.name}
</Typography>
<Stack <Stack
direction="row" direction="row"
alignItems={"center"} alignItems={"center"}
gap={theme.spacing(4)} gap={theme.spacing(4)}
> >
<PulseDot color={statusColor[determineState(monitor)]} /> <PulseDot color={statusColor[determineState(monitor)]} />
<Typography <Typography variant="monitorUrl">
variant="h2"
sx={{
fontFamily: "monospace",
fontWeight: "bolder",
maxWidth: "60vw",
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
}}
>
{monitor?.url?.replace(/^https?:\/\//, "") || "..."} {monitor?.url?.replace(/^https?:\/\//, "") || "..."}
</Typography> </Typography>
<Dot /> <Dot />
@@ -21,17 +21,7 @@ const MonitorStatusHeader = ({ path, isLoading = false, isAdmin, monitor }) => {
justifyContent="space-between" justifyContent="space-between"
> >
<Stack> <Stack>
<Typography <Typography variant="monitorName">{monitor?.name}</Typography>
variant="h1"
sx={{
maxWidth: "60vw",
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
}}
>
{monitor?.name}
</Typography>
<Stack <Stack
direction="row" direction="row"
alignItems={"center"} alignItems={"center"}
@@ -40,15 +30,7 @@ const MonitorStatusHeader = ({ path, isLoading = false, isAdmin, monitor }) => {
<PulseDot color={statusColor[determineState(monitor)]} /> <PulseDot color={statusColor[determineState(monitor)]} />
<Typography <Typography
component="h2" component="h2"
variant="h2" variant="monitorUrl"
sx={{
fontFamily: "monospace",
fontWeight: "bolder",
maxWidth: "60vw",
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
}}
> >
{monitor?.url?.replace(/^https?:\/\//, "") || "..."} {monitor?.url?.replace(/^https?:\/\//, "") || "..."}
</Typography> </Typography>
+2 -14
View File
@@ -202,13 +202,7 @@ const PageSpeedConfigure = () => {
<Box> <Box>
<Typography <Typography
component="h1" component="h1"
variant="h1" variant="monitorName"
sx={{
maxWidth: "60vw",
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
}}
> >
{monitor.name} {monitor.name}
</Typography> </Typography>
@@ -240,13 +234,7 @@ const PageSpeedConfigure = () => {
</Tooltip> </Tooltip>
<Typography <Typography
component="h2" component="h2"
variant="h2" variant="monitorUrl"
sx={{
maxWidth: "60vw",
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
}}
> >
{monitor.url?.replace(/^https?:\/\//, "") || "..."} {monitor.url?.replace(/^https?:\/\//, "") || "..."}
</Typography> </Typography>
@@ -245,7 +245,7 @@ const Card = ({ monitor }) => {
</IconBox> </IconBox>
<Typography <Typography
component="h2" component="h2"
variant="h2" variant="monitorUrl"
fontWeight={500} fontWeight={500}
alignSelf="center" alignSelf="center"
> >
+2 -14
View File
@@ -248,13 +248,7 @@ const Configure = () => {
<Box> <Box>
<Typography <Typography
component="h1" component="h1"
variant="h1" variant="monitorName"
sx={{
maxWidth: "60vw",
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
}}
> >
{monitor.name} {monitor.name}
</Typography> </Typography>
@@ -286,13 +280,7 @@ const Configure = () => {
</Tooltip> </Tooltip>
<Typography <Typography
component="h2" component="h2"
variant="h2" variant="monitorUrl"
sx={{
maxWidth: "60vw",
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
}}
> >
{monitor.url?.replace(/^https?:\/\//, "") || "..."} {monitor.url?.replace(/^https?:\/\//, "") || "..."}
</Typography> </Typography>
+29
View File
@@ -632,6 +632,35 @@ const baseTheme = (palette) => ({
}), }),
}, },
}, },
MuiTypography: {
variants: [
{
props: { variant: "monitorName" },
style: {
fontSize: typographyLevels.xl,
color: palette.primary.contrastText,
fontWeight: 500,
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
maxWidth: "calc((100vw - var(--env-var-width-2)) / 2)",
},
},
{
props: { variant: "monitorUrl" },
style: {
fontSize: typographyLevels.l,
color: palette.primary.contrastTextSecondary,
fontWeight: "bolder",
fontFamily: "monospace",
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
maxWidth: "calc((100vw - var(--env-var-width-2)) / 2)",
},
},
],
},
}, },
shape: { shape: {
borderRadius: 2, borderRadius: 2,