Merge pull request #2348 from bluewave-labs/fix/prettier-format

fix: format all files
This commit is contained in:
Alexander Holliday authored and GitHub committed 2025-05-27 09:11:32 -07:00
commit 0dee7cf84f
67 files changed
+676 -378

No files matched your search

-1
View File
@@ -1,2 +1 @@
This directory contains the client side (frontend) of Checkmate. This directory contains the client side (frontend) of Checkmate.
+12 -5
View File
@@ -1,17 +1,24 @@
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" href="./checkmate_favicon.svg" /> <link
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> rel="icon"
href="./checkmate_favicon.svg"
/>
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<title>Checkmate</title> <title>Checkmate</title>
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
<script type="module" src="/src/main.jsx"></script> <script
type="module"
src="/src/main.jsx"
></script>
</body> </body>
</html> </html>
+3 -1
View File
@@ -8,7 +8,9 @@
"build": "vite build", "build": "vite build",
"build-dev": "vite build --mode development", "build-dev": "vite build --mode development",
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0", "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview" "preview": "vite preview",
"format": "prettier --write .",
"format-check": "prettier --check ."
}, },
"dependencies": { "dependencies": {
"@emotion/react": "^11.13.3", "@emotion/react": "^11.13.3",
+1 -3
View File
@@ -1,7 +1,5 @@
{ {
"$schema": "https://docs.renovatebot.com/renovate-schema.json", "$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [ "extends": ["config:recommended"],
"config:recommended"
],
"labels": ["dependencies"] "labels": ["dependencies"]
} }
@@ -36,7 +36,7 @@ const EmptyView = ({
message = "No Data", message = "No Data",
headingLevel = "h2", headingLevel = "h2",
justifyContent = "flex-start", justifyContent = "flex-start",
height = "100%" height = "100%",
}) => { }) => {
const theme = useTheme(); const theme = useTheme();
return ( return (
@@ -87,9 +87,7 @@ const EmptyView = ({
justifyContent="center" justifyContent="center"
alignItems="center" alignItems="center"
> >
<Typography component={headingLevel}> <Typography component={headingLevel}>{message}</Typography>
{message}
</Typography>
</Stack> </Stack>
</Stack> </Stack>
</Stack> </Stack>
@@ -100,9 +98,9 @@ EmptyView.propTypes = {
message: PropTypes.string, message: PropTypes.string,
icon: PropTypes.node, icon: PropTypes.node,
header: PropTypes.string, header: PropTypes.string,
headingLevel: PropTypes.oneOf(['h1', 'h2', 'h3']), headingLevel: PropTypes.oneOf(["h1", "h2", "h3"]),
justifyContent: PropTypes.string, justifyContent: PropTypes.string,
height: PropTypes.string height: PropTypes.string,
}; };
export default EmptyView; export default EmptyView;
@@ -18,7 +18,13 @@ const ChartBox = ({
}) => { }) => {
const theme = useTheme(); const theme = useTheme();
if (isEmpty) { if (isEmpty) {
return <EmptyView icon={icon} header={header} message={noDataMessage} />; return (
<EmptyView
icon={icon}
header={header}
message={noDataMessage}
/>
);
} }
return ( return (
<Stack <Stack
@@ -95,5 +101,5 @@ ChartBox.propTypes = {
header: PropTypes.string, header: PropTypes.string,
height: PropTypes.string, height: PropTypes.string,
noDataMessage: PropTypes.string, noDataMessage: PropTypes.string,
isEmpty: PropTypes.bool isEmpty: PropTypes.bool,
}; };
+88 -47
View File
@@ -1,18 +1,20 @@
import * as React from 'react'; import * as React from "react";
import Box from '@mui/material/Box'; import Box from "@mui/material/Box";
import Container from '@mui/material/Container'; import Container from "@mui/material/Container";
import IconButton from '@mui/material/IconButton'; import IconButton from "@mui/material/IconButton";
import Link from '@mui/material/Link'; import Link from "@mui/material/Link";
import Stack from '@mui/material/Stack'; import Stack from "@mui/material/Stack";
import Typography from '@mui/material/Typography'; import Typography from "@mui/material/Typography";
import { FaFacebook, FaLinkedin, FaGithub, FaTwitter, FaEnvelope } from 'react-icons/fa'; import { FaFacebook, FaLinkedin, FaGithub, FaTwitter, FaEnvelope } from "react-icons/fa";
function Copyright() { function Copyright() {
return ( return (
<Typography sx={{ color: 'text.secondary', mt: 1 }}> <Typography sx={{ color: "text.secondary", mt: 1 }}>
{'Copyright © '} {"Copyright © "}
<Link color="text.secondary" href="https://prism.uprock.com/"> <Link
color="text.secondary"
href="https://prism.uprock.com/"
>
UpRock UpRock
</Link> </Link>
&nbsp; &nbsp;
@@ -25,33 +27,38 @@ export default function Footer() {
return ( return (
<Container <Container
sx={{ sx={{
display: 'flex', display: "flex",
flexDirection: 'column', flexDirection: "column",
alignItems: 'center', alignItems: "center",
gap: { xs: 4, sm: 8 }, gap: { xs: 4, sm: 8 },
py: { xs: 24, sm: 24 }, py: { xs: 24, sm: 24 },
px: { xs: 12, sm: 12 }, px: { xs: 12, sm: 12 },
textAlign: { sm: 'center', md: 'left' }, textAlign: { sm: "center", md: "left" },
}} }}
> >
<Box <Box
sx={{ sx={{
display: 'flex', display: "flex",
justifyContent: 'space-between', justifyContent: "space-between",
pt: { xs: 4, sm: 8 }, pt: { xs: 4, sm: 8 },
width: '100%', width: "100%",
borderColor: 'divider', borderColor: "divider",
}} }}
> >
<div> <div>
<Link color="text.secondary" href="https://uprock.com/privacy-policy"> <Link
color="text.secondary"
href="https://uprock.com/privacy-policy"
>
Privacy Policy Privacy Policy
</Link> </Link>
<Typography sx={{ display: 'inline', mx: 0.5, opacity: 0.5 }}> <Typography sx={{ display: "inline", mx: 0.5, opacity: 0.5 }}>
&nbsp;•&nbsp; &nbsp;•&nbsp;
</Typography> </Typography>
<Link color="text.secondary" href="https://uprock.com/terms-of-use"> <Link
color="text.secondary"
href="https://uprock.com/terms-of-use"
>
Terms of Service Terms of Service
</Link> </Link>
<Copyright /> <Copyright />
@@ -60,14 +67,14 @@ export default function Footer() {
direction="row" direction="row"
spacing={1} spacing={1}
useFlexGap useFlexGap
sx={{ justifyContent: 'left', color: 'text.secondary' }} sx={{ justifyContent: "left", color: "text.secondary" }}
> >
<IconButton <IconButton
color="inherit" color="inherit"
size="small" size="small"
href="mailto:prism@uprock.com?subject=Interested%20in%20UpRock%20Prism" href="mailto:prism@uprock.com?subject=Interested%20in%20UpRock%20Prism"
aria-label="Contact Us" aria-label="Contact Us"
sx={{ alignSelf: 'center' }} sx={{ alignSelf: "center" }}
> >
<FaEnvelope /> <FaEnvelope />
</IconButton> </IconButton>
@@ -76,7 +83,7 @@ export default function Footer() {
size="small" size="small"
href="https://facebook.com/uprockcom" href="https://facebook.com/uprockcom"
aria-label="Facebook" aria-label="Facebook"
sx={{ alignSelf: 'center' }} sx={{ alignSelf: "center" }}
> >
<FaFacebook /> <FaFacebook />
</IconButton> </IconButton>
@@ -85,7 +92,7 @@ export default function Footer() {
size="small" size="small"
href="https://x.com/uprockcom" href="https://x.com/uprockcom"
aria-label="X" aria-label="X"
sx={{ alignSelf: 'center' }} sx={{ alignSelf: "center" }}
> >
<FaTwitter /> <FaTwitter />
</IconButton> </IconButton>
@@ -94,7 +101,7 @@ export default function Footer() {
size="small" size="small"
href="https://www.linkedin.com/company/uprock/" href="https://www.linkedin.com/company/uprock/"
aria-label="LinkedIn" aria-label="LinkedIn"
sx={{ alignSelf: 'center' }} sx={{ alignSelf: "center" }}
> >
<FaLinkedin /> <FaLinkedin />
</IconButton> </IconButton>
@@ -103,40 +110,53 @@ export default function Footer() {
size="small" size="small"
href="https://github.com/uprockcom" href="https://github.com/uprockcom"
aria-label="GitHub" aria-label="GitHub"
sx={{ alignSelf: 'center' }} sx={{ alignSelf: "center" }}
> >
<FaGithub /> <FaGithub />
</IconButton> </IconButton>
</Stack> </Stack>
</Box> </Box>
<Box <Box
sx={{ sx={{
display: 'flex', display: "flex",
flexDirection: 'column', flexDirection: "column",
alignItems: 'center', alignItems: "center",
mt: 4, mt: 4,
}} }}
> >
<Typography variant="h2" sx={{ color: 'text.secondary' }}> <Typography
variant="h2"
sx={{ color: "text.secondary" }}
>
Made with ❤️ by&nbsp; Made with ❤️ by&nbsp;
<Link href="https://uprock.com" color="inherit" sx={{ mx: 0.5 }}> <Link
href="https://uprock.com"
color="inherit"
sx={{ mx: 0.5 }}
>
UpRock&nbsp; UpRock&nbsp;
</Link> </Link>
&&nbsp; &&nbsp;
<Link href="https://bluewavelabs.ca" color="inherit" sx={{ mx: 0.5 }}> <Link
href="https://bluewavelabs.ca"
color="inherit"
sx={{ mx: 0.5 }}
>
Bluewave Labs Bluewave Labs
</Link> </Link>
</Typography> </Typography>
<Box <Box
sx={{ sx={{
display: 'flex', display: "flex",
alignItems: 'center', alignItems: "center",
mt: 2, mt: 2,
}} }}
> >
<Typography variant="h2" sx={{ color: 'text.secondary', mr: 1 }}> <Typography
variant="h2"
sx={{ color: "text.secondary", mr: 1 }}
>
Built on&nbsp; Built on&nbsp;
</Typography> </Typography>
<svg <svg
@@ -164,8 +184,14 @@ export default function Footer() {
y2="-69.2936" y2="-69.2936"
gradientTransform="matrix(1 0 0 -1 0 314)" gradientTransform="matrix(1 0 0 -1 0 314)"
> >
<stop offset="0" style={{ stopColor: 'rgb(0, 255, 163)' }} /> <stop
<stop offset="1" style={{ stopColor: 'rgb(220, 31, 255)' }} /> offset="0"
style={{ stopColor: "rgb(0, 255, 163)" }}
/>
<stop
offset="1"
style={{ stopColor: "rgb(220, 31, 255)" }}
/>
</linearGradient> </linearGradient>
<path <path
className="st0" className="st0"
@@ -180,8 +206,14 @@ export default function Footer() {
y2="-19.1475" y2="-19.1475"
gradientTransform="matrix(1 0 0 -1 0 314)" gradientTransform="matrix(1 0 0 -1 0 314)"
> >
<stop offset="0" style={{ stopColor: 'rgb(0, 255, 163)' }} /> <stop
<stop offset="1" style={{ stopColor: 'rgb(220, 31, 255)' }} /> offset="0"
style={{ stopColor: "rgb(0, 255, 163)" }}
/>
<stop
offset="1"
style={{ stopColor: "rgb(220, 31, 255)" }}
/>
</linearGradient> </linearGradient>
<path <path
className="st1" className="st1"
@@ -196,15 +228,24 @@ export default function Footer() {
y2="-44.061" y2="-44.061"
gradientTransform="matrix(1 0 0 -1 0 314)" gradientTransform="matrix(1 0 0 -1 0 314)"
> >
<stop offset="0" style={{ stopColor: 'rgb(0, 255, 163)' }} /> <stop
<stop offset="1" style={{ stopColor: 'rgb(220, 31, 255)' }} /> offset="0"
style={{ stopColor: "rgb(0, 255, 163)" }}
/>
<stop
offset="1"
style={{ stopColor: "rgb(220, 31, 255)" }}
/>
</linearGradient> </linearGradient>
<path <path
className="st2" className="st2"
d="M333.1,120.1c-2.4-2.4-5.7-3.8-9.2-3.8H6.5c-5.8,0-8.7,7-4.6,11.1l62.7,62.7c2.4,2.4,5.7,3.8,9.2,3.8h317.4 c5.8,0,8.7-7,4.6-11.1L333.1,120.1z" d="M333.1,120.1c-2.4-2.4-5.7-3.8-9.2-3.8H6.5c-5.8,0-8.7,7-4.6,11.1l62.7,62.7c2.4,2.4,5.7,3.8,9.2,3.8h317.4 c5.8,0,8.7-7,4.6-11.1L333.1,120.1z"
/> />
</svg> </svg>
<Typography variant="h2" sx={{ color: 'text.secondary', ml: 1 }}> <Typography
variant="h2"
sx={{ color: "text.secondary", ml: 1 }}
>
&nbsp;Solana &nbsp;Solana
</Typography> </Typography>
</Box> </Box>
+1 -1
View File
@@ -29,7 +29,7 @@ const ConfigBox = styled(Stack)(({ theme }) => ({
}, },
"& h1, & h2": { "& h1, & h2": {
color: theme.palette.primary.contrastTextSecondary, color: theme.palette.primary.contrastTextSecondary,
} },
})); }));
export default ConfigBox; export default ConfigBox;
+12 -3
View File
@@ -24,16 +24,25 @@ const ConfigRow = ({ title, description, children }) => {
return ( return (
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2" variant="h2"> <Typography
component="h2"
variant="h2"
>
{title} {title}
</Typography> </Typography>
{description && ( {description && (
<Typography variant="body2" mt={theme.spacing(2)}> <Typography
variant="body2"
mt={theme.spacing(2)}
>
{description} {description}
</Typography> </Typography>
)} )}
</Box> </Box>
<Stack gap={theme.spacing(15)} mt={theme.spacing(4)}> <Stack
gap={theme.spacing(15)}
mt={theme.spacing(4)}
>
{children} {children}
</Stack> </Stack>
</ConfigBox> </ConfigBox>
+6 -2
View File
@@ -42,10 +42,14 @@ const FilterHeader = ({ header, options, value, onChange, multiple = true }) =>
return header; return header;
} }
return header + " | " + selected return (
header +
" | " +
selected
.map((value) => options.find((option) => option.value === value)?.label) .map((value) => options.find((option) => option.value === value)?.label)
.filter(Boolean) .filter(Boolean)
.join(", "); .join(", ")
);
}} }}
MenuProps={{ MenuProps={{
anchorOrigin: { anchorOrigin: {
@@ -51,17 +51,15 @@ const ImageUpload = ({
(file) => { (file) => {
if (!file) return; if (!file) return;
const isValidType = accept.some((type) => const isValidType = accept.some((type) => file.type.includes(type));
file.type.includes(type)
);
const isValidSize = file.size <= maxSize; const isValidSize = file.size <= maxSize;
if (!isValidType) { if (!isValidType) {
setLocalError(t('invalidFileFormat')); setLocalError(t("invalidFileFormat"));
return; return;
} }
if (!isValidSize) { if (!isValidSize) {
setLocalError(t('invalidFileSize')); setLocalError(t("invalidFileSize"));
return; return;
} }
@@ -100,11 +98,13 @@ const ImageUpload = ({
} }
}, [uploadComplete, completedFile, onChange]); }, [uploadComplete, completedFile, onChange]);
return ( return (
<> <>
{src ? ( {src ? (
<Stack direction="row" justifyContent="center"> <Stack
direction="row"
justifyContent="center"
>
<Image <Image
alt="Uploaded preview" alt="Uploaded preview"
src={src} src={src}
@@ -129,9 +129,7 @@ const ImageUpload = ({
borderColor: isDragging borderColor: isDragging
? theme.palette.primary.main ? theme.palette.primary.main
: theme.palette.primary.lowContrast, : theme.palette.primary.lowContrast,
backgroundColor: isDragging backgroundColor: isDragging ? "hsl(215, 87%, 51%, 0.05)" : "transparent",
? "hsl(215, 87%, 51%, 0.05)"
: "transparent",
borderWidth: "2px", borderWidth: "2px",
transition: "0.2s", transition: "0.2s",
"&:hover": { "&:hover": {
@@ -190,15 +188,16 @@ const ImageUpload = ({
color="info" color="info"
fontWeight={500} fontWeight={500}
> >
{t('ClickUpload')} {t("ClickUpload")}
</Typography>{" "} </Typography>{" "}
or {t('DragandDrop')} or {t("DragandDrop")}
</Typography> </Typography>
<Typography <Typography
component="p" component="p"
color={theme.palette.primary.contrastTextTertiary} color={theme.palette.primary.contrastTextTertiary}
sx={{ opacity: 0.6 }} sx={{ opacity: 0.6 }}
>({t('MaxSize')}: {Math.round(maxSize / 1024 / 1024)}MB) >
({t("MaxSize")}: {Math.round(maxSize / 1024 / 1024)}MB)
</Typography> </Typography>
</Stack> </Stack>
</Box> </Box>
@@ -223,7 +222,7 @@ const ImageUpload = ({
color={theme.palette.primary.contrastTextTertiary} color={theme.palette.primary.contrastTextTertiary}
sx={{ opacity: 0.6 }} sx={{ opacity: 0.6 }}
> >
{t('SupportedFormats')}: {accept.join(", ").toUpperCase()} {t("SupportedFormats")}: {accept.join(", ").toUpperCase()}
</Typography> </Typography>
</> </>
)} )}
+9 -1
View File
@@ -158,7 +158,15 @@ const StatusLabel = ({ status, text, customStyles }) => {
}; };
StatusLabel.propTypes = { StatusLabel.propTypes = {
status: PropTypes.oneOf(["up", "down", "paused", "pending", "cannot resolve", "published", "unpublished"]), status: PropTypes.oneOf([
"up",
"down",
"paused",
"pending",
"cannot resolve",
"published",
"unpublished",
]),
text: PropTypes.string, text: PropTypes.string,
customStyles: PropTypes.object, customStyles: PropTypes.object,
}; };
@@ -4,13 +4,7 @@ import PropTypes from "prop-types";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
const CreateMonitorHeader = ({ const CreateMonitorHeader = ({ isAdmin, label, isLoading = true, path, bulkPath }) => {
isAdmin,
label,
isLoading = true,
path,
bulkPath,
}) => {
const navigate = useNavigate(); const navigate = useNavigate();
const { t } = useTranslation(); const { t } = useTranslation();
const theme = useTheme(); const theme = useTheme();
@@ -28,8 +28,9 @@ const MonitorStatusHeader = ({ path, isLoading = false, isAdmin, monitor }) => {
gap={theme.spacing(4)} gap={theme.spacing(4)}
> >
<PulseDot color={statusColor[determineState(monitor)]} /> <PulseDot color={statusColor[determineState(monitor)]} />
<Typography variant="h2" <Typography
style={{fontFamily : "monospace" , fontWeight : 'bolder'}} variant="h2"
style={{ fontFamily: "monospace", fontWeight: "bolder" }}
> >
{monitor?.url?.replace(/^https?:\/\//, "") || "..."} {monitor?.url?.replace(/^https?:\/\//, "") || "..."}
</Typography> </Typography>
@@ -1,10 +1,5 @@
import React from "react"; import React from "react";
import { import { Typography, Box, Button, CircularProgress } from "@mui/material";
Typography,
Box,
Button,
CircularProgress
} from "@mui/material";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
import TextInput from "../../../Components/Inputs/TextInput"; import TextInput from "../../../Components/Inputs/TextInput";
@@ -16,7 +11,7 @@ const TabComponent = ({
handleIntegrationChange, handleIntegrationChange,
handleInputChange, handleInputChange,
handleTestNotification, handleTestNotification,
isLoading isLoading,
}) => { }) => {
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation(); const { t } = useTranslation();
@@ -28,7 +23,7 @@ const TabComponent = ({
// Check if all fields have values to enable test button // Check if all fields have values to enable test button
const areAllFieldsFilled = () => { const areAllFieldsFilled = () => {
return type.fields.every(field => { return type.fields.every((field) => {
const fieldKey = getFieldKey(type.id, field.id); const fieldKey = getFieldKey(type.id, field.id);
return integrations[fieldKey]; return integrations[fieldKey];
}); });
@@ -36,41 +31,52 @@ const TabComponent = ({
return ( return (
<> <>
<Typography variant="subtitle1" component="h4" sx={{ <Typography
fontWeight: 'bold', variant="subtitle1"
color: theme.palette.primary.contrastTextSecondary component="h4"
}}> sx={{
fontWeight: "bold",
color: theme.palette.primary.contrastTextSecondary,
}}
>
{type.label} {type.label}
</Typography> </Typography>
<Typography sx={{ <Typography
sx={{
mt: theme.spacing(0.5), mt: theme.spacing(0.5),
mb: theme.spacing(1.5), mb: theme.spacing(1.5),
color: theme.palette.primary.contrastTextTertiary color: theme.palette.primary.contrastTextTertiary,
}}> }}
>
{type.description} {type.description}
</Typography> </Typography>
<Box sx={{ pl: theme.spacing(1.5) }}> <Box sx={{ pl: theme.spacing(1.5) }}>
<Checkbox <Checkbox
id={`enable-${type.id}`} id={`enable-${type.id}`}
label={t('notifications.enableNotifications', { platform: type.label })} label={t("notifications.enableNotifications", { platform: type.label })}
isChecked={integrations[type.id]} isChecked={integrations[type.id]}
onChange={(e) => handleIntegrationChange(type.id, e.target.checked)} onChange={(e) => handleIntegrationChange(type.id, e.target.checked)}
disabled={isLoading} disabled={isLoading}
/> />
</Box> </Box>
{type.fields.map(field => { {type.fields.map((field) => {
const fieldKey = getFieldKey(type.id, field.id); const fieldKey = getFieldKey(type.id, field.id);
return ( return (
<Box key={field.id} sx={{ mt: theme.spacing(1) }}> <Box
<Typography sx={{ key={field.id}
sx={{ mt: theme.spacing(1) }}
>
<Typography
sx={{
mb: theme.spacing(2), mb: theme.spacing(2),
fontWeight: 'bold', fontWeight: "bold",
color: theme.palette.primary.contrastTextSecondary color: theme.palette.primary.contrastTextSecondary,
}}> }}
>
{field.label} {field.label}
</Typography> </Typography>
@@ -99,7 +105,7 @@ const TabComponent = ({
sx={{ mr: theme.spacing(1), color: theme.palette.accent.main }} sx={{ mr: theme.spacing(1), color: theme.palette.accent.main }}
/> />
) : null} ) : null}
{t('notifications.testNotification')} {t("notifications.testNotification")}
</Button> </Button>
</Box> </Box>
</> </>
@@ -25,22 +25,17 @@ function TabPanel({ children, value, index, ...other }) {
aria-labelledby={`notification-tab-${index}`} aria-labelledby={`notification-tab-${index}`}
{...other} {...other}
> >
{value === index && ( {value === index && <Box sx={{ pt: theme.spacing(3) }}>{children}</Box>}
<Box sx={{ pt: theme.spacing(3) }}>
{children}
</Box>
)}
</div> </div>
); );
} }
TabPanel.propTypes = { TabPanel.propTypes = {
children: PropTypes.node, children: PropTypes.node,
index: PropTypes.number.isRequired, index: PropTypes.number.isRequired,
value: PropTypes.number.isRequired value: PropTypes.number.isRequired,
}; };
export default TabPanel; export default TabPanel;
@@ -1,22 +1,22 @@
import { useState } from 'react'; import { useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { networkService } from '../../../Utils/NetworkService'; import { networkService } from "../../../Utils/NetworkService";
import { createToast } from '../../../Utils/toastUtils'; import { createToast } from "../../../Utils/toastUtils";
// Define constants for notification types to avoid magic values // Define constants for notification types to avoid magic values
const NOTIFICATION_TYPES = { const NOTIFICATION_TYPES = {
SLACK: 'slack', SLACK: "slack",
DISCORD: 'discord', DISCORD: "discord",
TELEGRAM: 'telegram', TELEGRAM: "telegram",
WEBHOOK: 'webhook' WEBHOOK: "webhook",
}; };
// Define constants for field IDs // Define constants for field IDs
const FIELD_IDS = { const FIELD_IDS = {
WEBHOOK: 'webhook', WEBHOOK: "webhook",
TOKEN: 'token', TOKEN: "token",
CHAT_ID: 'chatId', CHAT_ID: "chatId",
URL: 'url' URL: "url",
}; };
/** /**
@@ -39,54 +39,58 @@ const useNotifications = () => {
// Validation based on notification type // Validation based on notification type
let payload = { platform: type }; let payload = { platform: type };
let isValid = true; let isValid = true;
let errorMessage = ''; let errorMessage = "";
switch (type) { switch (type) {
case NOTIFICATION_TYPES.SLACK: case NOTIFICATION_TYPES.SLACK:
payload.webhookUrl = config.webhook; payload.webhookUrl = config.webhook;
if (typeof payload.webhookUrl === 'undefined' || payload.webhookUrl === '') { if (typeof payload.webhookUrl === "undefined" || payload.webhookUrl === "") {
isValid = false; isValid = false;
errorMessage = t('notifications.slack.webhookRequired'); errorMessage = t("notifications.slack.webhookRequired");
} }
break; break;
case NOTIFICATION_TYPES.DISCORD: case NOTIFICATION_TYPES.DISCORD:
payload.webhookUrl = config.webhook; payload.webhookUrl = config.webhook;
if (typeof payload.webhookUrl === 'undefined' || payload.webhookUrl === '') { if (typeof payload.webhookUrl === "undefined" || payload.webhookUrl === "") {
isValid = false; isValid = false;
errorMessage = t('notifications.discord.webhookRequired'); errorMessage = t("notifications.discord.webhookRequired");
} }
break; break;
case NOTIFICATION_TYPES.TELEGRAM: case NOTIFICATION_TYPES.TELEGRAM:
payload.botToken = config.token; payload.botToken = config.token;
payload.chatId = config.chatId; payload.chatId = config.chatId;
if (typeof payload.botToken === 'undefined' || payload.botToken === '' || if (
typeof payload.chatId === 'undefined' || payload.chatId === '') { typeof payload.botToken === "undefined" ||
payload.botToken === "" ||
typeof payload.chatId === "undefined" ||
payload.chatId === ""
) {
isValid = false; isValid = false;
errorMessage = t('notifications.telegram.fieldsRequired'); errorMessage = t("notifications.telegram.fieldsRequired");
} }
break; break;
case NOTIFICATION_TYPES.WEBHOOK: case NOTIFICATION_TYPES.WEBHOOK:
payload.webhookUrl = config.url; payload.webhookUrl = config.url;
payload.platform = NOTIFICATION_TYPES.SLACK; payload.platform = NOTIFICATION_TYPES.SLACK;
if (typeof payload.webhookUrl === 'undefined' || payload.webhookUrl === '') { if (typeof payload.webhookUrl === "undefined" || payload.webhookUrl === "") {
isValid = false; isValid = false;
errorMessage = t('notifications.webhook.urlRequired'); errorMessage = t("notifications.webhook.urlRequired");
} }
break; break;
default: default:
isValid = false; isValid = false;
errorMessage = t('notifications.unsupportedType'); errorMessage = t("notifications.unsupportedType");
} }
// If validation fails, show error and return // If validation fails, show error and return
if (isValid === false) { if (isValid === false) {
createToast({ createToast({
body: errorMessage, body: errorMessage,
variant: "error" variant: "error",
}); });
setLoading(false); setLoading(false);
return; return;
@@ -95,22 +99,23 @@ const useNotifications = () => {
try { try {
const response = await networkService.testNotification({ const response = await networkService.testNotification({
platform: type, platform: type,
payload: payload payload: payload,
}); });
if (response.data.success === true) { if (response.data.success === true) {
createToast({ createToast({
body: t('notifications.testSuccess'), body: t("notifications.testSuccess"),
variant: "info" variant: "info",
}); });
} else { } else {
throw new Error(response.data.msg || t('notifications.testFailed')); throw new Error(response.data.msg || t("notifications.testFailed"));
} }
} catch (error) { } catch (error) {
const errorMsg = error.response?.data?.msg || error.message || t('notifications.networkError'); const errorMsg =
error.response?.data?.msg || error.message || t("notifications.networkError");
createToast({ createToast({
body: `${t('notifications.testFailed')}: ${errorMsg}`, body: `${t("notifications.testFailed")}: ${errorMsg}`,
variant: "error" variant: "error",
}); });
setError(errorMsg); setError(errorMsg);
} finally { } finally {
@@ -118,11 +123,7 @@ const useNotifications = () => {
} }
}; };
return [ return [loading, error, sendTestNotification];
loading,
error,
sendTestNotification
];
}; };
export default useNotifications; export default useNotifications;
+1 -1
View File
@@ -93,7 +93,7 @@ const ProgressUpload = ({ icon, label, size, progress = 0, onClick, error }) =>
<Typography <Typography
component="h2" component="h2"
mb={theme.spacing(1.5)} mb={theme.spacing(1.5)}
sx={{ wordBreak: 'break-all' }} sx={{ wordBreak: "break-all" }}
> >
{error ? error : label} {error ? error : label}
</Typography> </Typography>
+11 -7
View File
@@ -170,8 +170,8 @@ function Sidebar() {
<MenuItem <MenuItem
key={item.name} key={item.name}
onClick={() => { onClick={() => {
closePopup() closePopup();
navigate(item.path) navigate(item.path);
}} }}
sx={{ sx={{
gap: theme.spacing(2), gap: theme.spacing(2),
@@ -732,11 +732,15 @@ function Sidebar() {
{authState.user?.firstName} {authState.user?.lastName} {authState.user?.firstName} {authState.user?.lastName}
</Typography> </Typography>
<Typography sx={{ textTransform: "capitalize" }}> <Typography sx={{ textTransform: "capitalize" }}>
{authState.user?.role?.includes("superadmin") ? t("roles.superAdmin") : {authState.user?.role?.includes("superadmin")
authState.user?.role?.includes("admin") ? t("roles.admin") : ? t("roles.superAdmin")
authState.user?.role?.includes("user") ? t("roles.teamMember") : : authState.user?.role?.includes("admin")
authState.user?.role?.includes("demo") ? t("roles.demoUser") : ? t("roles.admin")
authState.user?.role} : authState.user?.role?.includes("user")
? t("roles.teamMember")
: authState.user?.role?.includes("demo")
? t("roles.demoUser")
: authState.user?.role}
</Typography> </Typography>
</Box> </Box>
<Stack <Stack
+37 -30
View File
@@ -1,14 +1,12 @@
import React from 'react'; import React from "react";
import { Typography, IconButton, Stack, Box } from '@mui/material'; import { Typography, IconButton, Stack, Box } from "@mui/material";
import CloseIcon from '@mui/icons-material/Close'; import CloseIcon from "@mui/icons-material/Close";
import { useTheme } from '@emotion/react'; import { useTheme } from "@emotion/react";
import { useSelector, useDispatch } from 'react-redux'; import { useSelector, useDispatch } from "react-redux";
import { useTranslation } from 'react-i18next'; import { useTranslation } from "react-i18next";
import { setStarPromptOpen } from '../../Features/UI/uiSlice'; import { setStarPromptOpen } from "../../Features/UI/uiSlice";
const StarPrompt = ({ const StarPrompt = ({ repoUrl = "https://github.com/bluewave-labs/checkmate" }) => {
repoUrl = 'https://github.com/bluewave-labs/checkmate'
}) => {
const theme = useTheme(); const theme = useTheme();
const dispatch = useDispatch(); const dispatch = useDispatch();
const { t } = useTranslation(); const { t } = useTranslation();
@@ -20,7 +18,7 @@ const StarPrompt = ({
}; };
const handleStarClick = () => { const handleStarClick = () => {
window.open(repoUrl, '_blank'); window.open(repoUrl, "_blank");
}; };
if (!isOpen) return null; if (!isOpen) return null;
@@ -29,7 +27,7 @@ const StarPrompt = ({
<Stack <Stack
direction="column" direction="column"
sx={{ sx={{
width: '100%', width: "100%",
padding: `${theme.spacing(6)} ${theme.spacing(6)}`, padding: `${theme.spacing(6)} ${theme.spacing(6)}`,
borderTop: `1px solid ${theme.palette.primary.lowContrast}`, borderTop: `1px solid ${theme.palette.primary.lowContrast}`,
borderBottom: `1px solid ${theme.palette.primary.lowContrast}`, borderBottom: `1px solid ${theme.palette.primary.lowContrast}`,
@@ -38,15 +36,24 @@ const StarPrompt = ({
backgroundColor: theme.palette.primary.main, backgroundColor: theme.palette.primary.main,
}} }}
> >
<Stack direction="row" justifyContent="space-between" alignItems="center" width="100%" pl={theme.spacing(4)}> <Stack
direction="row"
justifyContent="space-between"
alignItems="center"
width="100%"
pl={theme.spacing(4)}
>
<Typography <Typography
variant="subtitle2" variant="subtitle2"
sx={{ sx={{
color: mode === 'dark' ? theme.palette.primary.contrastText : theme.palette.text.primary, color:
mt: theme.spacing(3) mode === "dark"
? theme.palette.primary.contrastText
: theme.palette.text.primary,
mt: theme.spacing(3),
}} }}
> >
{t('starPromptTitle')} {t("starPromptTitle")}
</Typography> </Typography>
<IconButton <IconButton
onClick={handleClose} onClick={handleClose}
@@ -55,13 +62,13 @@ const StarPrompt = ({
color: theme.palette.text.primary, color: theme.palette.text.primary,
padding: 0, padding: 0,
marginTop: theme.spacing(-5), marginTop: theme.spacing(-5),
'&:hover': { "&:hover": {
backgroundColor: 'transparent', backgroundColor: "transparent",
opacity: 0.8 opacity: 0.8,
}, },
}} }}
> >
<CloseIcon sx={{ fontSize: '1.25rem' }} /> <CloseIcon sx={{ fontSize: "1.25rem" }} />
</IconButton> </IconButton>
</Stack> </Stack>
@@ -69,29 +76,29 @@ const StarPrompt = ({
variant="body1" variant="body1"
sx={{ sx={{
color: theme.palette.text.secondary, color: theme.palette.text.secondary,
fontSize: '0.938rem', fontSize: "0.938rem",
lineHeight: 1.5, lineHeight: 1.5,
mb: 1, mb: 1,
px: theme.spacing(4) px: theme.spacing(4),
}} }}
> >
{t('starPromptDescription')} {t("starPromptDescription")}
</Typography> </Typography>
<Box <Box
component="img" component="img"
src={`https://img.shields.io/github/stars/bluewave-labs/checkmate?label=checkmate&style=social${mode === 'dark' ? '&color=white' : ''}`} src={`https://img.shields.io/github/stars/bluewave-labs/checkmate?label=checkmate&style=social${mode === "dark" ? "&color=white" : ""}`}
alt="GitHub stars" alt="GitHub stars"
onClick={handleStarClick} onClick={handleStarClick}
sx={{ sx={{
cursor: 'pointer', cursor: "pointer",
transform: 'scale(0.65)', transform: "scale(0.65)",
transformOrigin: 'left center', transformOrigin: "left center",
'&:hover': { "&:hover": {
opacity: 0.8 opacity: 0.8,
}, },
pl: theme.spacing(4), pl: theme.spacing(4),
filter: mode === 'dark' ? 'invert(1)' : 'none' filter: mode === "dark" ? "invert(1)" : "none",
}} }}
/> />
</Stack> </Stack>
+5 -1
View File
@@ -20,7 +20,11 @@ const CustomTabList = ({ value, onChange, children, ...props }) => {
"& .MuiTabs-root": { height: "fit-content", minHeight: "0" }, "& .MuiTabs-root": { height: "fit-content", minHeight: "0" },
}} }}
> >
<TabList value={value} onChange={onChange} {...props}> <TabList
value={value}
onChange={onChange}
{...props}
>
{children} {children}
</TabList> </TabList>
</Box> </Box>
@@ -94,7 +94,10 @@ const PasswordPanel = () => {
const action = await dispatch(update({ localData })); const action = await dispatch(update({ localData }));
if (action.payload.success) { if (action.payload.success) {
createToast({ createToast({
body: t("passwordPanel.passwordChangedSuccess", "Your password was changed successfully."), body: t(
"passwordPanel.passwordChangedSuccess",
"Your password was changed successfully."
),
}); });
setLocalData({ setLocalData({
password: "", password: "",
@@ -104,7 +107,10 @@ const PasswordPanel = () => {
} else { } else {
// TODO: Check for other errors? // TODO: Check for other errors?
createToast({ createToast({
body: t("passwordPanel.passwordInputIncorrect", "Your password input was incorrect."), body: t(
"passwordPanel.passwordInputIncorrect",
"Your password input was incorrect."
),
}); });
setErrors({ password: "*" + action.payload.msg + "." }); setErrors({ password: "*" + action.payload.msg + "." });
} }
@@ -153,7 +159,10 @@ const PasswordPanel = () => {
<TextInput <TextInput
type="password" type="password"
id="edit-current-password" id="edit-current-password"
placeholder={t("passwordPanel.enterCurrentPassword", "Enter your current password")} placeholder={t(
"passwordPanel.enterCurrentPassword",
"Enter your current password"
)}
autoComplete="current-password" autoComplete="current-password"
value={localData.password} value={localData.password}
onChange={handleChange} onChange={handleChange}
@@ -219,7 +228,10 @@ const PasswordPanel = () => {
<Box sx={{ maxWidth: "70ch" }}> <Box sx={{ maxWidth: "70ch" }}>
<Alert <Alert
variant="warning" variant="warning"
body={t("passwordPanel.passwordRequirements", "New password must contain at least 8 characters and must have at least one uppercase letter, one lowercase letter, one number and one special character.")} body={t(
"passwordPanel.passwordRequirements",
"New password must contain at least 8 characters and must have at least one uppercase letter, one lowercase letter, one number and one special character."
)}
/> />
</Box> </Box>
)} )}
@@ -121,8 +121,7 @@ const ProfilePanel = () => {
const handleSaveProfile = async (event) => { const handleSaveProfile = async (event) => {
event.preventDefault(); event.preventDefault();
const nameChanged = const nameChanged =
localData.firstName !== user.firstName || localData.firstName !== user.firstName || localData.lastName !== user.lastName;
localData.lastName !== user.lastName;
const avatarChanged = const avatarChanged =
localData.deleteProfileImage === true || localData.deleteProfileImage === true ||
@@ -205,7 +204,7 @@ const ProfilePanel = () => {
> >
{/* This 0.9 is a bit magic numbering, refactor */} {/* This 0.9 is a bit magic numbering, refactor */}
<Box flex={0.9}> <Box flex={0.9}>
<Typography component="h1">{t('FirstName')}</Typography> <Typography component="h1">{t("FirstName")}</Typography>
</Box> </Box>
<TextInput <TextInput
id="edit-first-name" id="edit-first-name"
@@ -223,7 +222,7 @@ const ProfilePanel = () => {
gap={SPACING_GAP} gap={SPACING_GAP}
> >
<Box flex={0.9}> <Box flex={0.9}>
<Typography component="h1">{t('LastName')}</Typography> <Typography component="h1">{t("LastName")}</Typography>
</Box> </Box>
<TextInput <TextInput
id="edit-last-name" id="edit-last-name"
@@ -241,12 +240,12 @@ const ProfilePanel = () => {
gap={SPACING_GAP} gap={SPACING_GAP}
> >
<Stack flex={0.9}> <Stack flex={0.9}>
<Typography component="h1">{t('email')}</Typography> <Typography component="h1">{t("email")}</Typography>
<Typography <Typography
component="p" component="p"
sx={{ opacity: 0.6 }} sx={{ opacity: 0.6 }}
> >
{t('EmailDescriptionText')} {t("EmailDescriptionText")}
</Typography> </Typography>
</Stack> </Stack>
<TextInput <TextInput
@@ -264,12 +263,12 @@ const ProfilePanel = () => {
gap={SPACING_GAP} gap={SPACING_GAP}
> >
<Stack flex={0.9}> <Stack flex={0.9}>
<Typography component="h1">{t('YourPhoto')}</Typography> <Typography component="h1">{t("YourPhoto")}</Typography>
<Typography <Typography
component="p" component="p"
sx={{ opacity: 0.6 }} sx={{ opacity: 0.6 }}
> >
{t('PhotoDescriptionText')} {t("PhotoDescriptionText")}
</Typography> </Typography>
</Stack> </Stack>
<Stack <Stack
@@ -293,14 +292,14 @@ const ProfilePanel = () => {
color="error" color="error"
onClick={handleDeletePicture} onClick={handleDeletePicture}
> >
{t('delete')} {t("delete")}
</Button> </Button>
<Button <Button
variant="contained" // CAIO_REVIEW variant="contained" // CAIO_REVIEW
color="accent" color="accent"
onClick={openPictureModal} onClick={openPictureModal}
> >
{t('update')} {t("update")}
</Button> </Button>
</Stack> </Stack>
</Stack> </Stack>
@@ -325,7 +324,7 @@ const ProfilePanel = () => {
disabled={Object.keys(errors).length !== 0 && !errors?.picture && true} disabled={Object.keys(errors).length !== 0 && !errors?.picture && true}
sx={{ px: theme.spacing(12) }} sx={{ px: theme.spacing(12) }}
> >
{t('save')} {t("save")}
</Button> </Button>
</Box> </Box>
</Stack> </Stack>
@@ -344,12 +343,12 @@ const ProfilePanel = () => {
spellCheck="false" spellCheck="false"
> >
<Box mb={theme.spacing(6)}> <Box mb={theme.spacing(6)}>
<Typography component="h1">{t('DeleteAccountTitle')}</Typography> <Typography component="h1">{t("DeleteAccountTitle")}</Typography>
<Typography <Typography
component="p" component="p"
sx={{ opacity: 0.6 }} sx={{ opacity: 0.6 }}
> >
{t('DeleteDescriptionText')} {t("DeleteDescriptionText")}
</Typography> </Typography>
</Box> </Box>
<Button <Button
@@ -357,17 +356,17 @@ const ProfilePanel = () => {
color="error" color="error"
onClick={() => setIsOpen("delete")} onClick={() => setIsOpen("delete")}
> >
{t('DeleteAccountButton')} {t("DeleteAccountButton")}
</Button> </Button>
</Box> </Box>
)} )}
<Dialog <Dialog
open={isModalOpen("delete")} open={isModalOpen("delete")}
theme={theme} theme={theme}
title={t('DeleteWarningTitle')} title={t("DeleteWarningTitle")}
description={t('DeleteAccountWarning')} description={t("DeleteAccountWarning")}
onCancel={() => setIsOpen("")} onCancel={() => setIsOpen("")}
confirmationButtonLabel={t('DeleteAccountButton')} confirmationButtonLabel={t("DeleteAccountButton")}
onConfirm={handleDeleteAccount} onConfirm={handleDeleteAccount}
isLoading={isLoading} isLoading={isLoading}
/> />
@@ -410,7 +409,7 @@ const ProfilePanel = () => {
color="info" color="info"
onClick={removePicture} onClick={removePicture}
> >
{t('remove')} {t("remove")}
</Button> </Button>
<Button <Button
variant="contained" variant="contained"
@@ -418,7 +417,7 @@ const ProfilePanel = () => {
onClick={handleUpdatePicture} onClick={handleUpdatePicture}
disabled={!!errors.picture || !file?.src} disabled={!!errors.picture || !file?.src}
> >
{t('update')} {t("update")}
</Button> </Button>
</Stack> </Stack>
</GenericDialog> </GenericDialog>
@@ -48,7 +48,8 @@ const TeamPanel = () => {
{row.firstName + " " + row.lastName} {row.firstName + " " + row.lastName}
</Typography> </Typography>
<Typography> <Typography>
{t("teamPanel.table.created")} {new Date(row.createdAt).toLocaleDateString()} {t("teamPanel.table.created")}{" "}
{new Date(row.createdAt).toLocaleDateString()}
</Typography> </Typography>
</Stack> </Stack>
); );
@@ -16,7 +16,10 @@
font-size: var(--env-var-font-size-medium-plus) !important; font-size: var(--env-var-font-size-medium-plus) !important;
font-weight: 500 !important; font-weight: 500 !important;
margin: 0; margin: 0;
padding: calc((var(--env-var-height-2) - var(--env-var-font-size-medium-plus) * 1.2) / 2) var(--env-var-spacing-1); padding: calc(
(var(--env-var-height-2) - var(--env-var-font-size-medium-plus) * 1.2) / 2
)
var(--env-var-spacing-1);
white-space: nowrap; white-space: nowrap;
} }
@@ -36,7 +39,6 @@
font-size: var(--env-var-font-size-medium) !important; font-size: var(--env-var-font-size-medium) !important;
padding: calc((var(--env-var-height-2) - var(--env-var-font-size-medium) * 1.2) / 2) padding: calc((var(--env-var-height-2) - var(--env-var-font-size-medium) * 1.2) / 2)
var(--env-var-spacing-1-minus) !important; var(--env-var-spacing-1-minus) !important;
} }
} }
-1
View File
@@ -2,7 +2,6 @@ import { useCallback } from "react";
import { useTheme } from "@mui/material"; import { useTheme } from "@mui/material";
const useMonitorUtils = () => { const useMonitorUtils = () => {
const getMonitorWithPercentage = useCallback((monitor, theme) => { const getMonitorWithPercentage = useCallback((monitor, theme) => {
let uptimePercentage = ""; let uptimePercentage = "";
let percentageColor = ""; let percentageColor = "";
+13 -7
View File
@@ -22,7 +22,7 @@ const useSendTestEmail = () => {
// Send the test email with or without configuration // Send the test email with or without configuration
const response = await networkService.sendTestEmail({ const response = await networkService.sendTestEmail({
to: user.email, to: user.email,
emailConfig emailConfig,
}); });
if (typeof response?.data?.data?.messageId !== "undefined") { if (typeof response?.data?.data?.messageId !== "undefined") {
@@ -30,8 +30,10 @@ const useSendTestEmail = () => {
body: t("settingsTestEmailSuccess", "Test email sent successfully"), body: t("settingsTestEmailSuccess", "Test email sent successfully"),
}); });
} else { } else {
throw new Error(response?.data?.error || t("settingsTestEmailFailed", "Failed to send test email")); throw new Error(
response?.data?.error ||
t("settingsTestEmailFailed", "Failed to send test email")
);
} }
} catch (error) { } catch (error) {
createToast({ createToast({
@@ -39,10 +41,14 @@ const useSendTestEmail = () => {
}); });
setError(error); setError(error);
createToast({ createToast({
body: t("settingsTestEmailFailedWithReason", "Failed to send test email: {{reason}}", { body: t(
reason: error.message || t("settingsTestEmailUnknownError", "Unknown error") "settingsTestEmailFailedWithReason",
}), "Failed to send test email: {{reason}}",
variant: "error" {
reason: error.message || t("settingsTestEmailUnknownError", "Unknown error"),
}
),
variant: "error",
}); });
} finally { } finally {
setIsSending(false); setIsSending(false);
+3 -3
View File
@@ -1,6 +1,6 @@
import React from 'react'; import React from "react";
import AppBar from '../../Components/Common/AppBar'; import AppBar from "../../Components/Common/AppBar";
import Footer from '../../Components/Common/Footer'; import Footer from "../../Components/Common/Footer";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
const AboutUs = () => { const AboutUs = () => {
+8 -6
View File
@@ -31,21 +31,19 @@ const Account = ({ open = "profile" }) => {
let tabList = [ let tabList = [
{ name: t("menu.profile"), value: "profile" }, { name: t("menu.profile"), value: "profile" },
{ name: t("menu.password"), value: "password" }, { name: t("menu.password"), value: "password" },
{ name: t("menu.team"), value: "team" } { name: t("menu.team"), value: "team" },
]; ];
const hideTeams = !requiredRoles.some((role) => user.role.includes(role)); const hideTeams = !requiredRoles.some((role) => user.role.includes(role));
if (hideTeams) { if (hideTeams) {
tabList = [ tabList = [
{ name: t("menu.profile"), value: "profile" }, { name: t("menu.profile"), value: "profile" },
{ name: t("menu.password"), value: "password" } { name: t("menu.password"), value: "password" },
]; ];
} }
// Remove password for demo // Remove password for demo
if (user.role.includes("demo")) { if (user.role.includes("demo")) {
tabList = [ tabList = [{ name: t("menu.profile"), value: "profile" }];
{ name: t("menu.profile"), value: "profile" }
];
} }
const handleKeyDown = (event) => { const handleKeyDown = (event) => {
@@ -70,7 +68,11 @@ const Account = ({ open = "profile" }) => {
py={theme.spacing(12)} py={theme.spacing(12)}
> >
<TabContext value={tab}> <TabContext value={tab}>
<CustomTabList value={tab} onChange={handleTabChange} aria-label="account tabs"> <CustomTabList
value={tab}
onChange={handleTabChange}
aria-label="account tabs"
>
{tabList.map((item, index) => ( {tabList.map((item, index) => (
<Tab <Tab
label={item.name} label={item.name}
@@ -75,11 +75,11 @@ const EmailStep = ({ form, errors, onSubmit, onChange }) => {
width: "30%", width: "30%",
px: theme.spacing(6), px: theme.spacing(6),
borderRadius: `${theme.shape.borderRadius}px !important`, borderRadius: `${theme.shape.borderRadius}px !important`,
'&.MuiButtonBase-root': { "&.MuiButtonBase-root": {
borderRadius: `${theme.shape.borderRadius}px !important` borderRadius: `${theme.shape.borderRadius}px !important`,
}, },
'&.MuiButton-root': { "&.MuiButton-root": {
borderRadius: `${theme.shape.borderRadius}px !important` borderRadius: `${theme.shape.borderRadius}px !important`,
}, },
"&.Mui-focusVisible": { "&.Mui-focusVisible": {
outline: `2px solid ${theme.palette.primary.main}`, outline: `2px solid ${theme.palette.primary.main}`,
@@ -79,11 +79,11 @@ const PasswordStep = ({ form, errors, onSubmit, onChange, onBack }) => {
sx={{ sx={{
px: theme.spacing(5), px: theme.spacing(5),
borderRadius: `${theme.shape.borderRadius}px !important`, borderRadius: `${theme.shape.borderRadius}px !important`,
'&.MuiButtonBase-root': { "&.MuiButtonBase-root": {
borderRadius: `${theme.shape.borderRadius}px !important` borderRadius: `${theme.shape.borderRadius}px !important`,
}, },
'&.MuiButton-root': { "&.MuiButton-root": {
borderRadius: `${theme.shape.borderRadius}px !important` borderRadius: `${theme.shape.borderRadius}px !important`,
}, },
"& svg.MuiSvgIcon-root": { "& svg.MuiSvgIcon-root": {
mr: theme.spacing(3), mr: theme.spacing(3),
@@ -108,11 +108,11 @@ const PasswordStep = ({ form, errors, onSubmit, onChange, onBack }) => {
width: "30%", width: "30%",
px: theme.spacing(4), px: theme.spacing(4),
borderRadius: `${theme.shape.borderRadius}px !important`, borderRadius: `${theme.shape.borderRadius}px !important`,
'&.MuiButtonBase-root': { "&.MuiButtonBase-root": {
borderRadius: `${theme.shape.borderRadius}px !important` borderRadius: `${theme.shape.borderRadius}px !important`,
}, },
'&.MuiButton-root': { "&.MuiButton-root": {
borderRadius: `${theme.shape.borderRadius}px !important` borderRadius: `${theme.shape.borderRadius}px !important`,
}, },
"&.Mui-focusVisible": { "&.Mui-focusVisible": {
outline: `2px solid ${theme.palette.primary.main}`, outline: `2px solid ${theme.palette.primary.main}`,
+10 -8
View File
@@ -43,8 +43,6 @@ const Login = () => {
const [errors, setErrors] = useState({}); const [errors, setErrors] = useState({});
const [step, setStep] = useState(0); const [step, setStep] = useState(0);
useEffect(() => { useEffect(() => {
if (authToken) { if (authToken) {
navigate("/uptime"); navigate("/uptime");
@@ -84,7 +82,9 @@ const Login = () => {
); );
if (error) { if (error) {
const errorMessage = error.details[0].message; const errorMessage = error.details[0].message;
const translatedMessage = errorMessage.startsWith('auth') ? t(errorMessage) : errorMessage; const translatedMessage = errorMessage.startsWith("auth")
? t(errorMessage)
: errorMessage;
setErrors((prev) => ({ ...prev, email: translatedMessage })); setErrors((prev) => ({ ...prev, email: translatedMessage }));
createToast({ body: translatedMessage }); createToast({ body: translatedMessage });
} else { } else {
@@ -103,7 +103,9 @@ const Login = () => {
createToast({ createToast({
body: body:
error.details && error.details.length > 0 error.details && error.details.length > 0
? (error.details[0].message.startsWith('auth') ? t(error.details[0].message) : error.details[0].message) ? error.details[0].message.startsWith("auth")
? t(error.details[0].message)
: error.details[0].message
: t("Error validating data."), : t("Error validating data."),
}); });
} else { } else {
@@ -242,10 +244,10 @@ const Login = () => {
color={theme.palette.accent.main} color={theme.palette.accent.main}
ml={theme.spacing(2)} ml={theme.spacing(2)}
sx={{ sx={{
cursor: 'pointer', cursor: "pointer",
'&:hover': { "&:hover": {
color: theme.palette.accent.darker color: theme.palette.accent.darker,
} },
}} }}
onClick={() => navigate("/register")} onClick={() => navigate("/register")}
> >
@@ -100,9 +100,7 @@ const NewPasswordConfirmed = () => {
</IconBox> </IconBox>
</Stack> </Stack>
<Typography component="h1">{t("passwordreset")}</Typography> <Typography component="h1">{t("passwordreset")}</Typography>
<Typography mb={theme.spacing(2)}> <Typography mb={theme.spacing(2)}>{t("authNewPasswordConfirmed")}</Typography>
{t("authNewPasswordConfirmed")}
</Typography>
</Box> </Box>
<Button <Button
variant="contained" variant="contained"
+1 -1
View File
@@ -105,7 +105,7 @@ const LandingPage = ({ isSuperAdmin, onSignup }) => {
); );
}} }}
/> />
) ),
}} }}
/> />
</Typography> </Typography>
@@ -68,11 +68,14 @@ function StepTwo({ form, errors, onSubmit, onChange, onBack }) {
onInput={(e) => (e.target.value = e.target.value.toLowerCase())} onInput={(e) => (e.target.value = e.target.value.toLowerCase())}
onChange={onChange} onChange={onChange}
error={errors.email ? true : false} error={errors.email ? true : false}
helperText={errors.email && ( helperText={
errors.email.includes("required") ? t("authRegisterEmailRequired") : errors.email &&
errors.email.includes("valid email") ? t("authRegisterEmailInvalid") : (errors.email.includes("required")
t(errors.email) ? t("authRegisterEmailRequired")
)} : errors.email.includes("valid email")
? t("authRegisterEmailInvalid")
: t(errors.email))
}
ref={inputRef} ref={inputRef}
/> />
<Stack <Stack
@@ -199,9 +199,7 @@ const CreateDistributedUptime = () => {
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2">{t("settingsGeneralSettings")}</Typography> <Typography component="h2">{t("settingsGeneralSettings")}</Typography>
<Typography component="p"> <Typography component="p">{t("distributedUptimeCreateSelectURL")}</Typography>
{t("distributedUptimeCreateSelectURL")}
</Typography>
</Box> </Box>
<Stack gap={theme.spacing(15)}> <Stack gap={theme.spacing(15)}>
<TextInput <TextInput
@@ -293,7 +291,9 @@ const CreateDistributedUptime = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2">{t("distributedUptimeCreateIncidentNotification")}</Typography> <Typography component="h2">
{t("distributedUptimeCreateIncidentNotification")}
</Typography>
<Typography component="p"> <Typography component="p">
{t("distributedUptimeCreateIncidentDescription")} {t("distributedUptimeCreateIncidentDescription")}
</Typography> </Typography>
@@ -312,7 +312,9 @@ const CreateDistributedUptime = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2">{t("distributedUptimeCreateAdvancedSettings")}</Typography> <Typography component="h2">
{t("distributedUptimeCreateAdvancedSettings")}
</Typography>
</Box> </Box>
<Stack gap={theme.spacing(12)}> <Stack gap={theme.spacing(12)}>
<Select <Select
@@ -76,7 +76,9 @@ const DeviceTicker = ({ data, width = "100%", connectionStatus }) => {
<Typography>{city}</Typography> <Typography>{city}</Typography>
</td> </td>
<td style={{ textAlign: "right", paddingLeft: theme.spacing(4) }}> <td style={{ textAlign: "right", paddingLeft: theme.spacing(4) }}>
<Typography>{Math.floor(dataPoint.responseTime)} {t("ms")}</Typography> <Typography>
{Math.floor(dataPoint.responseTime)} {t("ms")}
</Typography>
</td> </td>
<td style={{ textAlign: "right", paddingLeft: theme.spacing(4) }}> <td style={{ textAlign: "right", paddingLeft: theme.spacing(4) }}>
<Typography color={theme.palette.warning.main}> <Typography color={theme.palette.warning.main}>
@@ -10,9 +10,7 @@ const MonitorHeader = ({ monitor }) => {
<Stack direction="row"> <Stack direction="row">
<Stack gap={theme.spacing(2)}> <Stack gap={theme.spacing(2)}>
<Typography variant="h1">{monitor.name}</Typography> <Typography variant="h1">{monitor.name}</Typography>
<Typography variant="h2"> <Typography variant="h2">{t("distributedUptimeDetailsMonitorHeader")}</Typography>
{t("distributedUptimeDetailsMonitorHeader")}
</Typography>
</Stack> </Stack>
</Stack> </Stack>
); );
@@ -2,7 +2,14 @@ import { useState, useEffect } from "react";
import { networkService } from "../../../main"; import { networkService } from "../../../main";
import { createToast } from "../../../Utils/toastUtils"; import { createToast } from "../../../Utils/toastUtils";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
const useChecksFetch = ({ selectedMonitor, selectedMonitorType, filter, dateRange, page, rowsPerPage }) => { const useChecksFetch = ({
selectedMonitor,
selectedMonitorType,
filter,
dateRange,
page,
rowsPerPage,
}) => {
//Redux //Redux
const { user } = useSelector((state) => state.auth); const { user } = useSelector((state) => state.auth);
@@ -30,7 +30,7 @@ const useMonitorsFetch = ({ teamId }) => {
acc[monitor._id] = { acc[monitor._id] = {
_id: monitor._id, _id: monitor._id,
name: monitor.name, name: monitor.name,
type: monitor.type type: monitor.type,
}; };
return acc; return acc;
}, {}); }, {});
+3 -1
View File
@@ -19,7 +19,9 @@ const Incidents = () => {
const { user } = useSelector((state) => state.auth); const { user } = useSelector((state) => state.auth);
const { t } = useTranslation(); const { t } = useTranslation();
const BREADCRUMBS = [{ name: t("incidentsPageTitle", "Incidents"), path: "/incidents" }]; const BREADCRUMBS = [
{ name: t("incidentsPageTitle", "Incidents"), path: "/incidents" },
];
// Local state // Local state
const [selectedMonitor, setSelectedMonitor] = useState("0"); const [selectedMonitor, setSelectedMonitor] = useState("0");
@@ -6,7 +6,10 @@ import { useSelector, useDispatch } from "react-redux";
// Utility and Network // Utility and Network
import { infrastructureMonitorValidation } from "../../../Validation/validation"; import { infrastructureMonitorValidation } from "../../../Validation/validation";
import { createInfrastructureMonitor, updateInfrastructureMonitor } from "../../../Features/InfrastructureMonitors/infrastructureMonitorsSlice"; import {
createInfrastructureMonitor,
updateInfrastructureMonitor,
} from "../../../Features/InfrastructureMonitors/infrastructureMonitorsSlice";
import { useHardwareMonitorsFetch } from "../Details/Hooks/useHardwareMonitorsFetch"; import { useHardwareMonitorsFetch } from "../Details/Hooks/useHardwareMonitorsFetch";
import { capitalizeFirstLetter } from "../../../Utils/stringUtils"; import { capitalizeFirstLetter } from "../../../Utils/stringUtils";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@@ -90,20 +93,26 @@ const CreateInfrastructureMonitor = () => {
setInfrastructureMonitor({ setInfrastructureMonitor({
url: monitor.url.replace(/^https?:\/\//, ""), url: monitor.url.replace(/^https?:\/\//, ""),
name: monitor.name || "", name: monitor.name || "",
notifications: monitor.notifications?.filter(n => typeof n === "object") || [], notifications: monitor.notifications?.filter((n) => typeof n === "object") || [],
notify_email: (monitor.notifications?.length ?? 0) > 0, notify_email: (monitor.notifications?.length ?? 0) > 0,
interval: monitor.interval / MS_PER_MINUTE, interval: monitor.interval / MS_PER_MINUTE,
cpu: monitor.thresholds?.usage_cpu !== undefined, cpu: monitor.thresholds?.usage_cpu !== undefined,
usage_cpu: monitor.thresholds?.usage_cpu ? monitor.thresholds.usage_cpu * 100 : "", usage_cpu: monitor.thresholds?.usage_cpu ? monitor.thresholds.usage_cpu * 100 : "",
memory: monitor.thresholds?.usage_memory !== undefined, memory: monitor.thresholds?.usage_memory !== undefined,
usage_memory: monitor.thresholds?.usage_memory ? monitor.thresholds.usage_memory * 100 : "", usage_memory: monitor.thresholds?.usage_memory
? monitor.thresholds.usage_memory * 100
: "",
disk: monitor.thresholds?.usage_disk !== undefined, disk: monitor.thresholds?.usage_disk !== undefined,
usage_disk: monitor.thresholds?.usage_disk ? monitor.thresholds.usage_disk * 100 : "", usage_disk: monitor.thresholds?.usage_disk
? monitor.thresholds.usage_disk * 100
: "",
temperature: monitor.thresholds?.usage_temperature !== undefined, temperature: monitor.thresholds?.usage_temperature !== undefined,
usage_temperature: monitor.thresholds?.usage_temperature ? monitor.thresholds.usage_temperature * 100 : "", usage_temperature: monitor.thresholds?.usage_temperature
? monitor.thresholds.usage_temperature * 100
: "",
secret: monitor.secret || "", secret: monitor.secret || "",
}); });
setHttps(monitor.url.startsWith("https")); setHttps(monitor.url.startsWith("https"));
@@ -199,7 +208,9 @@ const CreateInfrastructureMonitor = () => {
: await dispatch(updateInfrastructureMonitor({ monitorId, monitor: form })); : await dispatch(updateInfrastructureMonitor({ monitorId, monitor: form }));
if (action.meta.requestStatus === "fulfilled") { if (action.meta.requestStatus === "fulfilled") {
createToast({ createToast({
body: isCreate ? t("infrastructureMonitorCreated") : t("infrastructureMonitorUpdated"), body: isCreate
? t("infrastructureMonitorCreated")
: t("infrastructureMonitorUpdated"),
}); });
navigate("/infrastructure"); navigate("/infrastructure");
} else { } else {
@@ -242,17 +253,18 @@ const CreateInfrastructureMonitor = () => {
notifications.push({ type, address: value }); notifications.push({ type, address: value });
} }
} else { } else {
notifications = notifications.filter((n) => !(n.type === type && n.address === value)); notifications = notifications.filter(
(n) => !(n.type === type && n.address === value)
);
} }
setInfrastructureMonitor((prev) => ({ setInfrastructureMonitor((prev) => ({
...prev, ...prev,
notifications, notifications,
...(type === "email" ? { notify_email: checked } : {}) ...(type === "email" ? { notify_email: checked } : {}),
})); }));
}; };
return ( return (
<Box className="create-infrastructure-monitor"> <Box className="create-infrastructure-monitor">
<Breadcrumbs <Breadcrumbs
@@ -260,8 +272,10 @@ const CreateInfrastructureMonitor = () => {
{ name: "Infrastructure monitors", path: "/infrastructure" }, { name: "Infrastructure monitors", path: "/infrastructure" },
...(isCreate ...(isCreate
? [{ name: "Create", path: "/infrastructure/create" }] ? [{ name: "Create", path: "/infrastructure/create" }]
: [{ name: "Details", path: `/infrastructure/${monitorId}` }, { name: "Configure", path: `/infrastructure/configure/${monitorId}` }] : [
), { name: "Details", path: `/infrastructure/${monitorId}` },
{ name: "Configure", path: `/infrastructure/configure/${monitorId}` },
]),
]} ]}
/> />
<Stack <Stack
@@ -294,7 +308,12 @@ const CreateInfrastructureMonitor = () => {
</Typography> </Typography>
<ConfigBox> <ConfigBox>
<Stack gap={theme.spacing(6)}> <Stack gap={theme.spacing(6)}>
<Typography component="h2" variant="h2">{t("settingsGeneralSettings")}</Typography> <Typography
component="h2"
variant="h2"
>
{t("settingsGeneralSettings")}
</Typography>
<Typography component="p"> <Typography component="p">
{t("infrastructureCreateGeneralSettingsDescription")} {t("infrastructureCreateGeneralSettingsDescription")}
</Typography> </Typography>
@@ -368,7 +387,12 @@ const CreateInfrastructureMonitor = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2" variant="h2">{t("distributedUptimeCreateIncidentNotification")}</Typography> <Typography
component="h2"
variant="h2"
>
{t("distributedUptimeCreateIncidentNotification")}
</Typography>
<Typography component="p"> <Typography component="p">
{t("distributedUptimeCreateIncidentDescription")} {t("distributedUptimeCreateIncidentDescription")}
</Typography> </Typography>
@@ -385,7 +409,12 @@ const CreateInfrastructureMonitor = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2" variant="h2">{t("infrastructureCustomizeAlerts")}</Typography> <Typography
component="h2"
variant="h2"
>
{t("infrastructureCustomizeAlerts")}
</Typography>
<Typography component="p"> <Typography component="p">
{t("infrastructureAlertNotificationDescription")} {t("infrastructureAlertNotificationDescription")}
</Typography> </Typography>
@@ -432,7 +461,12 @@ const CreateInfrastructureMonitor = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2" variant="h2">{t("distributedUptimeCreateAdvancedSettings")}</Typography> <Typography
component="h2"
variant="h2"
>
{t("distributedUptimeCreateAdvancedSettings")}
</Typography>
</Box> </Box>
<Stack gap={theme.spacing(12)}> <Stack gap={theme.spacing(12)}>
<Select <Select
@@ -16,8 +16,8 @@ const Gauge = ({ value, heading, metricOne, valueOne, metricTwo, valueTwo }) =>
mb: theme.spacing(2), mb: theme.spacing(2),
mt: theme.spacing(2), mt: theme.spacing(2),
pr: theme.spacing(2), pr: theme.spacing(2),
textAlign: 'right' textAlign: "right",
} };
return ( return (
<BaseContainer> <BaseContainer>
@@ -32,14 +32,19 @@ const Gauge = ({ value, heading, metricOne, valueOne, metricTwo, valueTwo }) =>
flexDirection: "column", flexDirection: "column",
alignItems: "center", alignItems: "center",
width: "100%", width: "100%",
backgroundColor: theme.palette.gradient.color1 backgroundColor: theme.palette.gradient.color1,
}} }}
> >
<CustomGauge <CustomGauge
progress={value} progress={value}
radius={100} radius={100}
/> />
<Typography component="h2" sx={{ fontWeight: 600 }}>{heading}</Typography> <Typography
component="h2"
sx={{ fontWeight: 600 }}
>
{heading}
</Typography>
</Box> </Box>
<Box <Box
sx={{ sx={{
@@ -2,7 +2,6 @@ import { useEffect, useState } from "react";
import { networkService } from "../../../../main"; import { networkService } from "../../../../main";
const useHardwareMonitorsFetch = ({ monitorId, dateRange }) => { const useHardwareMonitorsFetch = ({ monitorId, dateRange }) => {
// Abort early if creating monitor // Abort early if creating monitor
if (!monitorId) { if (!monitorId) {
return { monitor: undefined, isLoading: false, networkError: undefined }; return { monitor: undefined, isLoading: false, networkError: undefined };
+1 -3
View File
@@ -134,9 +134,7 @@ const Integrations = () => {
}} }}
> >
<Typography component="h1">{t("integrations")}</Typography> <Typography component="h1">{t("integrations")}</Typography>
<Typography mb={theme.spacing(12)}> <Typography mb={theme.spacing(12)}>{t("integrationsPrism")}</Typography>
{t("integrationsPrism")}
</Typography>
<Grid <Grid
container container
spacing={theme.spacing(12)} spacing={theme.spacing(12)}
+19 -6
View File
@@ -310,7 +310,12 @@ const PageSpeedConfigure = () => {
</Stack> </Stack>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2" variant="h2">{t("settingsGeneralSettings")}</Typography> <Typography
component="h2"
variant="h2"
>
{t("settingsGeneralSettings")}
</Typography>
<Typography component="p"> <Typography component="p">
{t("pageSpeedConfigureSettingsDescription")} {t("pageSpeedConfigureSettingsDescription")}
</Typography> </Typography>
@@ -349,7 +354,12 @@ const PageSpeedConfigure = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2" variant="h2">{t("distributedUptimeCreateIncidentNotification")}</Typography> <Typography
component="h2"
variant="h2"
>
{t("distributedUptimeCreateIncidentNotification")}
</Typography>
<Typography component="p"> <Typography component="p">
{t("distributedUptimeCreateIncidentDescription")} {t("distributedUptimeCreateIncidentDescription")}
</Typography> </Typography>
@@ -394,9 +404,7 @@ const PageSpeedConfigure = () => {
value="" value=""
onChange={() => logger.warn("disabled")} onChange={() => logger.warn("disabled")}
/> />
<Typography mt={theme.spacing(4)}> <Typography mt={theme.spacing(4)}>{t("seperateEmails")}</Typography>
{t("seperateEmails")}
</Typography>
</Box> </Box>
) : ( ) : (
"" ""
@@ -405,7 +413,12 @@ const PageSpeedConfigure = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2" variant="h2">{t("distributedUptimeCreateAdvancedSettings")}</Typography> <Typography
component="h2"
variant="h2"
>
{t("distributedUptimeCreateAdvancedSettings")}
</Typography>
</Box> </Box>
<Stack gap={theme.spacing(20)}> <Stack gap={theme.spacing(20)}>
<Select <Select
+24 -6
View File
@@ -216,10 +216,13 @@ const CreatePageSpeed = () => {
</Typography> </Typography>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2" variant="h2">{t("settingsGeneralSettings")}</Typography> <Typography
<Typography component="p"> component="h2"
{t("distributedUptimeCreateSelectURL")} variant="h2"
>
{t("settingsGeneralSettings")}
</Typography> </Typography>
<Typography component="p">{t("distributedUptimeCreateSelectURL")}</Typography>
</Box> </Box>
<Stack gap={theme.spacing(15)}> <Stack gap={theme.spacing(15)}>
<TextInput <TextInput
@@ -251,7 +254,12 @@ const CreatePageSpeed = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2" variant="h2">{t("distributedUptimeCreateChecks")}</Typography> <Typography
component="h2"
variant="h2"
>
{t("distributedUptimeCreateChecks")}
</Typography>
<Typography component="p"> <Typography component="p">
{t("distributedUptimeCreateChecksDescription")} {t("distributedUptimeCreateChecksDescription")}
</Typography> </Typography>
@@ -300,7 +308,12 @@ const CreatePageSpeed = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2" variant="h2">{t("distributedUptimeCreateIncidentNotification")}</Typography> <Typography
component="h2"
variant="h2"
>
{t("distributedUptimeCreateIncidentNotification")}
</Typography>
<Typography component="p"> <Typography component="p">
{t("distributedUptimeCreateIncidentDescription")} {t("distributedUptimeCreateIncidentDescription")}
</Typography> </Typography>
@@ -320,7 +333,12 @@ const CreatePageSpeed = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2" variant="h2">{t("distributedUptimeCreateAdvancedSettings")}</Typography> <Typography
component="h2"
variant="h2"
>
{t("distributedUptimeCreateAdvancedSettings")}
</Typography>
</Box> </Box>
<Stack gap={theme.spacing(12)}> <Stack gap={theme.spacing(12)}>
<Select <Select
+27 -19
View File
@@ -24,7 +24,7 @@ const ServerUnreachable = () => {
try { try {
// Try to connect to the backend with a simple API call // Try to connect to the backend with a simple API call
// We'll use any lightweight endpoint that doesn't require authentication // We'll use any lightweight endpoint that doesn't require authentication
await networkService.axiosInstance.get('/health', { timeout: 5000 }); await networkService.axiosInstance.get("/health", { timeout: 5000 });
// If successful, show toast and navigate to login page // If successful, show toast and navigate to login page
createToast({ createToast({
@@ -104,16 +104,21 @@ const ServerUnreachable = () => {
}, },
}} }}
> >
<Stack spacing={theme.spacing(6)} alignItems="center"> <Stack
<Box sx={{ spacing={theme.spacing(6)}
alignItems="center"
>
<Box
sx={{
width: theme.spacing(220), width: theme.spacing(220),
mx: 'auto', mx: "auto",
'& .alert.row-stack': { "& .alert.row-stack": {
width: '100%', width: "100%",
alignItems: 'center', alignItems: "center",
gap: theme.spacing(3) gap: theme.spacing(3),
} },
}}> }}
>
<Alert <Alert
variant="error" variant="error"
body={t("backendUnreachable", "Server Unreachable")} body={t("backendUnreachable", "Server Unreachable")}
@@ -126,7 +131,10 @@ const ServerUnreachable = () => {
align="center" align="center"
color={theme.palette.primary.contrastTextSecondary} color={theme.palette.primary.contrastTextSecondary}
> >
{t("backendUnreachableMessage", "The Checkmate server is not responding. Please check your deployment configuration or try again later.")} {t(
"backendUnreachableMessage",
"The Checkmate server is not responding. Please check your deployment configuration or try again later."
)}
</Typography> </Typography>
</Box> </Box>
<Box sx={{ mt: theme.spacing(4) }}> <Box sx={{ mt: theme.spacing(4) }}>
@@ -139,17 +147,17 @@ const ServerUnreachable = () => {
sx={{ sx={{
px: theme.spacing(6), px: theme.spacing(6),
borderRadius: `${theme.shape.borderRadius}px !important`, borderRadius: `${theme.shape.borderRadius}px !important`,
'&.MuiButtonBase-root': { "&.MuiButtonBase-root": {
borderRadius: `${theme.shape.borderRadius}px !important` borderRadius: `${theme.shape.borderRadius}px !important`,
},
"&.MuiButton-root": {
borderRadius: `${theme.shape.borderRadius}px !important`,
}, },
'&.MuiButton-root': {
borderRadius: `${theme.shape.borderRadius}px !important`
}
}} }}
> >
{isCheckingConnection ? {isCheckingConnection
t("retryingConnection", "Retrying Connection...") : ? t("retryingConnection", "Retrying Connection...")
t("retryConnection", "Retry Connection")} : t("retryConnection", "Retry Connection")}
</Button> </Button>
</Box> </Box>
</Stack> </Stack>
+6 -1
View File
@@ -12,7 +12,12 @@ const SettingsAbout = () => {
return ( return (
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h1" variant="h2">{t("settingsAbout")}</Typography> <Typography
component="h1"
variant="h2"
>
{t("settingsAbout")}
</Typography>
</Box> </Box>
<Box> <Box>
<Typography component="h2">Checkmate {2.1}</Typography> <Typography component="h2">Checkmate {2.1}</Typography>
@@ -23,7 +23,12 @@ const SettingsDemoMonitors = ({ isAdmin, HEADER_SX, handleChange, isLoading }) =
<> <>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h1" variant="h2">{t("settingsDemoMonitors")}</Typography> <Typography
component="h1"
variant="h2"
>
{t("settingsDemoMonitors")}
</Typography>
<Typography sx={HEADER_SX}>{t("settingsDemoMonitorsDescription")}</Typography> <Typography sx={HEADER_SX}>{t("settingsDemoMonitorsDescription")}</Typography>
</Box> </Box>
<Box> <Box>
@@ -48,7 +53,12 @@ const SettingsDemoMonitors = ({ isAdmin, HEADER_SX, handleChange, isLoading }) =
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h1" variant="h2">{t("settingsSystemReset")}</Typography> <Typography
component="h1"
variant="h2"
>
{t("settingsSystemReset")}
</Typography>
<Typography sx={{ mt: theme.spacing(2) }}> <Typography sx={{ mt: theme.spacing(2) }}>
{t("settingsSystemResetDescription")} {t("settingsSystemResetDescription")}
</Typography> </Typography>
+8 -3
View File
@@ -52,14 +52,14 @@ const SettingsEmail = ({
systemEmailUser: settingsData?.settings?.systemEmailUser, systemEmailUser: settingsData?.settings?.systemEmailUser,
systemEmailAddress: settingsData?.settings?.systemEmailAddress, systemEmailAddress: settingsData?.settings?.systemEmailAddress,
systemEmailPassword: password || settingsData?.settings?.systemEmailPassword, systemEmailPassword: password || settingsData?.settings?.systemEmailPassword,
systemEmailConnectionHost: settingsData?.settings?.systemEmailConnectionHost systemEmailConnectionHost: settingsData?.settings?.systemEmailConnectionHost,
}; };
// Basic validation // Basic validation
if (!emailConfig.systemEmailHost || !emailConfig.systemEmailPort) { if (!emailConfig.systemEmailHost || !emailConfig.systemEmailPort) {
createToast({ createToast({
body: t("settingsEmailRequiredFields", "Email host and port are required"), body: t("settingsEmailRequiredFields", "Email host and port are required"),
variant: "error" variant: "error",
}); });
return; return;
} }
@@ -75,7 +75,12 @@ const SettingsEmail = ({
return ( return (
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h1" variant="h2">{t("settingsEmail")}</Typography> <Typography
component="h1"
variant="h2"
>
{t("settingsEmail")}
</Typography>
<Typography sx={HEADER_SX}>{t("settingsEmailDescription")}</Typography> <Typography sx={HEADER_SX}>{t("settingsEmailDescription")}</Typography>
</Box> </Box>
<Box> <Box>
@@ -41,7 +41,12 @@ const SettingsPagespeed = ({
return ( return (
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h1" variant="h2">{t("pageSpeedApiKeyFieldTitle")}</Typography> <Typography
component="h1"
variant="h2"
>
{t("pageSpeedApiKeyFieldTitle")}
</Typography>
<Typography sx={HEADING_SX}>{t("pageSpeedApiKeyFieldDescription")}</Typography> <Typography sx={HEADING_SX}>{t("pageSpeedApiKeyFieldDescription")}</Typography>
</Box> </Box>
<Stack gap={theme.spacing(20)}> <Stack gap={theme.spacing(20)}>
@@ -15,7 +15,12 @@ const SettingsTimeZone = ({ HEADING_SX, handleChange, timezone }) => {
return ( return (
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h1" variant="h2">{t("settingsGeneralSettings")}</Typography> <Typography
component="h1"
variant="h2"
>
{t("settingsGeneralSettings")}
</Typography>
<Typography sx={HEADING_SX}> <Typography sx={HEADING_SX}>
<Typography component="span">{t("settingsDisplayTimezone")}</Typography>-{" "} <Typography component="span">{t("settingsDisplayTimezone")}</Typography>-{" "}
{t("settingsDisplayTimezoneDescription")} {t("settingsDisplayTimezoneDescription")}
+6 -1
View File
@@ -16,7 +16,12 @@ const SettingsUI = ({ HEADING_SX, handleChange, mode, language }) => {
return ( return (
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h1" variant="h2">{t("settingsAppearance")}</Typography> <Typography
component="h1"
variant="h2"
>
{t("settingsAppearance")}
</Typography>
<Typography sx={HEADING_SX}>{t("settingsAppearanceDescription")}</Typography> <Typography sx={HEADING_SX}>{t("settingsAppearanceDescription")}</Typography>
</Box> </Box>
<Stack gap={theme.spacing(20)}> <Stack gap={theme.spacing(20)}>
@@ -9,7 +9,12 @@ const ConfigStack = ({ title, description, children }) => {
return ( return (
<ConfigBox> <ConfigBox>
<Stack gap={theme.spacing(6)}> <Stack gap={theme.spacing(6)}>
<Typography component="h2" variant="h2">{title}</Typography> <Typography
component="h2"
variant="h2"
>
{title}
</Typography>
<Typography component="p">{description}</Typography> <Typography component="p">{description}</Typography>
</Stack> </Stack>
{children} {children}
@@ -34,10 +34,13 @@ const TabSettings = ({
<Stack gap={theme.spacing(10)}> <Stack gap={theme.spacing(10)}>
<ConfigBox> <ConfigBox>
<Stack> <Stack>
<Typography component="h2" variant="h2">{t("access")}</Typography> <Typography
<Typography component="p"> component="h2"
{t("statusPageCreateSettings")} variant="h2"
>
{t("access")}
</Typography> </Typography>
<Typography component="p">{t("statusPageCreateSettings")}</Typography>
</Stack> </Stack>
<Stack gap={theme.spacing(18)}> <Stack gap={theme.spacing(18)}>
<Checkbox <Checkbox
@@ -51,7 +54,12 @@ const TabSettings = ({
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Stack gap={theme.spacing(6)}> <Stack gap={theme.spacing(6)}>
<Typography component="h2" variant="h2">{t("basicInformation")}</Typography> <Typography
component="h2"
variant="h2"
>
{t("basicInformation")}
</Typography>
<Typography component="p"> <Typography component="p">
{t("statusPageCreateBasicInfoDescription")} {t("statusPageCreateBasicInfoDescription")}
</Typography> </Typography>
@@ -82,7 +90,12 @@ const TabSettings = ({
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Stack gap={theme.spacing(6)}> <Stack gap={theme.spacing(6)}>
<Typography component="h2" variant="h2">{t("timezone")}</Typography> <Typography
component="h2"
variant="h2"
>
{t("timezone")}
</Typography>
<Typography component="p"> <Typography component="p">
{t("statusPageCreateSelectTimeZoneDescription")} {t("statusPageCreateSelectTimeZoneDescription")}
</Typography> </Typography>
@@ -100,7 +113,12 @@ const TabSettings = ({
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Stack gap={theme.spacing(6)}> <Stack gap={theme.spacing(6)}>
<Typography component="h2" variant="h2">{t("settingsAppearance")}</Typography> <Typography
component="h2"
variant="h2"
>
{t("settingsAppearance")}
</Typography>
<Typography component="p"> <Typography component="p">
{t("statusPageCreateAppearanceDescription")} {t("statusPageCreateAppearanceDescription")}
</Typography> </Typography>
@@ -23,7 +23,6 @@ const Tabs = ({
setTab, setTab,
TAB_LIST, TAB_LIST,
}) => { }) => {
const theme = useTheme(); const theme = useTheme();
return ( return (
<TabContext value={TAB_LIST[tab]}> <TabContext value={TAB_LIST[tab]}>
@@ -63,7 +62,6 @@ const Tabs = ({
setSelectedMonitors={setSelectedMonitors} setSelectedMonitors={setSelectedMonitors}
/> />
)} )}
</TabContext> </TabContext>
); );
}; };
+1 -1
View File
@@ -194,7 +194,7 @@ const CreateStatusPage = () => {
color: statusPage?.color, color: statusPage?.color,
logo: newLogo, logo: newLogo,
showCharts: statusPage?.showCharts ?? true, showCharts: statusPage?.showCharts ?? true,
showUptimePercentage: statusPage?.showUptimePercentage ?? true showUptimePercentage: statusPage?.showUptimePercentage ?? true,
}; };
}); });
setSelectedMonitors(statusPageMonitors); setSelectedMonitors(statusPageMonitors);
@@ -4,7 +4,8 @@ import { Button, Typography } from "@mui/material";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
const UploadFile = ({ onFileSelect }) => { // Changed prop to onFileSelect const UploadFile = ({ onFileSelect }) => {
// Changed prop to onFileSelect
const theme = useTheme(); const theme = useTheme();
const [file, setFile] = useState(); const [file, setFile] = useState();
const [error, setError] = useState(""); const [error, setError] = useState("");
@@ -22,7 +23,7 @@ const UploadFile = ({ onFileSelect }) => { // Changed prop to onFileSelect
// Basic file validation // Basic file validation
if (!selectedFile) return; if (!selectedFile) return;
if (!selectedFile.name.endsWith('.csv')) { if (!selectedFile.name.endsWith(".csv")) {
setError(t("bulkImport.invalidFileType")); setError(t("bulkImport.invalidFileType"));
return; return;
} }
@@ -63,8 +64,7 @@ const UploadFile = ({ onFileSelect }) => { // Changed prop to onFileSelect
</Button> </Button>
</div> </div>
); );
} };
UploadFile.prototype = { UploadFile.prototype = {
onFileSelect: PropTypes.func.isRequired, onFileSelect: PropTypes.func.isRequired,
+6 -1
View File
@@ -61,7 +61,12 @@ const BulkImport = () => {
</Typography> </Typography>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2" variant="h2">{t("bulkImport.selectFileTips")}</Typography> <Typography
component="h2"
variant="h2"
>
{t("bulkImport.selectFileTips")}
</Typography>
<Typography component="p"> <Typography component="p">
<Trans <Trans
i18nKey="bulkImport.selectFileDescription" i18nKey="bulkImport.selectFileDescription"
+20 -4
View File
@@ -343,7 +343,12 @@ const Configure = () => {
</Stack> </Stack>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2" variant="h2">{t("settingsGeneralSettings")}</Typography> <Typography
component="h2"
variant="h2"
>
{t("settingsGeneralSettings")}
</Typography>
<Typography component="p"> <Typography component="p">
{t("distributedUptimeCreateSelectURL")} {t("distributedUptimeCreateSelectURL")}
</Typography> </Typography>
@@ -389,7 +394,10 @@ const Configure = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2" variant="h2"> <Typography
component="h2"
variant="h2"
>
{t("distributedUptimeCreateIncidentNotification")} {t("distributedUptimeCreateIncidentNotification")}
</Typography> </Typography>
<Typography component="p"> <Typography component="p">
@@ -457,7 +465,12 @@ const Configure = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2" variant="h2">{t("ignoreTLSError")}</Typography> <Typography
component="h2"
variant="h2"
>
{t("ignoreTLSError")}
</Typography>
<Typography component="p">{t("ignoreTLSErrorDescription")}</Typography> <Typography component="p">{t("ignoreTLSErrorDescription")}</Typography>
</Box> </Box>
<Stack> <Stack>
@@ -477,7 +490,10 @@ const Configure = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2" variant="h2"> <Typography
component="h2"
variant="h2"
>
{t("distributedUptimeCreateAdvancedSettings")} {t("distributedUptimeCreateAdvancedSettings")}
</Typography> </Typography>
</Box> </Box>
+26 -5
View File
@@ -261,7 +261,12 @@ const CreateMonitor = () => {
</Typography> </Typography>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2" variant="h2">{t("distributedUptimeCreateChecks")}</Typography> <Typography
component="h2"
variant="h2"
>
{t("distributedUptimeCreateChecks")}
</Typography>
<Typography component="p"> <Typography component="p">
{t("distributedUptimeCreateChecksDescription")} {t("distributedUptimeCreateChecksDescription")}
</Typography> </Typography>
@@ -342,7 +347,12 @@ const CreateMonitor = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2" variant="h2">{t("settingsGeneralSettings")}</Typography> <Typography
component="h2"
variant="h2"
>
{t("settingsGeneralSettings")}
</Typography>
<Typography component="p">{t("uptimeCreateSelectURL")}</Typography> <Typography component="p">{t("uptimeCreateSelectURL")}</Typography>
</Box> </Box>
<Stack gap={theme.spacing(15)}> <Stack gap={theme.spacing(15)}>
@@ -386,7 +396,10 @@ const CreateMonitor = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2" variant="h2"> <Typography
component="h2"
variant="h2"
>
{t("distributedUptimeCreateIncidentNotification")} {t("distributedUptimeCreateIncidentNotification")}
</Typography> </Typography>
<Typography component="p"> <Typography component="p">
@@ -417,7 +430,12 @@ const CreateMonitor = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2" variant="h2">{t("ignoreTLSError")}</Typography> <Typography
component="h2"
variant="h2"
>
{t("ignoreTLSError")}
</Typography>
<Typography component="p">{t("ignoreTLSErrorDescription")}</Typography> <Typography component="p">{t("ignoreTLSErrorDescription")}</Typography>
</Box> </Box>
<Stack> <Stack>
@@ -437,7 +455,10 @@ const CreateMonitor = () => {
</ConfigBox> </ConfigBox>
<ConfigBox> <ConfigBox>
<Box> <Box>
<Typography component="h2" variant="h2"> <Typography
component="h2"
variant="h2"
>
{t("distributedUptimeCreateAdvancedSettings")} {t("distributedUptimeCreateAdvancedSettings")}
</Typography> </Typography>
</Box> </Box>
@@ -150,7 +150,10 @@ const UptimeDataTable = ({
id: "responseTime", id: "responseTime",
content: t("responseTime"), content: t("responseTime"),
render: (row) => ( render: (row) => (
<Box display="flex" justifyContent="center"> <Box
display="flex"
justifyContent="center"
>
<BarChart checks={row.monitor.checks.slice().reverse()} /> <BarChart checks={row.monitor.checks.slice().reverse()} />
</Box> </Box>
), ),
+6 -2
View File
@@ -1172,8 +1172,12 @@ class NetworkService {
systemEmailAddress: emailConfig.systemEmailAddress, systemEmailAddress: emailConfig.systemEmailAddress,
systemEmailPassword: emailConfig.systemEmailPassword, systemEmailPassword: emailConfig.systemEmailPassword,
// Only include these if they are present // Only include these if they are present
...(emailConfig.systemEmailConnectionHost && { systemEmailConnectionHost: emailConfig.systemEmailConnectionHost }), ...(emailConfig.systemEmailConnectionHost && {
...(emailConfig.systemEmailUser && { systemEmailUser: emailConfig.systemEmailUser }) systemEmailConnectionHost: emailConfig.systemEmailConnectionHost,
}),
...(emailConfig.systemEmailUser && {
systemEmailUser: emailConfig.systemEmailUser,
}),
}); });
} }
+2 -1
View File
@@ -183,7 +183,8 @@ const Greeting = ({ type = "" }) => {
lineHeight={1} lineHeight={1}
color={theme.palette.primary.contrastTextTertiary} color={theme.palette.primary.contrastTextTertiary}
> >
{t("greeting.append", { defaultValue: append })} — {t("greeting.overview", { type: t(`menu.${type}`) })} {t("greeting.append", { defaultValue: append })} —{" "}
{t("greeting.overview", { type: t(`menu.${type}`) })}
</Typography> </Typography>
</Box> </Box>
); );
+1 -2
View File
@@ -7,7 +7,6 @@
* @returns the Update Errors with the specific field with id being either removed or updated * @returns the Update Errors with the specific field with id being either removed or updated
*/ */
const buildErrors = (prev, id, error) => { const buildErrors = (prev, id, error) => {
const updatedErrors = { ...prev }; const updatedErrors = { ...prev };
if (error && id == error.details[0].path) { if (error && id == error.details[0].path) {
@@ -69,7 +68,7 @@ const hasValidationErrors = (form, validation, setErrors) => {
"_id", "_id",
"__v", "__v",
"createdAt", "createdAt",
"updatedAt" "updatedAt",
].includes(err.path[0]) ].includes(err.path[0])
) { ) {
newErrors[err.path[0]] = err.message ?? "Validation error"; newErrors[err.path[0]] = err.message ?? "Validation error";
+2 -2
View File
@@ -52,8 +52,8 @@ html {
--env-var-default-1: 24px; --env-var-default-1: 24px;
--env-var-default-2: 40px; --env-var-default-2: 40px;
--env-var-shadow-1: 0px 4px 24px -4px rgba(16, 24, 40, 0.08), --env-var-shadow-1:
0px 3px 3px -3px rgba(16, 24, 40, 0.03); 0px 4px 24px -4px rgba(16, 24, 40, 0.08), 0px 3px 3px -3px rgba(16, 24, 40, 0.03);
} }
.MuiInputBase-root.Mui-disabled input { .MuiInputBase-root.Mui-disabled input {