Files
Checkmate/client/src/Pages/Account/components/RoleTable/index.jsx
T

44 lines
957 B
React
Raw Normal View History

2025-07-22 12:27:06 -07:00
import Typography from "@mui/material/Typography";
2025-09-27 14:54:55 -07:00
import DataTable from "@/Components/v1/Table/index.jsx";
import Icon from "@/Components/v1/Icon";
2025-07-22 12:27:06 -07:00
import { useTranslation } from "react-i18next";
2026-01-12 23:57:39 +00:00
import { ROLES } from "../../../../Utils/roleUtils.js";
2025-07-22 12:27:06 -07:00
const RoleTable = ({ roles, handleDeleteRole }) => {
const { t } = useTranslation();
const HEADERS = [
{
id: "name",
content: <Typography>{t("editUserPage.table.roleHeader")}</Typography>,
render: (row) => {
return row;
},
},
{
id: "delete",
content: <Typography>{t("editUserPage.table.actionHeader")}</Typography>,
render: (row) => {
if (row === ROLES.SUPERADMIN) return null;
return (
<Icon
name="Trash2"
size={20}
2025-07-22 12:27:06 -07:00
onClick={() => {
handleDeleteRole(row);
}}
style={{ cursor: "pointer" }}
2025-07-22 12:27:06 -07:00
/>
);
},
},
];
return (
<DataTable
headers={HEADERS}
data={roles}
/>
);
};
export default RoleTable;