Added the status color to monitor utils.
This commit is contained in:
1 parent
3ddea2ef8b
commit
97a73a385a
2 files changed
+13
-9
No files matched your search
@@ -1,6 +1,8 @@
|
|||||||
import { useCallback } from "react";
|
import { useCallback } from "react";
|
||||||
|
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 = "";
|
||||||
@@ -36,7 +38,16 @@ const useMonitorUtils = () => {
|
|||||||
return monitor?.status == true ? "up" : "down";
|
return monitor?.status == true ? "up" : "down";
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return { getMonitorWithPercentage, determineState };
|
const theme = useTheme();
|
||||||
|
|
||||||
|
const statusColor = {
|
||||||
|
up: theme.palette.success.lowContrast,
|
||||||
|
down: theme.palette.error.lowContrast,
|
||||||
|
paused: theme.palette.warning.lowContrast,
|
||||||
|
pending: theme.palette.warning.lowContrast,
|
||||||
|
};
|
||||||
|
|
||||||
|
return { getMonitorWithPercentage, determineState, statusColor };
|
||||||
};
|
};
|
||||||
|
|
||||||
export { useMonitorUtils };
|
export { useMonitorUtils };
|
||||||
@@ -214,14 +214,7 @@ const Configure = () => {
|
|||||||
setIsNotificationModalOpen(false);
|
setIsNotificationModalOpen(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const statusColor = {
|
const { determineState, statusColor } = useMonitorUtils();
|
||||||
up: theme.palette.success.main,
|
|
||||||
down: theme.palette.error.main,
|
|
||||||
paused: theme.palette.error.main,
|
|
||||||
pending: theme.palette.warning.main,
|
|
||||||
};
|
|
||||||
|
|
||||||
const { determineState } = useMonitorUtils();
|
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user