Refactored pages styling 2/3
This commit is contained in:
1 parent
b34a17004b
commit
05ffb3d270
20 files changed
+295
-178
No files matched your search
@@ -21,8 +21,10 @@ import { useSelector } from "react-redux";
|
||||
import { networkService } from "../../../main";
|
||||
import { StatusLabel } from "../../../Components/Label";
|
||||
import { logger } from "../../../Utils/Logger";
|
||||
import { useTheme } from "@emotion/react";
|
||||
|
||||
const IncidentTable = ({ monitors, selectedMonitor, filter }) => {
|
||||
const theme = useTheme();
|
||||
const { authToken, user } = useSelector((state) => state.auth);
|
||||
const [checks, setChecks] = useState([]);
|
||||
const [checksCount, setChecksCount] = useState(0);
|
||||
@@ -100,6 +102,19 @@ const IncidentTable = ({ monitors, selectedMonitor, filter }) => {
|
||||
page={paginationController.page + 1} //0-indexed
|
||||
onChange={handlePageChange}
|
||||
shape="rounded"
|
||||
sx={{
|
||||
backgroundColor: theme.palette.background.main,
|
||||
border: 1,
|
||||
borderColor: theme.palette.border.light,
|
||||
"& button": {
|
||||
color: theme.palette.text.tertiary,
|
||||
borderRadius: theme.shape.borderRadius,
|
||||
},
|
||||
"& li:first-of-type button, & li:last-of-type button": {
|
||||
border: 1,
|
||||
borderColor: theme.palette.border.light,
|
||||
},
|
||||
}}
|
||||
renderItem={(item) => (
|
||||
<PaginationItem
|
||||
slots={{
|
||||
@@ -111,6 +126,13 @@ const IncidentTable = ({ monitors, selectedMonitor, filter }) => {
|
||||
"&:focus": {
|
||||
outline: "none",
|
||||
},
|
||||
"& .MuiTouchRipple-root": {
|
||||
pointerEvents: "none",
|
||||
display: "none",
|
||||
},
|
||||
"&.Mui-selected, &.Mui-selected:hover": {
|
||||
backgroundColor: theme.palette.background.fill,
|
||||
},
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
@@ -118,24 +140,50 @@ const IncidentTable = ({ monitors, selectedMonitor, filter }) => {
|
||||
);
|
||||
}
|
||||
|
||||
let sharedStyles = {
|
||||
border: 1,
|
||||
borderColor: theme.palette.border.light,
|
||||
borderRadius: theme.shape.borderRadius,
|
||||
backgroundColor: theme.palette.background.main,
|
||||
p: theme.spacing(30),
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
{checks?.length === 0 && selectedMonitor === "0" ? (
|
||||
<Box>
|
||||
<Typography textAlign="center">No incidents recorded yet.</Typography>
|
||||
<Box sx={{ ...sharedStyles }}>
|
||||
<Typography textAlign="center" color={theme.palette.text.secondary}>
|
||||
No incidents recorded yet.
|
||||
</Typography>
|
||||
</Box>
|
||||
) : checks?.length === 0 ? (
|
||||
<Box>
|
||||
<Typography textAlign="center">
|
||||
<Box sx={{ ...sharedStyles }}>
|
||||
<Typography textAlign="center" color={theme.palette.text.secondary}>
|
||||
The monitor you have selected has no recorded incidents yet.
|
||||
</Typography>
|
||||
</Box>
|
||||
) : (
|
||||
<>
|
||||
<TableContainer component={Paper}>
|
||||
<TableContainer
|
||||
component={Paper}
|
||||
sx={{
|
||||
border: `solid 1px ${theme.palette.border.light}`,
|
||||
borderRadius: theme.shape.borderRadius,
|
||||
}}
|
||||
>
|
||||
<Table>
|
||||
<TableHead>
|
||||
<TableRow>
|
||||
<TableHead
|
||||
sx={{
|
||||
backgroundColor: theme.palette.background.accent,
|
||||
}}
|
||||
>
|
||||
<TableRow
|
||||
sx={{
|
||||
"& > .MuiTableCell-root": {
|
||||
color: theme.palette.text.secondary,
|
||||
},
|
||||
}}
|
||||
>
|
||||
<TableCell>Monitor Name</TableCell>
|
||||
<TableCell>Status</TableCell>
|
||||
<TableCell>Date & Time</TableCell>
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
.incidents h1.MuiTypography-root,
|
||||
.incidents p.MuiTypography-root {
|
||||
color: var(--secondary-color);
|
||||
}
|
||||
.incidents h1.MuiTypography-root {
|
||||
font-size: var(--env-var-font-size-large);
|
||||
font-weight: 600;
|
||||
@@ -12,19 +8,4 @@
|
||||
}
|
||||
.incidents button.MuiButtonBase-root {
|
||||
height: 34px;
|
||||
border-color: var(--border-color);
|
||||
}
|
||||
.incidents .MuiPagination-root {
|
||||
background-color: var(--primary-bg);
|
||||
}
|
||||
.incidents > .MuiBox-root {
|
||||
background-color: var(--primary-bg);
|
||||
border: solid 1px var(--border-color);
|
||||
border-radius: var(--env-var-radius-1);
|
||||
padding: 60px;
|
||||
}
|
||||
|
||||
/* remove later */
|
||||
.incidents .MuiSelect-select {
|
||||
padding: 0 10px;
|
||||
}
|
||||
@@ -78,13 +78,17 @@ const Incidents = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<Stack className="incidents" pt={theme.gap.xl} gap={theme.gap.large}>
|
||||
<Stack className="incidents" pt={theme.spacing(20)} gap={theme.spacing(12)}>
|
||||
{loading ? (
|
||||
<SkeletonLayout />
|
||||
) : (
|
||||
<>
|
||||
<Stack direction="row" alignItems="center" gap={theme.gap.medium}>
|
||||
<Typography display="inline-block" component="h1">
|
||||
<Stack direction="row" alignItems="center" gap={theme.spacing(6)}>
|
||||
<Typography
|
||||
display="inline-block"
|
||||
component="h1"
|
||||
color={theme.palette.text.secondary}
|
||||
>
|
||||
Incidents for
|
||||
</Typography>
|
||||
<Select
|
||||
@@ -93,15 +97,27 @@ const Incidents = () => {
|
||||
value={selectedMonitor}
|
||||
onChange={handleSelect}
|
||||
items={Object.values(monitors)}
|
||||
sx={{
|
||||
backgroundColor: theme.palette.background.main,
|
||||
}}
|
||||
/>
|
||||
<ButtonGroup sx={{ ml: "auto" }}>
|
||||
<ButtonGroup
|
||||
sx={{
|
||||
ml: "auto",
|
||||
"& .MuiButtonBase-root, & .MuiButtonBase-root:hover": {
|
||||
borderColor: theme.palette.border.light,
|
||||
},
|
||||
}}
|
||||
>
|
||||
<Button
|
||||
level="secondary"
|
||||
label="All"
|
||||
onClick={() => setFilter("all")}
|
||||
sx={{
|
||||
backgroundColor:
|
||||
filter === "all" && theme.palette.otherColors.fillGray,
|
||||
filter === "all"
|
||||
? theme.palette.background.fill
|
||||
: theme.palette.background.main,
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
@@ -110,7 +126,9 @@ const Incidents = () => {
|
||||
onClick={() => setFilter("down")}
|
||||
sx={{
|
||||
backgroundColor:
|
||||
filter === "down" && theme.palette.otherColors.fillGray,
|
||||
filter === "down"
|
||||
? theme.palette.background.fill
|
||||
: theme.palette.background.main,
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
@@ -119,7 +137,9 @@ const Incidents = () => {
|
||||
onClick={() => setFilter("resolve")}
|
||||
sx={{
|
||||
backgroundColor:
|
||||
filter === "resolve" && theme.palette.otherColors.fillGray,
|
||||
filter === "resolve"
|
||||
? theme.palette.background.fill
|
||||
: theme.palette.background.main,
|
||||
}}
|
||||
/>
|
||||
</ButtonGroup>
|
||||
|
||||
Reference in new issue
Block a user