remove unused

This commit is contained in:
Alex Holliday committed 2026-02-09 23:51:18 +00:00
1 parent 1236b9191e
commit a20fdb423a
7 files changed
+33 -249

No files matched your search

-17
View File
@@ -1,17 +0,0 @@
import { useSelector } from "react-redux";
const useIsAdmin = () => {
const { user } = useSelector((state) => state.auth);
const isAdmin =
(user?.role?.includes("admin") ?? false) ||
(user?.role?.includes("superadmin") ?? false);
return isAdmin;
};
const useIsSuperAdmin = () => {
const { user } = useSelector((state) => state.auth);
const isSuperAdmin = user?.role?.includes("superadmin");
return isSuperAdmin;
};
export { useIsAdmin, useIsSuperAdmin };
+18
View File
@@ -0,0 +1,18 @@
import type { RootState } from "@/Types/state";
import { useSelector } from "react-redux";
const useIsAdmin = (): boolean => {
const { user } = useSelector((state: RootState) => state.auth);
const isAdmin =
(user?.role?.includes("admin") ?? false) ||
(user?.role?.includes("superadmin") ?? false);
return isAdmin;
};
const useIsSuperAdmin = (): boolean => {
const { user } = useSelector((state: RootState) => state.auth);
const isSuperAdmin = user?.role?.includes("superadmin") ?? false;
return isSuperAdmin;
};
export { useIsAdmin, useIsSuperAdmin };
-72
View File
@@ -1,72 +0,0 @@
import { useCallback } from "react";
import { useTheme } from "@mui/material";
const useMonitorUtils = () => {
const getMonitorWithPercentage = useCallback((monitor, theme) => {
let uptimePercentage = "";
let percentageColor = "";
if (monitor?.uptimePercentage !== undefined) {
uptimePercentage =
monitor?.uptimePercentage === 0
? "0"
: (monitor?.uptimePercentage * 100).toFixed(2);
percentageColor =
monitor?.uptimePercentage < 0.25
? theme.palette.error.main
: monitor?.uptimePercentage < 0.5
? theme.palette.warning.main
: monitor?.uptimePercentage < 0.75
? theme.palette.success.main
: theme.palette.success.main;
}
return {
...monitor,
percentage: uptimePercentage,
percentageColor,
monitor: monitor,
};
}, []);
const determineState = useCallback((monitor) => {
if (typeof monitor === "undefined") return "pending";
if (monitor?.isActive === false) return "paused";
if (monitor?.status === undefined) return "pending";
return monitor?.status == true ? "up" : "down";
}, []);
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,
};
const statusToTheme = {
up: "success",
down: "error",
paused: "warning",
pending: "secondary",
"cannot resolve": "tertiary",
};
const pagespeedStatusMsg = {
up: "Live (collecting data)",
down: "Inactive",
paused: "Paused",
};
return {
getMonitorWithPercentage,
determineState,
statusColor,
statusToTheme,
pagespeedStatusMsg,
};
};
export { useMonitorUtils };