actions menu

This commit is contained in:
Alex Holliday committed 2025-10-06 11:40:08 -07:00
1 parent 61651a0f4d
commit 56e0ac9640
2 files changed
+8 -7

No files matched your search

@@ -1,4 +1,4 @@
import { useState } from "react";
import React, { useState } from "react";
import Menu from "@mui/material/Menu";
import MenuItem from "@mui/material/MenuItem";
import IconButton from "@mui/material/IconButton";
@@ -6,7 +6,7 @@ import Settings from "@/assets/icons/settings-bold.svg?react";
export type ActionMenuItem = {
id: number | string;
label: string;
label: React.ReactNode;
action: Function;
closeMenu?: boolean;
};
+6 -5
View File
@@ -8,8 +8,9 @@ import { useMediaQuery } from "@mui/material";
import { useTheme } from "@mui/material/styles";
import { ActionsMenu } from "@/Components/v2/ActionsMenu";
import type { ActionMenuItem } from "@/Components/v2/ActionsMenu";
import Typography from "@mui/material/Typography";
const getActions = (t: Function): ActionMenuItem[] => {
const getActions = (theme: any, t: Function): ActionMenuItem[] => {
return [
{
id: 1,
@@ -57,7 +58,7 @@ const getActions = (t: Function): ActionMenuItem[] => {
},
{
id: 7,
label: "Delete",
label: <Typography color={theme.palette.error.main}>Remove</Typography>,
action: () => {
console.log("Open delete");
},
@@ -66,7 +67,7 @@ const getActions = (t: Function): ActionMenuItem[] => {
];
};
const getHeaders = (t: Function) => {
const getHeaders = (theme: any, t: Function) => {
const headers: Header<IMonitor>[] = [
{
id: "name",
@@ -104,7 +105,7 @@ const getHeaders = (t: Function) => {
id: "actions",
content: t("actions"),
render: (row) => {
return <ActionsMenu items={getActions(t)} />;
return <ActionsMenu items={getActions(theme, t)} />;
},
},
];
@@ -116,7 +117,7 @@ export const MonitorTable = ({ monitors }: { monitors: IMonitor[] }) => {
const theme = useTheme();
const isSmall = useMediaQuery(theme.breakpoints.down("md"));
let headers = getHeaders(t);
let headers = getHeaders(theme, t);
if (isSmall) {
headers = headers.filter((h) => h.id !== "histogram");