Added barebones theme toggle

This commit is contained in:
Daniel Cojocea committed 2024-08-28 22:14:55 -04:00
1 parent 9a62a42a09
commit aca350495a
21 files changed
+286 -105

No files matched your search

@@ -30,7 +30,7 @@ const IncidentTable = ({ monitors, selectedMonitor, filter }) => {
const [checksCount, setChecksCount] = useState(0);
const [paginationController, setPaginationController] = useState({
page: 0,
rowsPerPage: 12,
rowsPerPage: 14,
});
useEffect(() => {
@@ -169,6 +169,10 @@ const IncidentTable = ({ monitors, selectedMonitor, filter }) => {
sx={{
border: `solid 1px ${theme.palette.border.light}`,
borderRadius: theme.shape.borderRadius,
backgroundColor: theme.palette.background.main,
"& .MuiTableCell-root": {
borderBottomColor: theme.palette.border.light,
},
}}
>
<Table>
+5 -1
View File
@@ -78,7 +78,11 @@ const Incidents = () => {
};
return (
<Stack className="incidents" pt={theme.spacing(20)} gap={theme.spacing(12)}>
<Stack
className="incidents"
pt={theme.spacing(21)}
gap={theme.spacing(12)}
>
{loading ? (
<SkeletonLayout />
) : (
@@ -237,6 +237,10 @@ const CreateMonitor = () => {
onClick={() => setHttps(true)}
sx={{
backgroundColor: https && theme.palette.background.fill,
borderColor: theme.palette.border.dark,
"&:hover": {
borderColor: theme.palette.border.dark,
},
}}
/>
<Button
@@ -245,6 +249,10 @@ const CreateMonitor = () => {
onClick={() => setHttps(false)}
sx={{
backgroundColor: !https && theme.palette.background.fill,
borderColor: theme.palette.border.dark,
"&:hover": {
borderColor: theme.palette.border.dark,
},
}}
/>
</ButtonGroup>
@@ -125,6 +125,7 @@ const PaginationTable = ({ monitorId, dateRange }) => {
sx={{
border: `solid 1px ${theme.palette.border.light}`,
borderRadius: theme.shape.borderRadius,
backgroundColor: theme.palette.background.main,
}}
>
<Table>
@@ -134,13 +135,28 @@ const PaginationTable = ({ monitorId, dateRange }) => {
}}
>
<TableRow>
<TableCell sx={{ color: theme.palette.text.secondary }}>
<TableCell
sx={{
color: theme.palette.text.secondary,
borderBottomColor: theme.palette.border.light,
}}
>
Status
</TableCell>
<TableCell sx={{ color: theme.palette.text.secondary }}>
<TableCell
sx={{
color: theme.palette.text.secondary,
borderBottomColor: theme.palette.border.light,
}}
>
Date & Time
</TableCell>
<TableCell sx={{ color: theme.palette.text.secondary }}>
<TableCell
sx={{
color: theme.palette.text.secondary,
borderBottomColor: theme.palette.border.light,
}}
>
Message
</TableCell>
</TableRow>
@@ -151,17 +167,31 @@ const PaginationTable = ({ monitorId, dateRange }) => {
return (
<TableRow key={check._id}>
<TableCell>
<TableCell
sx={{
borderBottomColor: theme.palette.border.light,
}}
>
<StatusLabel
status={status}
text={status}
customStyles={{ textTransform: "capitalize" }}
/>
</TableCell>
<TableCell>
<TableCell
sx={{
borderBottomColor: theme.palette.border.light,
}}
>
{new Date(check.createdAt).toLocaleString()}
</TableCell>
<TableCell>{check.statusCode}</TableCell>
<TableCell
sx={{
borderBottomColor: theme.palette.border.light,
}}
>
{check.statusCode}
</TableCell>
</TableRow>
);
})}
+7 -2
View File
@@ -8,7 +8,12 @@ import ClockSnooze from "../../../assets/icons/clock-snooze.svg?react";
const StatusBox = ({ title, value }) => {
const theme = useTheme();
let sharedStyles = { position: "absolute", right: 8, opacity: 0.5 };
let sharedStyles = {
position: "absolute",
right: 8,
opacity: 0.5,
"& svg path": { stroke: theme.palette.other.icon },
};
let color;
let icon;
@@ -48,7 +53,7 @@ const StatusBox = ({ title, value }) => {
overflow="hidden"
sx={{
"&:hover": {
backgroundColor: "#f9fafb",
backgroundColor: theme.palette.background.accent,
},
"&:after": {
position: "absolute",
@@ -77,6 +77,9 @@ const ActionsMenu = ({ monitor, isAdmin }) => {
"&:focus": {
outline: "none",
},
"& svg path": {
stroke: theme.palette.other.icon,
},
}}
>
<Settings />
@@ -94,6 +97,7 @@ const ActionsMenu = ({ monitor, isAdmin }) => {
borderColor: theme.palette.border.light,
borderRadius: theme.shape.borderRadius,
boxShadow: theme.shape.boxShadow,
backgroundColor: theme.palette.background.main,
"& ul": {
p: theme.spacing(2.5),
minWidth: "100px",
+1 -1
View File
@@ -145,7 +145,7 @@ const Monitors = ({ isAdmin }) => {
color={theme.palette.text.primary}
border={1}
borderColor={theme.palette.border.light}
backgroundColor={theme.palette.unresolved.bg}
backgroundColor={theme.palette.background.accent}
>
{monitorState.monitors.length}
</Box>
@@ -4,6 +4,7 @@ import BarChart from "../../../Components/Charts/BarChart";
import ArrowDownwardRoundedIcon from "@mui/icons-material/ArrowDownwardRounded";
import { StatusLabel } from "../../../Components/Label";
import { Box } from "@mui/material";
import { useTheme } from "@emotion/react";
const data = {
cols: [
@@ -27,13 +28,17 @@ const data = {
};
export const buildData = (monitors, isAdmin, navigate) => {
const theme = useTheme();
data.rows = monitors.map((monitor, idx) => {
const params = {
url: monitor.url,
title: monitor.name,
percentage: 100,
percentageColor:
monitor.status === true ? "var(--success-color)" : "var(--error-color)",
monitor.status === true
? theme.palette.success.main
: theme.palette.error.text,
status: monitor.status === true ? "up" : "down",
};