Merge pull request #762 from bluewave-labs/feat/warning-palette-and-breadcrumbs

Password tab style and breadcrumbs
This commit is contained in:
Alexander Holliday authored and GitHub committed 2024-08-30 11:49:00 -07:00
commit f288182460
8 files changed
+142 -115

No files matched your search

+4 -33
View File
@@ -200,31 +200,12 @@ const BasicTable = ({ data, paginated, reversed, table }) => {
return ( return (
<> <>
<TableContainer <TableContainer component={Paper}>
component={Paper}
sx={{
backgroundColor: theme.palette.background.main,
border: `solid 1px ${theme.palette.border.light}`,
borderRadius: theme.shape.borderRadius,
}}
>
<Table> <Table>
<TableHead <TableHead>
sx={{
backgroundColor: theme.palette.background.accent,
}}
>
<TableRow> <TableRow>
{data.cols.map((col) => ( {data.cols.map((col) => (
<TableCell <TableCell key={col.id}>{col.name}</TableCell>
key={col.id}
sx={{
color: theme.palette.text.secondary,
borderBottomColor: theme.palette.border.light,
}}
>
{col.name}
</TableCell>
))} ))}
</TableRow> </TableRow>
</TableHead> </TableHead>
@@ -242,17 +223,7 @@ const BasicTable = ({ data, paginated, reversed, table }) => {
onClick={row.handleClick ? row.handleClick : null} onClick={row.handleClick ? row.handleClick : null}
> >
{row.data.map((cell) => { {row.data.map((cell) => {
return ( return <TableCell key={cell.id}>{cell.data}</TableCell>;
<TableCell
key={cell.id}
sx={{
color: theme.palette.text.secondary,
borderBottomColor: theme.palette.border.light,
}}
>
{cell.data}
</TableCell>
);
})} })}
</TableRow> </TableRow>
); );
+18 -3
View File
@@ -598,8 +598,9 @@ function Sidebar() {
MenuListProps={{ MenuListProps={{
sx: { sx: {
p: 2, p: 2,
"& li": { m: 0 },
"& li:has(.MuiBox-root):hover": { "& li:has(.MuiBox-root):hover": {
backgroundColor: theme.palette.background.main, backgroundColor: "transparent",
}, },
}, },
}} }}
@@ -620,8 +621,22 @@ function Sidebar() {
</MenuItem> </MenuItem>
)} )}
{collapsed && <Divider />} {collapsed && <Divider />}
<MenuItem onClick={() => dispatch(setMode("light"))}>Light</MenuItem> <MenuItem
<MenuItem onClick={() => dispatch(setMode("dark"))}>Dark</MenuItem> onClick={() => {
dispatch(setMode("light"));
closePopup();
}}
>
Light
</MenuItem>
<MenuItem
onClick={() => {
dispatch(setMode("dark"));
closePopup();
}}
>
Dark
</MenuItem>
<Divider /> <Divider />
<MenuItem <MenuItem
onClick={logout} onClick={logout}
+2 -11
View File
@@ -93,17 +93,8 @@ const ActionsMenu = ({ monitor, isAdmin }) => {
slotProps={{ slotProps={{
paper: { paper: {
sx: { sx: {
"& ul": { "& ul": { p: theme.spacing(2.5) },
p: theme.spacing(2.5), "& li": { m: 0 },
minWidth: "100px",
},
"& li": {
color: theme.palette.text.secondary,
fontSize: 13,
px: theme.spacing(4),
py: theme.spacing(2.5),
borderRadius: theme.shape.borderRadius,
},
"& li:last-of-type": { "& li:last-of-type": {
color: theme.palette.error.text, color: theme.palette.error.text,
}, },
+2 -30
View File
@@ -13,6 +13,7 @@ import Fallback from "./fallback";
import StatusBox from "./StatusBox"; import StatusBox from "./StatusBox";
import { buildData } from "./monitorData"; import { buildData } from "./monitorData";
import Breadcrumbs from "../../../Components/Breadcrumbs"; import Breadcrumbs from "../../../Components/Breadcrumbs";
import Greeting from "../../../Utils/greeting";
const Monitors = ({ isAdmin }) => { const Monitors = ({ isAdmin }) => {
const theme = useTheme(); const theme = useTheme();
@@ -73,36 +74,7 @@ const Monitors = ({ isAdmin }) => {
alignItems="center" alignItems="center"
mt={theme.spacing(5)} mt={theme.spacing(5)}
> >
<Box> <Greeting type="uptime" />
<Typography
component="h1"
lineHeight={1}
color={theme.palette.text.primary}
>
<Typography
component="span"
fontSize="inherit"
color={theme.palette.text.secondary}
>
Good {greeting},{" "}
</Typography>
<Typography
component="span"
fontSize="inherit"
fontWeight="inherit"
>
{authState.user.firstName} {emoji}
</Typography>
</Typography>
<Typography
sx={{ opacity: 0.8 }}
lineHeight={1}
fontWeight={300}
color={theme.palette.text.secondary}
>
Here’s an overview of your uptime monitors.
</Typography>
</Box>
{monitorState.monitors?.length !== 0 && ( {monitorState.monitors?.length !== 0 && (
<Button <Button
level="primary" level="primary"
+3 -5
View File
@@ -1,14 +1,13 @@
.page-speed h2.MuiTypography-root { .page-speed h2.MuiTypography-root {
line-height: 1.1; line-height: 1.1;
} }
.page-speed h1.MuiTypography-root, .page-speed h1.MuiTypography-root {
font-size: var(--env-var-font-size-large-plus);
}
.page-speed h2.MuiTypography-root { .page-speed h2.MuiTypography-root {
font-size: var(--env-var-font-size-large); font-size: var(--env-var-font-size-large);
font-weight: 600; font-weight: 600;
} }
.page-speed p.MuiTypography-root {
font-size: var(--env-var-font-size-medium);
}
.page-speed p:has(> span.MuiTypography-root), .page-speed p:has(> span.MuiTypography-root),
.page-speed p.MuiTypography-root > span.MuiTypography-root { .page-speed p.MuiTypography-root > span.MuiTypography-root {
font-size: var(--env-var-font-size-small-plus); font-size: var(--env-var-font-size-small-plus);
@@ -20,5 +19,4 @@
} }
.page-speed:not(:has([class*="fallback__"])) button { .page-speed:not(:has([class*="fallback__"])) button {
height: 34px; height: 34px;
align-self: flex-end;
} }
+30 -26
View File
@@ -12,6 +12,8 @@ import Button from "../../Components/Button";
import { useNavigate } from "react-router"; import { useNavigate } from "react-router";
import { getLastChecked } from "../../Utils/monitorUtils"; import { getLastChecked } from "../../Utils/monitorUtils";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import Breadcrumbs from "../../Components/Breadcrumbs";
import Greeting from "../../Utils/greeting";
const Card = ({ data }) => { const Card = ({ data }) => {
const theme = useTheme(); const theme = useTheme();
@@ -24,7 +26,7 @@ const Card = ({ data }) => {
flexGrow={1} flexGrow={1}
sx={{ sx={{
"&:hover > .MuiStack-root": { "&:hover > .MuiStack-root": {
backgroundColor: "var(--primary-bg-accent)", backgroundColor: theme.palette.background.accent,
}, },
}} }}
> >
@@ -37,7 +39,10 @@ const Card = ({ data }) => {
borderColor={theme.palette.border.light} borderColor={theme.palette.border.light}
borderRadius={theme.shape.borderRadius} borderRadius={theme.shape.borderRadius}
backgroundColor={theme.palette.background.main} backgroundColor={theme.palette.background.main}
sx={{ cursor: "pointer" }} sx={{
cursor: "pointer",
"& svg path": { stroke: theme.palette.other.icon, strokeWidth: 0.8 },
}}
> >
<PageSpeedIcon <PageSpeedIcon
style={{ width: theme.spacing(8), height: theme.spacing(8) }} style={{ width: theme.spacing(8), height: theme.spacing(8) }}
@@ -56,7 +61,9 @@ const Card = ({ data }) => {
text={data.status ? "Live (collecting data)" : "Inactive"} text={data.status ? "Live (collecting data)" : "Inactive"}
/> />
</Stack> </Stack>
<Typography>{data.url.replace(/^https?:\/\//, "")}</Typography> <Typography fontSize={13}>
{data.url.replace(/^https?:\/\//, "")}
</Typography>
<Typography mt={theme.spacing(12)}> <Typography mt={theme.spacing(12)}>
<Typography component="span" fontWeight={600}> <Typography component="span" fontWeight={600}>
Last checked:{" "} Last checked:{" "}
@@ -142,7 +149,7 @@ const PageSpeed = ({ isAdmin }) => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const navigate = useNavigate(); const navigate = useNavigate();
const { authToken } = useSelector((state) => state.auth); const { authToken, user } = useSelector((state) => state.auth);
const { monitors, isLoading } = useSelector( const { monitors, isLoading } = useSelector(
(state) => state.pageSpeedMonitors (state) => state.pageSpeedMonitors
); );
@@ -157,7 +164,6 @@ const PageSpeed = ({ isAdmin }) => {
return ( return (
<Box <Box
className="page-speed" className="page-speed"
pt={theme.spacing(20)}
sx={{ sx={{
':has(> [class*="fallback__"])': { ':has(> [class*="fallback__"])': {
position: "relative", position: "relative",
@@ -173,37 +179,35 @@ const PageSpeed = ({ isAdmin }) => {
{isActuallyLoading ? ( {isActuallyLoading ? (
<SkeletonLayout /> <SkeletonLayout />
) : monitors?.length !== 0 ? ( ) : monitors?.length !== 0 ? (
<Stack <Box
gap={theme.spacing(2)}
sx={{ sx={{
"& h1, & span.MuiTypography-root, & p": { "& p": {
color: theme.palette.text.secondary, color: theme.palette.text.secondary,
}, },
}} }}
> >
<Stack <Box mb={theme.spacing(12)}>
direction="row" <Breadcrumbs list={[{ name: `pagespeed`, path: "/pagespeed" }]} />
justifyContent="space-between" <Stack
mb={theme.spacing(12)} direction="row"
> justifyContent="space-between"
<Box> alignItems="center"
<Typography component="h1">All page speed monitors</Typography> mt={theme.spacing(5)}
<Typography mt={theme.spacing(2)}> >
Click on one of the monitors to get more site speed information. <Greeting type="pagespeed" />
</Typography> <Button
</Box> level="primary"
<Button label="Create new"
level="primary" onClick={() => navigate("/pagespeed/create")}
label="Create new" />
onClick={() => navigate("/pagespeed/create")} </Stack>
/> </Box>
</Stack>
<Grid container spacing={theme.spacing(12)}> <Grid container spacing={theme.spacing(12)}>
{monitors?.map((monitor) => ( {monitors?.map((monitor) => (
<Card data={monitor} key={`monitor-${monitor._id}`} /> <Card data={monitor} key={`monitor-${monitor._id}`} />
))} ))}
</Grid> </Grid>
</Stack> </Box>
) : ( ) : (
<Fallback <Fallback
title="pagespeed monitor" title="pagespeed monitor"
+8 -7
View File
@@ -38,22 +38,22 @@ const darkTheme = createTheme({
success: { success: {
text: "#079455", text: "#079455",
main: "#45bb7a", main: "#45bb7a",
light: "#93d5aa", light: "#1e1e1e",
bg: "#27272a", bg: "#27272a",
}, },
error: { error: {
text: "#f04438", text: "#f04438",
main: "#d32f2f", main: "#d32f2f",
light: "#f04438", light: "#1e1e1e",
bg: "#27272a", bg: "#27272a",
border: "#f04438", border: "#f04438",
}, },
warning: { warning: {
text: "#DC6803", text: "#e88c30",
main: "#e88c30", main: "#FF9F00",
light: "#fffcf5", light: "#27272a",
bg: "#ffecbc", bg: "#1E1E1E",
border: "#fec84b", border: "#e88c30",
}, },
unresolved: { main: "#4e5ba6", light: "#e2eaf7", bg: "#f2f4f7" }, unresolved: { main: "#4e5ba6", light: "#e2eaf7", bg: "#f2f4f7" },
divider: border.light, divider: border.light,
@@ -102,6 +102,7 @@ const darkTheme = createTheme({
borderRadius: 4, borderRadius: 4,
boxShadow: shadow, boxShadow: shadow,
backgroundColor: background.main, backgroundColor: background.main,
backgroundImage: "none",
}, },
}, },
}, },
+75
View File
@@ -0,0 +1,75 @@
import PropTypes from "prop-types";
import { useTheme } from "@emotion/react";
import { Box, Typography } from "@mui/material";
import { useSelector } from "react-redux";
/**
* Greeting component that displays a personalized greeting message
* based on the time of day and the user's first name.
*
* @component
* @example
* return <Greeting type={"pagespeed"} />;
*
* @param {Object} props
* @param {string} props.type - The type of monitor to be displayed in the message
* @returns {JSX.Element} The rendered Greeting component
*/
const Greeting = ({ type = "" }) => {
const theme = useTheme();
const { firstName } = useSelector((state) => state.auth.user);
const now = new Date();
const hour = now.getHours();
let greeting = "";
let emoji = "";
if (hour < 12) {
greeting = "morning";
emoji = "🌅";
} else if (hour < 18) {
greeting = "afternoon";
emoji = "🌞";
} else {
greeting = "evening";
emoji = "🌙";
}
return (
<Box>
<Typography
component="h1"
lineHeight={1}
fontWeight={500}
color={theme.palette.text.primary}
>
<Typography
component="span"
fontSize="inherit"
color={theme.palette.text.secondary}
>
Good {greeting},{" "}
</Typography>
<Typography component="span" fontSize="inherit" fontWeight="inherit">
{firstName} {emoji}
</Typography>
</Typography>
<Typography
sx={{ opacity: 0.8 }}
lineHeight={1}
fontSize={14}
fontWeight={300}
color={theme.palette.text.secondary}
>
Here’s an overview of your {type} monitors.
</Typography>
</Box>
);
};
Greeting.propTypes = {
type: PropTypes.string,
};
export default Greeting;