mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-29 00:16:39 +01:00
fix duplicate and delete row buttons not showing for read-only tables even for admins
This commit is contained in:
@@ -6,6 +6,7 @@ import CopyCellsIcon from "@src/assets/icons/CopyCells";
|
||||
import DeleteIcon from "@mui/icons-material/DeleteOutlined";
|
||||
|
||||
import { useConfirmation } from "@src/components/ConfirmationDialog/Context";
|
||||
import { useAppContext } from "@src/contexts/AppContext";
|
||||
import { useProjectContext } from "@src/contexts/ProjectContext";
|
||||
import useKeyPress from "@src/hooks/useKeyPress";
|
||||
|
||||
@@ -27,6 +28,7 @@ const useStyles = makeStyles((theme) =>
|
||||
export default function FinalColumn({ row }: FormatterProps<any, any>) {
|
||||
useStyles();
|
||||
|
||||
const { userClaims } = useAppContext();
|
||||
const { requestConfirmation } = useConfirmation();
|
||||
const { deleteRow, addRow, table } = useProjectContext();
|
||||
const altPress = useKeyPress("Alt");
|
||||
@@ -35,7 +37,8 @@ export default function FinalColumn({ row }: FormatterProps<any, any>) {
|
||||
if (deleteRow) deleteRow(row.id);
|
||||
};
|
||||
|
||||
if (table?.readOnly) return null;
|
||||
if (!userClaims?.roles.includes("ADMIN") && table?.readOnly === true)
|
||||
return null;
|
||||
|
||||
return (
|
||||
<Stack direction="row" spacing={0.5}>
|
||||
|
||||
Reference in New Issue
Block a user