Merge pull request #1865 from Owaiseimdad/FIX-1847-Incident-Page-Style-Issues

Fix 1847 incident page style issues
This commit is contained in:
Alexander Holliday authored and GitHub committed 2025-03-04 07:14:38 -08:00
commit b8efb561ec
3 files changed
+50 -46

No files matched your search

@@ -20,6 +20,13 @@ const OptionsHeader = ({
const theme = useTheme(); const theme = useTheme();
const monitorNames = typeof monitors !== "undefined" ? Object.values(monitors) : []; const monitorNames = typeof monitors !== "undefined" ? Object.values(monitors) : [];
// The stacks below which are three in number have the same style so
const stackStyles = {
direction: "row",
alignItems: "center",
gap: theme.spacing(6),
};
if (!shouldRender) return <SkeletonLayout />; if (!shouldRender) return <SkeletonLayout />;
return ( return (
@@ -27,17 +34,13 @@ const OptionsHeader = ({
direction="row" direction="row"
justifyContent="space-between" justifyContent="space-between"
> >
<Stack <Stack {...stackStyles}>
direction="row"
alignItems="center"
gap={theme.spacing(6)}
>
<Typography <Typography
display="inline-block" display="inline-block"
component="h1" component="h1"
color={theme.palette.primary.contrastTextSecondary} color={theme.palette.primary.contrastTextSecondary}
> >
Incidents for Incidents for:
</Typography> </Typography>
<Select <Select
id="incidents-select-monitor" id="incidents-select-monitor"
@@ -49,13 +52,10 @@ const OptionsHeader = ({
backgroundColor: theme.palette.primary.main, backgroundColor: theme.palette.primary.main,
color: theme.palette.primary.contrastTextSecondary, color: theme.palette.primary.contrastTextSecondary,
}} }}
truncate={true}
/> />
</Stack> </Stack>
<Stack <Stack {...stackStyles}>
direction="row"
alignItems="center"
gap={theme.spacing(6)}
>
<Typography <Typography
display="inline-block" display="inline-block"
component="h1" component="h1"
@@ -63,14 +63,7 @@ const OptionsHeader = ({
> >
Filter by: Filter by:
</Typography> </Typography>
<ButtonGroup <ButtonGroup>
sx={{
ml: "auto",
"& .MuiButtonBase-root, & .MuiButtonBase-root:hover": {
borderColor: theme.palette.primary.lowContrast,
},
}}
>
<Button <Button
variant="group" variant="group"
filled={(filter === "all").toString()} filled={(filter === "all").toString()}
@@ -94,11 +87,7 @@ const OptionsHeader = ({
</Button> </Button>
</ButtonGroup> </ButtonGroup>
</Stack> </Stack>
<Stack <Stack {...stackStyles}>
direction="row"
alignItems="center"
gap={theme.spacing(6)}
>
<Typography <Typography
display="inline-block" display="inline-block"
component="h1" component="h1"
@@ -106,14 +95,7 @@ const OptionsHeader = ({
> >
Show: Show:
</Typography> </Typography>
<ButtonGroup <ButtonGroup>
sx={{
ml: "auto",
"& .MuiButtonBase-root, & .MuiButtonBase-root:hover": {
borderColor: theme.palette.primary.lowContrast,
},
}}
>
<Button <Button
variant="group" variant="group"
filled={(dateRange === "hour").toString()} filled={(dateRange === "hour").toString()}
+12
View File
@@ -382,6 +382,18 @@ const baseTheme = (palette) => ({
}), }),
}, },
}, },
MuiButtonGroup: {
styleOverrides: {
root: ({ theme }) => ({
ml: "auto",
"& .MuiButtonBase-root, & .MuiButtonBase-root:hover": {
borderColor: theme.palette.primary.lowContrast,
width: "auto",
whiteSpace: "nowrap",
},
}),
},
},
}, },
shape: { shape: {
borderRadius: 2, borderRadius: 2,
+24 -14
View File
@@ -3,8 +3,8 @@
* @param {string} str String whose first letter is to be capitalized * @param {string} str String whose first letter is to be capitalized
* @returns A string with first letter capitalized * @returns A string with first letter capitalized
*/ */
export const capitalizeFirstLetter = (str) => { export const capitalizeFirstLetter = (str) => {
if (str === null || str === undefined) { if (str === null || str === undefined) {
return ""; return "";
} }
if (typeof str !== "string") { if (typeof str !== "string") {
@@ -12,7 +12,7 @@ export const capitalizeFirstLetter = (str) => {
} }
if (str.length === 0) { if (str.length === 0) {
return ""; return "";
} }
return str.charAt(0).toUpperCase() + str.slice(1); return str.charAt(0).toUpperCase() + str.slice(1);
}; };
@@ -22,15 +22,25 @@ export const capitalizeFirstLetter = (str) => {
* @returns A string with first letter lower cased * @returns A string with first letter lower cased
*/ */
export const toLowerCaseFirstLetter = (str) => { export const toLowerCaseFirstLetter = (str) => {
if (str === null || str === undefined) { if (str === null || str === undefined) {
return ""; return "";
} }
if (typeof str !== "string") { if (typeof str !== "string") {
throw new TypeError("Input must be a string"); throw new TypeError("Input must be a string");
} }
if (str.length === 0) { if (str.length === 0) {
return ""; return "";
} }
return str.charAt(0).toLowerCase() + str.slice(1); return str.charAt(0).toLowerCase() + str.slice(1);
}; };
/**
* Checks if a string is null, undefined, or empty (including strings with only whitespace).
* @param {string} str - The string to check.
* @returns {boolean} - Returns true if the string is null, undefined, or empty.
*/
export const isEmpty = (str) => {
// Check if string is null, undefined, or empty (including whitespace only)
return str === null || typeof str === "undefined" || str.trim().length === 0;
};