Merge pull request #3982 from bluewave-labs/fix/dashboard-types
fix: Dashboard types
This commit is contained in:
4 files changed
+9
-14
No files matched your search
@@ -1,11 +1,9 @@
|
|||||||
|
import { dashboardCardKeys, type DashboardCardKey } from "@/Types/Dashboard";
|
||||||
import { createSlice, type PayloadAction } from "@reduxjs/toolkit";
|
import { createSlice, type PayloadAction } from "@reduxjs/toolkit";
|
||||||
|
|
||||||
type ThemeMode = "light" | "dark";
|
type ThemeMode = "light" | "dark";
|
||||||
type ChartType = "histogram" | "line";
|
type ChartType = "histogram" | "line";
|
||||||
|
|
||||||
export const dashboardCardKeys = ["monitorStatus", "monitorsByType"] as const;
|
|
||||||
export type DashboardCardKey = (typeof dashboardCardKeys)[number];
|
|
||||||
|
|
||||||
type TableName =
|
type TableName =
|
||||||
| "monitors"
|
| "monitors"
|
||||||
| "team"
|
| "team"
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ import Stack from "@mui/material/Stack";
|
|||||||
import FormControlLabel from "@mui/material/FormControlLabel";
|
import FormControlLabel from "@mui/material/FormControlLabel";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Checkbox, Dialog } from "@/Components/inputs";
|
import { Checkbox, Dialog } from "@/Components/inputs";
|
||||||
import { type DashboardCardKey, dashboardCardKeys } from "@/Features/UI/uiSlice";
|
import { type DashboardCardKey, dashboardCardKeys } from "@/Types/Dashboard";
|
||||||
|
|
||||||
export type { DashboardCardKey };
|
|
||||||
|
|
||||||
interface EditCardsModalProps {
|
interface EditCardsModalProps {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
@@ -52,7 +50,7 @@ export const EditCardsModal = ({
|
|||||||
fullWidth
|
fullWidth
|
||||||
>
|
>
|
||||||
<Stack>
|
<Stack>
|
||||||
{dashboardCardKeys.map((key) => (
|
{dashboardCardKeys.map((key: DashboardCardKey) => (
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
key={key}
|
key={key}
|
||||||
label={t(`pages.dashboard.cards.${key}`)}
|
label={t(`pages.dashboard.cards.${key}`)}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useMemo, useState, type ReactNode } from "react";
|
import { Fragment, useMemo, useState, type ReactNode } from "react";
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import { useTheme } from "@mui/material/styles";
|
import { useTheme } from "@mui/material/styles";
|
||||||
@@ -10,16 +10,13 @@ import { Button } from "@/Components/inputs";
|
|||||||
import { LAYOUT } from "@/Utils/Theme/constants";
|
import { LAYOUT } from "@/Utils/Theme/constants";
|
||||||
import { useMonitorListController } from "@/Hooks/useMonitorListController";
|
import { useMonitorListController } from "@/Hooks/useMonitorListController";
|
||||||
import { MonitorTypes, type MonitorTypeCount } from "@/Types/Monitor";
|
import { MonitorTypes, type MonitorTypeCount } from "@/Types/Monitor";
|
||||||
import {
|
import { setDashboardVisibleCards } from "@/Features/UI/uiSlice";
|
||||||
setDashboardVisibleCards,
|
|
||||||
dashboardCardKeys,
|
|
||||||
type DashboardCardKey,
|
|
||||||
} from "@/Features/UI/uiSlice";
|
|
||||||
import type { RootState, AppDispatch } from "@/store";
|
import type { RootState, AppDispatch } from "@/store";
|
||||||
|
|
||||||
import { MonitorStatusCard } from "@/Pages/Dashboard/components/cards/MonitorStatusCard";
|
import { MonitorStatusCard } from "@/Pages/Dashboard/components/cards/MonitorStatusCard";
|
||||||
import { MonitorsByTypeCard } from "@/Pages/Dashboard/components/cards/MonitorsByTypeCard";
|
import { MonitorsByTypeCard } from "@/Pages/Dashboard/components/cards/MonitorsByTypeCard";
|
||||||
import { EditCardsModal } from "@/Pages/Dashboard/components/EditCardsModal";
|
import { EditCardsModal } from "@/Pages/Dashboard/components/EditCardsModal";
|
||||||
|
import { type DashboardCardKey, dashboardCardKeys } from "@/Types/Dashboard";
|
||||||
|
|
||||||
const Dashboard = () => {
|
const Dashboard = () => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
@@ -78,7 +75,7 @@ const Dashboard = () => {
|
|||||||
{dashboardCardKeys
|
{dashboardCardKeys
|
||||||
.filter((key) => visibleCards.has(key))
|
.filter((key) => visibleCards.has(key))
|
||||||
.map((key) => (
|
.map((key) => (
|
||||||
<div key={key}>{cardComponents[key]}</div>
|
<Fragment key={key}>{cardComponents[key]}</Fragment>
|
||||||
))}
|
))}
|
||||||
</Box>
|
</Box>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
export const dashboardCardKeys = ["monitorStatus", "monitorsByType"] as const;
|
||||||
|
export type DashboardCardKey = (typeof dashboardCardKeys)[number];
|
||||||
Reference in new issue
Block a user