diff --git a/Client/src/Components/Alert/index.jsx b/Client/src/Components/Alert/index.jsx index 49c089813..116ac5dea 100644 --- a/Client/src/Components/Alert/index.jsx +++ b/Client/src/Components/Alert/index.jsx @@ -31,6 +31,7 @@ const icons = { const Alert = ({ variant, title, body, isToast, hasIcon = true, onClick }) => { const theme = useTheme(); + /* TODO check if this still works. text bg and border not necessarilly exist. Text becomes contrastText. border becomes contrastText. bg becomes dark */ const { text, bg, border } = theme.palette[variant]; const icon = icons[variant]; diff --git a/Client/src/Components/Charts/BarChart/index.jsx b/Client/src/Components/Charts/BarChart/index.jsx index 20f016f46..c6308ee2d 100644 --- a/Client/src/Components/Charts/BarChart/index.jsx +++ b/Client/src/Components/Charts/BarChart/index.jsx @@ -5,6 +5,7 @@ import { useEffect, useState } from "react"; import "./index.css"; import { useSelector } from "react-redux"; +/* TODO add prop validation and jsdocs */ const BarChart = ({ checks = [] }) => { const theme = useTheme(); const [animate, setAnimate] = useState(false); @@ -65,7 +66,9 @@ const BarChart = ({ checks = [] }) => { width={theme.spacing(4)} height={theme.spacing(4)} backgroundColor={ - check.status ? theme.palette.success.main : theme.palette.error.text + check.status + ? theme.palette.success.main + : theme.palette.error.contrastText } sx={{ borderRadius: "50%" }} /> @@ -138,7 +141,7 @@ const BarChart = ({ checks = [] }) => { width="9px" height="100%" backgroundColor={ - check.status ? theme.palette.success.bg : theme.palette.error.bg + check.status ? theme.palette.success.dark : theme.palette.error.dark } sx={{ borderRadius: theme.spacing(1.5), @@ -153,7 +156,9 @@ const BarChart = ({ checks = [] }) => { width="100%" height={`${animate ? check.responseTime : 0}%`} backgroundColor={ - check.status ? theme.palette.success.main : theme.palette.error.text + check.status + ? theme.palette.success.main + : theme.palette.error.contrastText } sx={{ borderRadius: theme.spacing(1.5), diff --git a/Client/src/Components/Check/Check.jsx b/Client/src/Components/Check/Check.jsx index 01a023345..3219fec29 100644 --- a/Client/src/Components/Check/Check.jsx +++ b/Client/src/Components/Check/Check.jsx @@ -24,7 +24,7 @@ const Check = ({ text, noHighlightText, variant = "info", outlined = false }) => const theme = useTheme(); const colors = { success: theme.palette.success.main, - error: theme.palette.error.text, + error: theme.palette.error.contrastText, info: theme.palette.info.border, }; diff --git a/Client/src/Components/Inputs/Field/index.jsx b/Client/src/Components/Inputs/Field/index.jsx index 4ead8a705..ccb0c1e37 100644 --- a/Client/src/Components/Inputs/Field/index.jsx +++ b/Client/src/Components/Inputs/Field/index.jsx @@ -67,7 +67,7 @@ const Field = forwardRef( borderColor: theme.palette.border.dark, }, "&:has(.input-error) .MuiOutlinedInput-root fieldset": { - borderColor: theme.palette.error.text, + borderColor: theme.palette.error.contrastText, }, display: hidden ? "none" : "", }} @@ -83,7 +83,7 @@ const Field = forwardRef( * @@ -189,7 +189,7 @@ const Field = forwardRef( { const colors = { up: { dotColor: theme.palette.success.main, - bgColor: theme.palette.success.bg, + bgColor: theme.palette.success.dark, borderColor: theme.palette.success.light, }, down: { - dotColor: theme.palette.error.text, - bgColor: theme.palette.error.bg, + dotColor: theme.palette.error.contrastText, + bgColor: theme.palette.error.dark, borderColor: theme.palette.error.light, }, paused: { dotColor: theme.palette.warning.main, - bgColor: theme.palette.warning.bg, + bgColor: theme.palette.warning.dark, borderColor: theme.palette.warning.light, }, pending: { dotColor: theme.palette.warning.main, - bgColor: theme.palette.warning.bg, + bgColor: theme.palette.warning.dark, borderColor: theme.palette.warning.light, }, "cannot resolve": { diff --git a/Client/src/Components/ProgressBars/index.jsx b/Client/src/Components/ProgressBars/index.jsx index 46b2efab1..198f740aa 100644 --- a/Client/src/Components/ProgressBars/index.jsx +++ b/Client/src/Components/ProgressBars/index.jsx @@ -34,11 +34,11 @@ const ProgressUpload = ({ icon, label, size, progress = 0, onClick, error }) => backgroundColor: theme.palette.background.fill, "&:has(.input-error)": { borderColor: theme.palette.error.main, - backgroundColor: theme.palette.error.bg, + backgroundColor: theme.palette.error.dark, py: theme.spacing(4), px: theme.spacing(8), "& > .MuiStack-root > svg": { - fill: theme.palette.error.text, + fill: theme.palette.error.contrastText, width: "20px", height: "20px", }, @@ -85,7 +85,7 @@ const ProgressUpload = ({ icon, label, size, progress = 0, onClick, error }) => {error} diff --git a/Client/src/Pages/Maintenance/MaintenanceTable/ActionsMenu/index.jsx b/Client/src/Pages/Maintenance/MaintenanceTable/ActionsMenu/index.jsx index 8928b1e05..35a28f6da 100644 --- a/Client/src/Pages/Maintenance/MaintenanceTable/ActionsMenu/index.jsx +++ b/Client/src/Pages/Maintenance/MaintenanceTable/ActionsMenu/index.jsx @@ -114,7 +114,7 @@ const ActionsMenu = ({ /* isAdmin, */ maintenanceWindow, updateCallback }) => { "& ul": { p: theme.spacing(2.5) }, "& li": { m: 0 }, "& li:last-of-type": { - color: theme.palette.error.text, + color: theme.palette.error.contrastText, }, }, }, diff --git a/Client/src/Pages/Monitors/CreateMonitor/index.jsx b/Client/src/Pages/Monitors/CreateMonitor/index.jsx index bfa62c7fa..451ca2df3 100644 --- a/Client/src/Pages/Monitors/CreateMonitor/index.jsx +++ b/Client/src/Pages/Monitors/CreateMonitor/index.jsx @@ -1,10 +1,10 @@ import { useState, useEffect } from "react"; import { Box, Button, ButtonGroup, Stack, Typography } from "@mui/material"; -import LoadingButton from '@mui/lab/LoadingButton'; +import LoadingButton from "@mui/lab/LoadingButton"; import { useSelector, useDispatch } from "react-redux"; import { monitorValidation } from "../../../Validation/validation"; import { createUptimeMonitor } from "../../../Features/UptimeMonitors/uptimeMonitorsSlice"; -import { checkEndpointResolution } from "../../../Features/UptimeMonitors/uptimeMonitorsSlice" +import { checkEndpointResolution } from "../../../Features/UptimeMonitors/uptimeMonitorsSlice"; import { useNavigate, useParams } from "react-router-dom"; import { useTheme } from "@emotion/react"; import { createToast } from "../../../Utils/toastUtils"; @@ -19,12 +19,12 @@ import { getUptimeMonitorById } from "../../../Features/UptimeMonitors/uptimeMon import "./index.css"; const CreateMonitor = () => { - const MS_PER_MINUTE = 60000; - const { user, authToken } = useSelector((state) => state.auth); - const { monitors, isLoading } = useSelector((state) => state.uptimeMonitors); - const dispatch = useDispatch(); - const navigate = useNavigate(); - const theme = useTheme(); + const MS_PER_MINUTE = 60000; + const { user, authToken } = useSelector((state) => state.auth); + const { monitors, isLoading } = useSelector((state) => state.uptimeMonitors); + const dispatch = useDispatch(); + const navigate = useNavigate(); + const theme = useTheme(); const idMap = { "monitor-url": "url", @@ -148,16 +148,18 @@ const CreateMonitor = () => { setErrors(newErrors); createToast({ body: "Error validation data." }); } else { - if (monitor.type === "http") { - const checkEndpointAction = await dispatch( - checkEndpointResolution({ authToken, monitorURL: form.url }) - ) - if (checkEndpointAction.meta.requestStatus === "rejected") { - createToast({ body: "The endpoint you entered doesn't resolve. Check the URL again." }); - setErrors({ url: "The entered URL is not reachable." }); - return; - } - } + if (monitor.type === "http") { + const checkEndpointAction = await dispatch( + checkEndpointResolution({ authToken, monitorURL: form.url }) + ); + if (checkEndpointAction.meta.requestStatus === "rejected") { + createToast({ + body: "The endpoint you entered doesn't resolve. Check the URL again.", + }); + setErrors({ url: "The entered URL is not reachable." }); + return; + } + } form = { ...form, @@ -304,7 +306,7 @@ const CreateMonitor = () => { {errors["type"]} @@ -386,19 +388,19 @@ const CreateMonitor = () => { direction="row" justifyContent="flex-end" > - - Create monitor - + + Create monitor + ); }; -export default CreateMonitor; \ No newline at end of file +export default CreateMonitor; diff --git a/Client/src/Pages/Monitors/Details/Charts/index.jsx b/Client/src/Pages/Monitors/Details/Charts/index.jsx index 52b677495..915ee0933 100644 --- a/Client/src/Pages/Monitors/Details/Charts/index.jsx +++ b/Client/src/Pages/Monitors/Details/Charts/index.jsx @@ -61,7 +61,7 @@ const UpBarChart = memo(({ data, type, onBarHover }) => { ? { main: theme.palette.success.main, light: theme.palette.success.light } : uptime > 50 ? { main: theme.palette.warning.main, light: theme.palette.warning.light } - : { main: theme.palette.error.text, light: theme.palette.error.light }; + : { main: theme.palette.error.contrastText, light: theme.palette.error.light }; }; // TODO - REMOVE THIS LATER @@ -201,10 +201,10 @@ const DownBarChart = memo(({ data, type, onBarHover }) => { key={`cell-${entry.time}`} fill={ hoveredBarIndex === index - ? theme.palette.error.text + ? theme.palette.error.contrastText : chartHovered ? theme.palette.error.light - : theme.palette.error.text + : theme.palette.error.contrastText } onMouseEnter={() => { setHoveredBarIndex(index); @@ -246,24 +246,24 @@ const ResponseGaugeChart = ({ data }) => { ? { category: "Excellent", main: theme.palette.success.main, - bg: theme.palette.success.bg, + bg: theme.palette.success.dark, } : responseTime <= 500 ? { category: "Fair", main: theme.palette.success.main, - bg: theme.palette.success.bg, + bg: theme.palette.success.dark, } : responseTime <= 600 ? { category: "Acceptable", main: theme.palette.warning.main, - bg: theme.palette.warning.bg, + bg: theme.palette.warning.dark, } : { category: "Poor", - main: theme.palette.error.text, - bg: theme.palette.error.bg, + main: theme.palette.error.contrastText, + bg: theme.palette.error.dark, }; return ( diff --git a/Client/src/Pages/Monitors/Home/StatusBox.jsx b/Client/src/Pages/Monitors/Home/StatusBox.jsx index b87e883d7..d84690432 100644 --- a/Client/src/Pages/Monitors/Home/StatusBox.jsx +++ b/Client/src/Pages/Monitors/Home/StatusBox.jsx @@ -25,7 +25,7 @@ const StatusBox = ({ title, value }) => { ); } else if (title === "down") { - color = theme.palette.error.text; + color = theme.palette.error.contrastText; icon = ( diff --git a/Client/src/Pages/Monitors/Home/actionsMenu.jsx b/Client/src/Pages/Monitors/Home/actionsMenu.jsx index 7efffa93c..4ab601fea 100644 --- a/Client/src/Pages/Monitors/Home/actionsMenu.jsx +++ b/Client/src/Pages/Monitors/Home/actionsMenu.jsx @@ -109,7 +109,7 @@ const ActionsMenu = ({ monitor, isAdmin, updateCallback }) => { "& ul": { p: theme.spacing(2.5) }, "& li": { m: 0 }, "& li:last-of-type": { - color: theme.palette.error.text, + color: theme.palette.error.contrastText, }, }, }, diff --git a/Client/src/Pages/Monitors/utils.jsx b/Client/src/Pages/Monitors/utils.jsx index 826a92bbb..4dc4260cd 100644 --- a/Client/src/Pages/Monitors/utils.jsx +++ b/Client/src/Pages/Monitors/utils.jsx @@ -28,20 +28,20 @@ const useUtils = () => { }; const statusStyles = { up: { - backgroundColor: theme.palette.success.bg, - background: `linear-gradient(340deg, ${theme.palette.success.light} -60%, ${theme.palette.success.bg} 35%)`, + backgroundColor: theme.palette.success.dark, + background: `linear-gradient(340deg, ${theme.palette.success.light} -60%, ${theme.palette.success.dark} 35%)`, borderColor: theme.palette.success.light, "& h2": { color: theme.palette.success.main }, }, down: { - backgroundColor: theme.palette.error.bg, - background: `linear-gradient(340deg, ${theme.palette.error.light} -60%, ${theme.palette.error.bg} 35%)`, + backgroundColor: theme.palette.error.dark, + background: `linear-gradient(340deg, ${theme.palette.error.light} -60%, ${theme.palette.error.dark} 35%)`, borderColor: theme.palette.error.light, "& h2": { color: theme.palette.error.main }, }, paused: { - backgroundColor: theme.palette.warning.bg, - background: `linear-gradient(340deg, ${theme.palette.warning.light} -60%, ${theme.palette.warning.bg} 35%)`, + backgroundColor: theme.palette.warning.dark, + background: `linear-gradient(340deg, ${theme.palette.warning.light} -60%, ${theme.palette.warning.dark} 35%)`, borderColor: theme.palette.warning.light, "& h2": { color: theme.palette.warning.main }, }, @@ -54,22 +54,22 @@ const useUtils = () => { }; const pagespeedStyles = { up: { - bg: theme.palette.success.bg, + bg: theme.palette.success.dark, light: theme.palette.success.light, stroke: theme.palette.success.main, }, down: { - bg: theme.palette.error.bg, + bg: theme.palette.error.dark, light: theme.palette.error.light, stroke: theme.palette.error.main, }, paused: { - bg: theme.palette.warning.bg, + bg: theme.palette.warning.dark, light: theme.palette.warning.light, stroke: theme.palette.warning.main, }, pending: { - bg: theme.palette.warning.bg, + bg: theme.palette.warning.dark, light: theme.palette.warning.light, stroke: theme.palette.warning.main, }, diff --git a/Client/src/Pages/PageSpeed/CreatePageSpeed/index.jsx b/Client/src/Pages/PageSpeed/CreatePageSpeed/index.jsx index 162b231a2..f771c3988 100644 --- a/Client/src/Pages/PageSpeed/CreatePageSpeed/index.jsx +++ b/Client/src/Pages/PageSpeed/CreatePageSpeed/index.jsx @@ -1,11 +1,14 @@ import { useState } from "react"; import { Box, Button, ButtonGroup, Stack, Typography } from "@mui/material"; -import LoadingButton from '@mui/lab/LoadingButton'; +import LoadingButton from "@mui/lab/LoadingButton"; import { useSelector, useDispatch } from "react-redux"; import { monitorValidation } from "../../../Validation/validation"; import { useNavigate } from "react-router-dom"; import { useTheme } from "@emotion/react"; -import { createPageSpeed, checkEndpointResolution } from "../../../Features/PageSpeedMonitor/pageSpeedMonitorSlice"; +import { + createPageSpeed, + checkEndpointResolution, +} from "../../../Features/PageSpeedMonitor/pageSpeedMonitorSlice"; import { createToast } from "../../../Utils/toastUtils"; import { logger } from "../../../Utils/Logger"; import { ConfigBox } from "../../Monitors/styled"; @@ -17,12 +20,12 @@ import Breadcrumbs from "../../../Components/Breadcrumbs"; import "./index.css"; const CreatePageSpeed = () => { - const MS_PER_MINUTE = 60000; - const { user, authToken } = useSelector((state) => state.auth); - const { isLoading } = useSelector((state) => state.pageSpeedMonitors); - const dispatch = useDispatch(); - const navigate = useNavigate(); - const theme = useTheme(); + const MS_PER_MINUTE = 60000; + const { user, authToken } = useSelector((state) => state.auth); + const { isLoading } = useSelector((state) => state.pageSpeedMonitors); + const dispatch = useDispatch(); + const navigate = useNavigate(); + const theme = useTheme(); const idMap = { "monitor-url": "url", @@ -105,252 +108,260 @@ const CreatePageSpeed = () => { abortEarly: false, }); - if (error) { - const newErrors = {}; - error.details.forEach((err) => { - newErrors[err.path[0]] = err.message; - }); - setErrors(newErrors); - createToast({ body: "Error validation data." }); - } else { - const checkEndpointAction = await dispatch( - checkEndpointResolution({ authToken, monitorURL: form.url }) - ) - if (checkEndpointAction.meta.requestStatus === "rejected") { - createToast({ body: "The endpoint you entered doesn't resolve. Check the URL again." }); - setErrors({ url: "The entered URL is not reachable." }); - return; - } + if (error) { + const newErrors = {}; + error.details.forEach((err) => { + newErrors[err.path[0]] = err.message; + }); + setErrors(newErrors); + createToast({ body: "Error validation data." }); + } else { + const checkEndpointAction = await dispatch( + checkEndpointResolution({ authToken, monitorURL: form.url }) + ); + if (checkEndpointAction.meta.requestStatus === "rejected") { + createToast({ + body: "The endpoint you entered doesn't resolve. Check the URL again.", + }); + setErrors({ url: "The entered URL is not reachable." }); + return; + } - form = { - ...form, - description: form.name, - teamId: user.teamId, - userId: user._id, - notifications: monitor.notifications, - }; - const action = await dispatch( - createPageSpeed({ authToken, monitor: form }) - ); - if (action.meta.requestStatus === "fulfilled") { - createToast({ body: "Monitor created successfully!" }); - navigate("/pagespeed"); - } else { - createToast({ body: "Failed to create monitor." }); - } - } - }; + form = { + ...form, + description: form.name, + teamId: user.teamId, + userId: user._id, + notifications: monitor.notifications, + }; + const action = await dispatch(createPageSpeed({ authToken, monitor: form })); + if (action.meta.requestStatus === "fulfilled") { + createToast({ body: "Monitor created successfully!" }); + navigate("/pagespeed"); + } else { + createToast({ body: "Failed to create monitor." }); + } + } + }; - //select values - const frequencies = [ - { _id: 3, name: "3 minutes" }, - { _id: 5, name: "5 minutes" }, - { _id: 10, name: "10 minutes" }, - { _id: 20, name: "20 minutes" }, - { _id: 60, name: "1 hour" }, - { _id: 1440, name: "1 day" }, - { _id: 10080, name: "1 week" }, - ]; - return ( - - - - - - Create your{" "} - - - pagespeed monitor - - - - - General settings - - Here you can select the URL of the host, together with the type of - monitor. - - - - - - - - - - Checks to perform - - You can always add or remove checks after adding your site. - - - - - handleChange(event)} - /> - - - - - - {errors["type"] ? ( - - - {errors["type"]} - - - ) : ( - "" - )} - - - - - Incident notifications - - When there is an incident, notify users. - - - - When there is a new incident, - logger.warn("disabled")} - isDisabled={true} - /> - notification.type === "email" - )} - value={user?.email} - onChange={(event) => handleChange(event)} - /> - logger.warn("disabled")} - isDisabled={true} - /> - {monitor.notifications.some( - (notification) => notification.type === "emails" - ) ? ( - - logger.warn("disabled")} - /> - - You can separate multiple emails with a comma - - - ) : ( - "" - )} - - - - - Advanced settings - - - handleChange(event, "interval")} + items={frequencies} + /> + + + + + Create monitor + + + + + ); }; export default CreatePageSpeed; diff --git a/Client/src/Pages/PageSpeed/Details/Charts/PieChart.jsx b/Client/src/Pages/PageSpeed/Details/Charts/PieChart.jsx index a330c3c12..d1d106c11 100644 --- a/Client/src/Pages/PageSpeed/Details/Charts/PieChart.jsx +++ b/Client/src/Pages/PageSpeed/Details/Charts/PieChart.jsx @@ -127,22 +127,22 @@ const PieChart = ({ audits }) => { return { stroke: theme.palette.success.main, strokeBg: theme.palette.success.light, - text: theme.palette.success.text, - bg: theme.palette.success.bg, + text: theme.palette.success.contrastText, + bg: theme.palette.success.dark, }; else if (value >= 50 && value < 90) return { stroke: theme.palette.warning.main, strokeBg: theme.palette.warning.light, - text: theme.palette.warning.text, - bg: theme.palette.warning.bg, + text: theme.palette.warning.contrastText, + bg: theme.palette.warning.dark, }; else if (value >= 0 && value < 50) return { - stroke: theme.palette.error.text, + stroke: theme.palette.error.contrastText, strokeBg: theme.palette.error.light, - text: theme.palette.error.text, - bg: theme.palette.error.bg, + text: theme.palette.error.contrastText, + bg: theme.palette.error.dark, }; return { stroke: theme.palette.unresolved.main, diff --git a/Client/src/Pages/PageSpeed/Details/index.jsx b/Client/src/Pages/PageSpeed/Details/index.jsx index 015a17c6b..ca852e124 100644 --- a/Client/src/Pages/PageSpeed/Details/index.jsx +++ b/Client/src/Pages/PageSpeed/Details/index.jsx @@ -362,7 +362,7 @@ const PageSpeedDetails = ({ isAdmin }) => { : score >= 50 ? theme.palette.warning.main : score >= 0 - ? theme.palette.error.text + ? theme.palette.error.contrastText : theme.palette.unresolved.main; // Find the position where the number ends and the unit begins diff --git a/Client/src/Utils/Theme/constants.js b/Client/src/Utils/Theme/constants.js index 21bac7352..ceb138fc3 100644 --- a/Client/src/Utils/Theme/constants.js +++ b/Client/src/Utils/Theme/constants.js @@ -27,34 +27,127 @@ const paletteColors = { gray70: "#FDFDFD", gray80: "#FDFCFD", gray90: "#FCFCFD", + gray100: "#F4F4F4", + gray200: "#E3E3E3", + gray800: "#2D2D33", + gray830: "#262115", gray850: "#131315", gray860: "#111113", gray870: "#0F0F11", gray880: "#0C0C0E", gray890: "#09090B", black: "#000000", + blueBlueWave: "#1570EF", + blue700: "#475467", + green20: "#ECFDF3", + green50: "#D4F4E1", + green150: "#45BB7A", + green200: "#17B26A", + green400: "#079455", + green800: "#1C4428", + green900: "#12261E", + red50: "#F9ECED", + red100: "#FBD1D1", + red200: "#F04438", + red300: "#D32F2F", + red700: "#542426", + red800: "#301A1F", + orange50: "#FEF8EA", + orange100: "#FFECBC", + orange200: "#FEC84B", + orange300: "#FDB022", + orange400: "#FF9F00", + orange500: "#E88C30", + orange600: "#DC6803", + orange800: "#624711", }; -/* TODO Export this as colors */ -/* primary: { - main: { - light:, - dark: - }, - light:{ - light:, - dark: - }, - dark:{ - light:, - dark: - }, - contrastText: { - light:, - dark: - }, - } */ const semanticColors = { + primary: { + main: { + light: paletteColors.blueBlueWave, + dark: paletteColors.blueBlueWave, + }, + // TODO we dont have primary light, dark or contrast text + }, + secondary: { + main: { + light: paletteColors.gray100, + dark: paletteColors.gray800, + }, + // TODO we dont have secondary light + dark: { + light: paletteColors.gray200, + //TODO we dont have secondary dark for dark mode + }, + constrastText: { + light: paletteColors.blue700, + //TODO we dont have secondary contrastText for dark mode + }, + }, + success: { + main: { + light: paletteColors.green200, + dark: paletteColors.green150, + }, + contrastText: { + //TODO values are equal (confirm) + //TODO contrasttext semantically should be something that contrasts with the main + light: paletteColors.green400, + dark: paletteColors.green400, + }, + light: { + light: paletteColors.green50, + //TODO dark mode light success is darker than the main success + dark: paletteColors.green800, + }, + dark: { + light: paletteColors.green20, + dark: paletteColors.green900, + }, + }, + error: { + main: { + light: paletteColors.red300, + dark: paletteColors.red300, + }, + contrastText: { + //TODO contrasttext semantically should be something that contrasts with the main + light: paletteColors.red200, + dark: paletteColors.red200, + }, + light: { + light: paletteColors.red100, + dark: paletteColors.red700, + }, + dark: { + light: paletteColors.red50, + dark: paletteColors.red800, + }, + }, + warning: { + main: { + light: paletteColors.orange300, + dark: paletteColors.orange400, + }, + text: { + light: paletteColors.orange600, + dark: paletteColors.orange500, + }, + light: { + light: paletteColors.orange100, + dark: paletteColors.orange800, + }, + bg: { + light: paletteColors.orange50, + dark: paletteColors.gray830, + }, + border: { + light: paletteColors.orange200, + dark: paletteColors.orange500, + }, + }, + gradient: { color1: { light: paletteColors.gray90, diff --git a/Client/src/Utils/Theme/darkTheme.js b/Client/src/Utils/Theme/darkTheme.js index ea1674ccd..5b47b3963 100644 --- a/Client/src/Utils/Theme/darkTheme.js +++ b/Client/src/Utils/Theme/darkTheme.js @@ -17,51 +17,43 @@ const background = { }; const border = { light: "#27272a", dark: "#36363e" }; -const { gradient } = colors; -/* const gradient = { - color1: "#09090b", - color2: "#0c0c0e", - color3: "#0f0f11", - color4: "#111113", - color5: "#131315", -}; */ +const { + primary, + secondary, + success, + error, + warning, + gradient: { + color1: { dark: color1 }, + color2: { dark: color2 }, + color3: { dark: color3 }, + color4: { dark: color4 }, + color5: { dark: color5 }, + }, +} = colors; const darkTheme = createTheme({ ...baseTheme, palette: { - primary: { main: "#1570ef" }, - secondary: { main: "#2D2D33" }, - text: text, - background: background, - border: border, - info: { - text: text.primary, - main: text.secondary, - bg: background.main, - light: background.main, - border: border.light, - }, - gradient, + primary: { main: primary.main.dark }, + secondary: { main: secondary.main.dark }, success: { - text: "#079455", - main: "#45bb7a", - light: "#1c4428", - bg: "#12261e", + main: success.main.dark, + contrastText: success.contrastText.dark, + light: success.light.dark, + dark: success.dark.dark, }, error: { - text: "#f04438", - main: "#d32f2f", - light: "#542426", - bg: "#301a1f", - dark: "#932020", - border: "#f04438", + main: error.main.dark, + contrastText: error.contrastText.dark, + light: error.light.dark, + dark: error.dark.dark, }, warning: { - text: "#e88c30", - main: "#FF9F00", - light: "#624711", - bg: "#262115", - border: "#e88c30", + main: warning.main.dark, + light: warning.light.dark, + contrastText: warning.contrastText.dark, + dark: warning.dark.dark, }, percentage: { uptimePoor: "#d32f2f", @@ -78,6 +70,23 @@ const darkTheme = createTheme({ grid: "#454546", autofill: "#2d2d33", }, + gradient: { + color1, + color2, + color3, + color4, + color5, + }, + text: text, + background: background, + border: border, + info: { + text: text.primary, + main: text.secondary, + bg: background.main, + light: background.main, + border: border.light, + }, }, }); diff --git a/Client/src/Utils/Theme/lightTheme.js b/Client/src/Utils/Theme/lightTheme.js index 1f88d0696..c8229ad1e 100644 --- a/Client/src/Utils/Theme/lightTheme.js +++ b/Client/src/Utils/Theme/lightTheme.js @@ -15,52 +15,49 @@ const background = { accent: "#f9fafb", }; -const { gradient } = colors; -/* const gradient = { - color1: "#fcfcfd", - color2: "#fdfcfd", - color3: "#fdfdfd", - color4: "#fefdfe", - color5: "#fefefe", -}; */ - const border = { light: "#eaecf0", dark: "#d0d5dd" }; +const { + primary, + secondary, + success, + error, + warning, + gradient: { + color1: { light: color1 }, + color2: { light: color2 }, + color3: { light: color3 }, + color4: { light: color4 }, + color5: { light: color5 }, + }, +} = colors; + const lightTheme = createTheme({ ...baseTheme, palette: { - primary: { main: "#1570EF" }, - secondary: { main: "#F4F4F4", dark: "#e3e3e3", contrastText: "#475467" }, - text: text, - background: background, - border: border, - info: { - text: text.primary, - main: text.tertiary, - bg: background.main, - light: background.main, - border: border.dark, + primary: { main: primary.main.light }, + secondary: { + main: secondary.main.light, + dark: secondary.dark.light, + contrastText: secondary.constrastText.light, }, - gradient, success: { - text: "#079455", - main: "#17b26a", - light: "#d4f4e1", - bg: "#ecfdf3", + main: success.main.light, + contrastText: success.contrastText.light, + light: success.light.light, + dark: success.dark.light, }, error: { - text: "#f04438", - main: "#d32f2f", - light: "#fbd1d1", - bg: "#f9eced", - border: "#f04438", + main: error.main.light, + contrastText: error.contrastText.light, + light: error.light.light, + dark: error.dark.light, }, warning: { - text: "#DC6803", - main: "#fdb022", - light: "#ffecbc", - bg: "#fef8ea", - border: "#fec84b", + main: warning.main.light, + light: warning.light.light, + contrastText: warning.contrastText.light, + dark: warning.dark.light, }, percentage: { uptimePoor: "#d32f2f", @@ -77,6 +74,23 @@ const lightTheme = createTheme({ grid: "#a2a3a3", autofill: "#e8f0fe", }, + gradient: { + color1, + color2, + color3, + color4, + color5, + }, + text: text, + background: background, + border: border, + info: { + text: text.primary, + main: text.tertiary, + bg: background.main, + light: background.main, + border: border.dark, + }, }, });