feat: simplify and adjust status label

This commit is contained in:
Caio Cabral committed 2025-01-12 09:39:31 -05:00
1 parent 5eca39cd04
commit 61aaa8489a
58 files changed
+266 -202

No files matched your search

+1 -1
View File
@@ -84,7 +84,7 @@ const Account = ({ open = "profile" }) => {
tabIndex={index}
sx={{
fontSize: 13,
color: theme.palette.primary.contrastText.tertiary,
color: theme.palette.primary.contrastTextTertiary,
textTransform: "none",
minWidth: "fit-content",
minHeight: 0,
+3 -3
View File
@@ -50,7 +50,7 @@ const LandingPage = ({ isSuperAdmin, onSignup }) => {
"& svg": {
mr: theme.spacing(4),
"& path": {
stroke: theme.palette.primary.contrastText.tertiary,
stroke: theme.palette.primary.contrastTextTertiary,
},
},
"&:focus-visible": {
@@ -77,7 +77,7 @@ const LandingPage = ({ isSuperAdmin, onSignup }) => {
}}
sx={{
"&:hover": {
color: theme.palette.primary.contrastText.tertiary,
color: theme.palette.primary.contrastTextTertiary,
},
}}
>
@@ -95,7 +95,7 @@ const LandingPage = ({ isSuperAdmin, onSignup }) => {
}}
sx={{
"&:hover": {
color: theme.palette.primary.contrastText.tertiary,
color: theme.palette.primary.contrastTextTertiary,
},
}}
>
@@ -16,7 +16,7 @@ const Empty = ({ styles, mode }) => {
</Box>
<Typography
textAlign="center"
color={theme.palette.primary.contrastText.secondary}
color={theme.palette.primary.contrastTextSecondary}
>
No incidents recorded yet.
</Typography>
@@ -159,7 +159,7 @@ const IncidentTable = ({ monitors, selectedMonitor, filter }) => {
</Box>
<Typography
textAlign="center"
color={theme.palette.primary.contrastText.secondary}
color={theme.palette.primary.contrastTextSecondary}
>
The monitor you have selected has no recorded incidents yet.
</Typography>
+1 -1
View File
@@ -84,7 +84,7 @@ const Incidents = () => {
<Typography
display="inline-block"
component="h1"
color={theme.palette.primary.contrastText.secondary}
color={theme.palette.primary.contrastTextSecondary}
>
Incidents for
</Typography>
@@ -19,7 +19,7 @@ const Empty = ({ styles }) => {
<Typography variant="h2">Your infrastructure dashboard will show here</Typography>
<Typography
textAlign="center"
color={theme.palette.primary.contrastText.secondary}
color={theme.palette.primary.contrastTextSecondary}
>
Hang tight! Data is loading
</Typography>
@@ -83,7 +83,7 @@ const InfrastructureMenu = ({ monitor, isAdmin, updateCallback }) => {
outline: "none",
},
"& svg path": {
stroke: theme.palette.primary.contrastText.tertiary,
stroke: theme.palette.primary.contrastTextTertiary,
},
}}
ref={anchor}
@@ -98,9 +98,9 @@ function Pagination({
},
}}
sx={{
color: theme.palette.primary.contrastText.secondary,
color: theme.palette.primary.contrastTextSecondary,
"& svg path": {
stroke: theme.palette.primary.contrastText.tertiary,
stroke: theme.palette.primary.contrastTextTertiary,
strokeWidth: 1.3,
},
"& .MuiSelect-select": {
+3 -3
View File
@@ -156,7 +156,7 @@ function Infrastructure() {
? theme.palette.percentage.uptimeFair
: monitor.uptimePercentage < 0.75
? theme.palette.percentage.uptimeGood
: theme.palette.success.accent;
: theme.palette.success.lowContrast;
return {
id: monitor._id,
name: monitor.name,
@@ -229,7 +229,7 @@ function Infrastructure() {
<Box
component="span"
className="current-monitors-counter"
color={theme.palette.primary.contrastText.main}
color={theme.palette.primary.contrastText}
border={1}
borderColor={theme.palette.primary.lowContrast}
backgroundColor={theme.palette.tertiary.main}
@@ -313,7 +313,7 @@ function Infrastructure() {
<IconButton
sx={{
"& svg path": {
stroke: theme.palette.primary.contrastText.tertiary,
stroke: theme.palette.primary.contrastTextTertiary,
},
}}
>
+1 -1
View File
@@ -126,7 +126,7 @@ const Integrations = () => {
gap={theme.spacing(2)}
sx={{
"& h1, & p": {
color: theme.palette.primary.contrastText.secondary,
color: theme.palette.primary.contrastTextSecondary,
},
}}
>
@@ -394,7 +394,7 @@ const CreateMaintenance = () => {
py: 0,
mr: 0,
"& path": {
stroke: theme.palette.primary.contrastText.tertiary,
stroke: theme.palette.primary.contrastTextTertiary,
strokeWidth: 1.1,
},
"&:hover": { backgroundColor: "transparent" },
@@ -95,7 +95,7 @@ const ActionsMenu = ({ /* isAdmin, */ maintenanceWindow, updateCallback }) => {
outline: "none",
},
"& svg path": {
stroke: theme.palette.primary.contrastText.tertiary,
stroke: theme.palette.primary.contrastTextTertiary,
},
}}
>
@@ -329,9 +329,9 @@ const MaintenanceTable = ({
}}
sx={{
mt: theme.spacing(6),
color: theme.palette.primary.contrastText.secondary,
color: theme.palette.primary.contrastTextSecondary,
"& svg path": {
stroke: theme.palette.primary.contrastText.tertiary,
stroke: theme.palette.primary.contrastTextTertiary,
strokeWidth: 1.3,
},
"& .MuiSelect-select": {
@@ -249,7 +249,7 @@ const PageSpeedConfigure = () => {
width: 4,
height: 4,
borderRadius: "50%",
backgroundColor: theme.palette.primary.contrastText.tertiary,
backgroundColor: theme.palette.primary.contrastTextTertiary,
opacity: 0.8,
left: -10,
top: "50%",
@@ -276,7 +276,7 @@ const PageSpeedConfigure = () => {
"& svg": {
mr: theme.spacing(2),
"& path": {
stroke: theme.palette.primary.contrastText.tertiary,
stroke: theme.palette.primary.contrastTextTertiary,
strokeWidth: 0.1,
},
},
@@ -179,7 +179,7 @@ const CreatePageSpeed = () => {
className="create-monitor"
sx={{
"& h1": {
color: theme.palette.primary.contrastText.main,
color: theme.palette.primary.contrastText,
},
}}
>
@@ -207,7 +207,7 @@ const CreatePageSpeed = () => {
component="span"
fontSize="inherit"
fontWeight="inherit"
color={theme.palette.primary.contrastText.secondary}
color={theme.palette.primary.contrastTextSecondary}
>
PageSpeed monitor
</Typography>
@@ -64,7 +64,7 @@ const CustomToolTip = ({ active, payload, label, config }) => {
>
<Typography
sx={{
color: theme.palette.primary.contrastText.tertiary,
color: theme.palette.primary.contrastTextTertiary,
fontSize: 12,
fontWeight: 500,
}}
@@ -86,7 +86,7 @@ const CustomToolTip = ({ active, payload, label, config }) => {
mt={theme.spacing(1)}
sx={{
"& span": {
color: theme.palette.primary.contrastText.tertiary,
color: theme.palette.primary.contrastTextTertiary,
fontSize: 11,
fontWeight: 500,
},
@@ -186,7 +186,7 @@ const CustomTick = ({ x, y, payload, index }) => {
x={x}
y={y + 8}
textAnchor="middle"
fill={theme.palette.primary.contrastText.tertiary}
fill={theme.palette.primary.contrastTextTertiary}
fontSize={11}
fontWeight={400}
>
+3 -3
View File
@@ -151,7 +151,7 @@ const PageSpeedDetails = () => {
width: 4,
height: 4,
borderRadius: "50%",
backgroundColor: theme.palette.primary.contrastText.tertiary,
backgroundColor: theme.palette.primary.contrastTextTertiary,
opacity: 0.8,
left: -9,
top: "50%",
@@ -175,7 +175,7 @@ const PageSpeedDetails = () => {
"& svg": {
mr: theme.spacing(3),
"& path": {
stroke: theme.palette.primary.contrastText.tertiary,
stroke: theme.palette.primary.contrastTextTertiary,
},
},
}}
@@ -410,7 +410,7 @@ const PageSpeedDetails = () => {
component="span"
fontSize={14}
fontWeight={500}
color={theme.palette.primary.contrastText.main}
color={theme.palette.primary.contrastText}
>
{value}
<Typography
@@ -12,11 +12,11 @@ export const ChartBox = styled(Stack)(({ theme }) => ({
borderBottomRightRadius: 16,
backgroundColor: theme.palette.primary.main,
"& h2": {
color: theme.palette.primary.contrastText.secondary,
color: theme.palette.primary.contrastTextSecondary,
fontSize: 15,
fontWeight: 500,
},
"& p": { color: theme.palette.primary.contrastText.tertiary },
"& p": { color: theme.palette.primary.contrastTextTertiary },
"& > :nth-of-type(1)": {
gridColumn: 1,
gridRow: 1,
+3 -3
View File
@@ -33,7 +33,7 @@ const CustomToolTip = ({ payload }) => {
>
<Typography
sx={{
color: theme.palette.primary.contrastText.tertiary,
color: theme.palette.primary.contrastTextTertiary,
fontSize: 12,
fontWeight: 500,
}}
@@ -52,7 +52,7 @@ const CustomToolTip = ({ payload }) => {
mt={theme.spacing(1)}
sx={{
"& span": {
color: theme.palette.primary.contrastText.tertiary,
color: theme.palette.primary.contrastTextTertiary,
fontSize: 11,
fontWeight: 500,
},
@@ -299,7 +299,7 @@ const Card = ({ monitor }) => {
<Typography
component="span"
fontSize={12}
color={theme.palette.primary.contrastText.main}
color={theme.palette.primary.contrastText}
>
{time}{" "}
</Typography>
+1 -1
View File
@@ -113,7 +113,7 @@ const PageSpeed = () => {
<Box
component="span"
className="current-monitors-counter"
color={theme.palette.primary.contrastText.main}
color={theme.palette.primary.contrastText}
border={1}
borderColor={theme.palette.primary.lowContrast}
backgroundColor={theme.palette.tertiary.main}
+2 -2
View File
@@ -276,7 +276,7 @@ const Configure = () => {
width: 4,
height: 4,
borderRadius: "50%",
backgroundColor: theme.palette.primary.contrastText.tertiary,
backgroundColor: theme.palette.primary.contrastTextTertiary,
opacity: 0.8,
left: -10,
top: "50%",
@@ -307,7 +307,7 @@ const Configure = () => {
width: 22,
height: 22,
"& path": {
stroke: theme.palette.primary.contrastText.tertiary,
stroke: theme.palette.primary.contrastTextTertiary,
strokeWidth: 1.7,
},
},
+5 -5
View File
@@ -190,7 +190,7 @@ const DetailsPage = () => {
width: 4,
height: 4,
borderRadius: "50%",
backgroundColor: theme.palette.primary.contrastText.tertiary,
backgroundColor: theme.palette.primary.contrastTextTertiary,
opacity: 0.8,
left: -9,
top: "50%",
@@ -259,7 +259,7 @@ const DetailsPage = () => {
<Typography
component="span"
fontSize={13}
color={theme.palette.primary.contrastText.main}
color={theme.palette.primary.contrastText}
>
{certificateExpiry}
</Typography>
@@ -333,7 +333,7 @@ const DetailsPage = () => {
position="absolute"
top="100%"
fontSize={11}
color={theme.palette.primary.contrastText.tertiary}
color={theme.palette.primary.contrastTextTertiary}
>
{formatDateWithTz(
hoveredUptimeData._id,
@@ -390,7 +390,7 @@ const DetailsPage = () => {
position="absolute"
top="100%"
fontSize={11}
color={theme.palette.primary.contrastText.tertiary}
color={theme.palette.primary.contrastTextTertiary}
>
{formatDateWithTz(
hoveredIncidentsData._id,
@@ -443,7 +443,7 @@ const DetailsPage = () => {
</IconBox>
<Typography
component="h2"
color={theme.palette.primary.contrastText.secondary}
color={theme.palette.primary.contrastTextSecondary}
>
History
</Typography>
+4 -4
View File
@@ -12,16 +12,16 @@ export const ChartBox = styled(Stack)(({ theme }) => ({
borderRadius: 4,
backgroundColor: theme.palette.primary.main,
"& h2": {
color: theme.palette.primary.contrastText.secondary,
color: theme.palette.primary.contrastTextSecondary,
fontSize: 15,
fontWeight: 500,
},
"& .MuiBox-root:not(.area-tooltip) p": {
color: theme.palette.primary.contrastText.tertiary,
color: theme.palette.primary.contrastTextTertiary,
fontSize: 13,
},
"& .MuiBox-root > span": {
color: theme.palette.primary.contrastText.main,
color: theme.palette.primary.contrastText,
fontSize: 20,
"& span": {
opacity: 0.8,
@@ -37,7 +37,7 @@ export const ChartBox = styled(Stack)(({ theme }) => ({
alignItems: "center",
},
"& tspan, & text": {
fill: theme.palette.primary.contrastText.tertiary,
fill: theme.palette.primary.contrastTextTertiary,
},
"& path": {
transition: "fill 300ms ease, stroke-width 400ms ease",
@@ -30,7 +30,7 @@ const CurrentMonitoring = ({ totalMonitors, monitors, isAdmin, handlePause }) =>
<Box
className="current-monitors-counter"
color={theme.palette.primary.contrastText.main}
color={theme.palette.primary.contrastText}
border={1}
borderColor={theme.palette.primary.lowContrast}
backgroundColor={theme.palette.tertiary.main}
+7 -7
View File
@@ -12,27 +12,27 @@ const StatusBox = ({ title, value }) => {
position: "absolute",
right: 8,
opacity: 0.5,
"& svg path": { stroke: theme.palette.primary.contrastText.tertiary },
"& svg path": { stroke: theme.palette.primary.contrastTextTertiary },
};
let color;
let icon;
if (title === "up") {
color = theme.palette.success.accent;
color = theme.palette.success.lowContrast;
icon = (
<Box sx={{ ...sharedStyles, top: 8 }}>
<Arrow />
</Box>
);
} else if (title === "down") {
color = theme.palette.error.accent;
color = theme.palette.error.lowContrast;
icon = (
<Box sx={{ ...sharedStyles, transform: "rotate(180deg)", top: 5 }}>
<Arrow />
</Box>
);
} else if (title === "paused") {
color = theme.palette.warning.accent;
color = theme.palette.warning.lowContrast;
icon = (
<Box sx={{ ...sharedStyles, top: 12, right: 12 }}>
<ClockSnooze />
@@ -58,7 +58,7 @@ const StatusBox = ({ title, value }) => {
left: "5%",
pointerEvents: "none",
"& svg g g:last-of-type path": {
stroke: theme.palette.primary.contrastText.tertiary,
stroke: theme.palette.primary.contrastTextTertiary,
},
}}
>
@@ -68,7 +68,7 @@ const StatusBox = ({ title, value }) => {
textTransform="uppercase"
fontSize={15}
letterSpacing={0.5}
color={theme.palette.primary.contrastText.tertiary}
color={theme.palette.primary.contrastTextTertiary}
mb={theme.spacing(8)}
>
{title}
@@ -88,7 +88,7 @@ const StatusBox = ({ title, value }) => {
component="span"
fontSize={20}
fontWeight={300}
color={theme.palette.primary.contrastText.secondary}
color={theme.palette.primary.contrastTextSecondary}
sx={{ opacity: 0.3 }}
>
#
@@ -171,7 +171,7 @@ const MonitorTable = ({ isAdmin, filter, setIsSearching, isSearching, handlePaus
>
<CircularProgress
sx={{
color: theme.palette.primary.contrastText.tertiary,
color: theme.palette.primary.contrastTextTertiary,
}}
/>
</Box>
@@ -182,7 +182,7 @@ const MonitorTable = ({ isAdmin, filter, setIsSearching, isSearching, handlePaus
sx={{
backgroundColor: theme.palette.primary.main,
"& :is(th, td)": {
color: theme.palette.primary.contrastText.main,
color: theme.palette.primary.contrastText,
},
}}
>
@@ -238,7 +238,7 @@ const MonitorTable = ({ isAdmin, filter, setIsSearching, isSearching, handlePaus
{monitors.length > 0 ? (
monitors.map((monitor) => {
let uptimePercentage = "";
let percentageColor = theme.palette.success.accent;
let percentageColor = theme.palette.success.lowContrast;
// Determine uptime percentage and color based on the monitor's uptimePercentage value
if (monitor.uptimePercentage !== undefined) {
+2 -2
View File
@@ -90,7 +90,7 @@ const ActionsMenu = ({ monitor, isAdmin, updateRowCallback, pauseCallback }) =>
outline: "none",
},
"& svg path": {
stroke: theme.palette.primary.contrastText.tertiary,
stroke: theme.palette.primary.contrastTextTertiary,
},
}}
>
@@ -110,7 +110,7 @@ const ActionsMenu = ({ monitor, isAdmin, updateRowCallback, pauseCallback }) =>
p: theme.spacing(2.5),
backgroundColor: theme.palette.primary.main,
},
"& li": { m: 0, color: theme.palette.primary.contrastText.secondary },
"& li": { m: 0, color: theme.palette.primary.contrastTextSecondary },
/*
This should not be set automatically on the last of type
"& li:last-of-type": {
+1 -1
View File
@@ -21,7 +21,7 @@ const Fallback = ({ isAdmin }) => {
border={1}
borderRadius={theme.shape.borderRadius}
borderColor={theme.palette.primary.lowContrast}
color={theme.palette.primary.contrastText.secondary}
color={theme.palette.primary.contrastTextSecondary}
>
<Box pb={theme.spacing(20)}>
{mode === "light" ? <PlaceholderLight /> : <PlaceholderDark />}
+39
View File
@@ -72,6 +72,45 @@ const UptimeMonitors = () => {
>
Create new
</Button>
<Button
variant="contained"
color="success"
onClick={() => {
navigate("/uptime/create");
}}
sx={{
fontWeight: 500,
whiteSpace: "nowrap",
}}
>
Create new
</Button>
<Button
variant="contained"
color="warning"
onClick={() => {
navigate("/uptime/create");
}}
sx={{
fontWeight: 500,
whiteSpace: "nowrap",
}}
>
Create new
</Button>
<Button
variant="contained"
color="error"
onClick={() => {
navigate("/uptime/create");
}}
sx={{
fontWeight: 500,
whiteSpace: "nowrap",
}}
>
Create new
</Button>
</>
)}
</Stack>
+19 -12
View File
@@ -11,10 +11,10 @@ const useUtils = () => {
const theme = useTheme();
const statusColor = {
up: theme.palette.success.accent,
down: theme.palette.error.accent,
paused: theme.palette.warning.accent,
pending: theme.palette.warning.accent,
up: theme.palette.success.lowContrast,
down: theme.palette.error.lowContrast,
paused: theme.palette.warning.lowContrast,
pending: theme.palette.warning.lowContrast,
};
const statusMsg = {
@@ -31,32 +31,39 @@ const useUtils = () => {
/* This is used on
1) Details > Gradient card */
/* These are rediections. We should do something that maps up to success, down to error, and get the theme by that
*/
const statusStyles = {
up: {
backgroundColor: theme.palette.success.accent,
background: `linear-gradient(340deg, ${theme.palette.success.accent} -60%, ${theme.palette.success.contrastText} 35%)`,
backgroundColor: theme.palette.success.lowContrast,
background: `linear-gradient(340deg, ${theme.palette.success.lowContrast} -60%, ${theme.palette.success.contrastText} 35%)`,
borderColor: theme.palette.success.contrastText,
"& h2": { color: theme.palette.success.main },
},
down: {
backgroundColor: theme.palette.error.accent /* dark */,
background: `linear-gradient(340deg, ${theme.palette.error.accent} -60%, ${theme.palette.error.contrastText} 35%)`,
backgroundColor: theme.palette.error.lowContrast,
background: `linear-gradient(340deg, ${theme.palette.error.lowContrast} -60%, ${theme.palette.error.contrastText} 35%)`,
borderColor: theme.palette.error.contrastText,
"& h2": { color: theme.palette.error.main },
},
paused: {
backgroundColor: theme.palette.warning.accent /* dark */,
background: `linear-gradient(340deg, ${theme.palette.warning.accent} -60%, ${theme.palette.warning.contrastText} 35%)`,
backgroundColor: theme.palette.warning.lowContrast,
background: `linear-gradient(340deg, ${theme.palette.warning.lowContrast} -60%, ${theme.palette.warning.contrastText} 35%)`,
borderColor: theme.palette.warning.contrastText,
"& h2": { color: theme.palette.warning.main },
},
pending: {
backgroundColor: theme.palette.warning.accent /* dark */,
background: `linear-gradient(340deg, ${theme.palette.warning.accent} -60%, ${theme.palette.warning.contrastText} 35%)`,
backgroundColor: theme.palette.warning.lowContrast,
background: `linear-gradient(340deg, ${theme.palette.warning.lowContrast} -60%, ${theme.palette.warning.contrastText} 35%)`,
borderColor: theme.palette.warning.contrastText,
"& h2": { color: theme.palette.warning.main },
},
};
/* These are rediections. We should do something that maps up to success, down to error, and get the theme by that
*/
const pagespeedStyles = {
up: {
bg: theme.palette.success.dark,