// material-ui import * as React from 'react'; import { DataGrid, GridActionsCellItem, } from "@mui/x-data-grid"; import AssignmentTurnedInOutlinedIcon from '@mui/icons-material/AssignmentTurnedInOutlined'; import NotificationsOffRoundedIcon from '@mui/icons-material/NotificationsOffRounded'; import { CustomNoRowsOverlay, getObjectById, notifySaveSuccess, } from "../../utils/CommonFunction"; import {Typography} from "@mui/material"; import {LIONER_BUTTON_THEME} from "../../themes/colorConst"; import {ThemeProvider} from "@emotion/react"; import axios from "axios"; import {apiPath, getUserData} from "../../auth/utils"; import {POST_TODO_MARK_READ, POST_TODO_MARK_SUPPRESS} from "../../utils/ApiPathConst"; import {useContext} from "react"; import AbilityContext from "../../components/AbilityProvider"; export default function ReminderTable({recordList, isReaded, fetchList,value, isReminder}) { const [rows, setRows] = React.useState(recordList); const [rowModesModel] = React.useState({}); const userData = getUserData(); const ability = useContext(AbilityContext); const handleSuppressClick = (id) => () => { axios.post(`${apiPath}${POST_TODO_MARK_SUPPRESS}/${id}/${userData.id}`,{ }) .then((response) => { if (response.status === 200) { fetchList(value); notifySaveSuccess(); } }) .catch(error => { console.log(error); return false; }); }; const handleReadClick = (id) => () => { axios.post(`${apiPath}${POST_TODO_MARK_READ}/${id}/${userData.id}`,{ }) .then((response) => { if (response.status === 200) { setRows(rows.filter((row) => row.id !== id)); notifySaveSuccess(); } }) .catch(error => { console.log(error); return false; }); }; // const getRowHeight = (params) => { // const message = params.model.message; // Assuming the 'message' field is present in the data // const lines = message.split("\\n").length; // // const SINGLE_LINE_HEIGHT = 40; // const HEIGHT_WITH_PADDING = 20; // const LINE_HEIGHT = 24; // Adjust this value based on your font size and row padding // const height = lines < 2 ? SINGLE_LINE_HEIGHT : HEIGHT_WITH_PADDING*2 + (LINE_HEIGHT * (lines-2) ); // console.log(height); // return height <= SINGLE_LINE_HEIGHT ? SINGLE_LINE_HEIGHT : height; // }; const columns = [ { id: 'title', field: 'title', headerName: 'Title', //headerAlign: 'center', //align: 'center', flex: 2, renderCell: (params) => { return (