add code adjustments
This commit is contained in:
4 files changed
+34
-31
No files matched your search
@@ -20,7 +20,7 @@ import {
|
|||||||
Tag,
|
Tag,
|
||||||
Waypoints,
|
Waypoints,
|
||||||
Container,
|
Container,
|
||||||
LayoutDashboard,
|
// LayoutDashboard,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
export const getMenu = (t: Function) => {
|
export const getMenu = (t: Function) => {
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import { LAYOUT } from "@/Utils/Theme/constants";
|
||||||
|
import Box from "@mui/material/Box";
|
||||||
|
import { useTheme } from "@mui/material/styles";
|
||||||
|
|
||||||
|
interface ProgressBarProps {
|
||||||
|
fillRatio: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const ProgressBar = ({ fillRatio }: ProgressBarProps) => {
|
||||||
|
const theme = useTheme();
|
||||||
|
const clamped = Math.min(1, Math.max(0, fillRatio));
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Box
|
||||||
|
height={theme.spacing(LAYOUT.XS)}
|
||||||
|
borderRadius={theme.shape.borderRadius}
|
||||||
|
bgcolor={theme.palette.action.disabledBackground}
|
||||||
|
overflow="hidden"
|
||||||
|
>
|
||||||
|
<Box
|
||||||
|
height="100%"
|
||||||
|
width={`${clamped * 100}%`}
|
||||||
|
borderRadius={theme.shape.borderRadius}
|
||||||
|
bgcolor={theme.palette.primary.main}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
import Box from "@mui/material/Box";
|
|
||||||
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 { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import { typographyLevels } from "@/Utils/Theme/Palette";
|
import { typographyLevels } from "@/Utils/Theme/Palette";
|
||||||
import { LAYOUT, SPACING } from "@/Utils/Theme/constants";
|
import { SPACING } from "@/Utils/Theme/constants";
|
||||||
|
import { ProgressBar } from "@/Pages/Dashboard/components/ProgressBar";
|
||||||
|
|
||||||
interface BarRowProps {
|
interface BarRowProps {
|
||||||
label: string;
|
label: string;
|
||||||
@@ -14,7 +14,6 @@ interface BarRowProps {
|
|||||||
|
|
||||||
export const BarRow = ({ label, value, fillRatio, valueColor }: BarRowProps) => {
|
export const BarRow = ({ label, value, fillRatio, valueColor }: BarRowProps) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const clampedRatio = Math.min(1, Math.max(0, fillRatio));
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack gap={theme.spacing(SPACING.LG)}>
|
<Stack gap={theme.spacing(SPACING.LG)}>
|
||||||
@@ -37,19 +36,7 @@ export const BarRow = ({ label, value, fillRatio, valueColor }: BarRowProps) =>
|
|||||||
{value}
|
{value}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Box
|
<ProgressBar fillRatio={fillRatio} />
|
||||||
height={theme.spacing(LAYOUT.XS)}
|
|
||||||
borderRadius={theme.shape.borderRadius}
|
|
||||||
bgcolor={theme.palette.action.disabledBackground}
|
|
||||||
overflow="hidden"
|
|
||||||
>
|
|
||||||
<Box
|
|
||||||
height="100%"
|
|
||||||
width={`${clampedRatio * 100}%`}
|
|
||||||
borderRadius={theme.shape.borderRadius}
|
|
||||||
bgcolor={theme.palette.primary.main}
|
|
||||||
/>
|
|
||||||
</Box>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import Box from "@mui/material/Box";
|
|
||||||
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 { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
import { DashboardCard } from "@/Pages/Dashboard/components/DashboardCard";
|
import { DashboardCard } from "@/Pages/Dashboard/components/DashboardCard";
|
||||||
|
import { ProgressBar } from "@/Pages/Dashboard/components/ProgressBar";
|
||||||
import { typographyLevels } from "@/Utils/Theme/Palette";
|
import { typographyLevels } from "@/Utils/Theme/Palette";
|
||||||
import { SPACING } from "@/Utils/Theme/constants";
|
import { SPACING } from "@/Utils/Theme/constants";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -42,19 +42,7 @@ export const MonitorStatusCard = ({ summary }: MonitorStatusCardProps) => {
|
|||||||
{t("pages.dashboard.monitorStatus.ofUp", { total })}
|
{t("pages.dashboard.monitorStatus.ofUp", { total })}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Box
|
<ProgressBar fillRatio={ratio} />
|
||||||
height={4}
|
|
||||||
borderRadius={2}
|
|
||||||
bgcolor={theme.palette.action.disabledBackground}
|
|
||||||
overflow="hidden"
|
|
||||||
>
|
|
||||||
<Box
|
|
||||||
height="100%"
|
|
||||||
width={`${ratio * 100}%`}
|
|
||||||
borderRadius={2}
|
|
||||||
bgcolor={theme.palette.primary.main}
|
|
||||||
/>
|
|
||||||
</Box>
|
|
||||||
</Stack>
|
</Stack>
|
||||||
</DashboardCard>
|
</DashboardCard>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in new issue
Block a user