Skip to content

Commit

Permalink
Merge pull request #297 from dappnode/mateu/disable-edit-FR-when-nonE…
Browse files Browse the repository at this point in the history
…ditableFRValidator-selected

Disabling edit FR btn when all selected validators are not editable
  • Loading branch information
Marketen authored Feb 25, 2024
2 parents 8cc8c44 + aee1f3b commit 13400b9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/ui/src/components/ValidatorList/KeystoresDataGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
MAINNET_ORACLE_URL,
TESTNET_ORACLE_URL,
SmoothValidator,
nonEditableFeeRecipientTags,
NonEditableFeeRecipientTag,
} from "@stakingbrain/common";
import SmoothStatus from "./SmoothStatus";
import { GridColDef } from "@mui/x-data-grid";
Expand Down Expand Up @@ -453,6 +455,15 @@ export default function KeystoresDataGrid({
);
}

function areAllSelectedRowsUneditable() {
return selectedRows.every((row) => {
const tag = rows[row as number].tag;
return nonEditableFeeRecipientTags.includes(
tag as NonEditableFeeRecipientTag
);
});
}

return (
<>
<div style={{ display: "flex", justifyContent: "space-between" }}>
Expand All @@ -479,7 +490,7 @@ export default function KeystoresDataGrid({

<Tooltip title="Edit validators fee recipient">
<IconButton
disabled={!areRowsSelected}
disabled={!areRowsSelected || areAllSelectedRowsUneditable()}
onClick={() => setEditFeesOpen(true)}
>
<EditIcon />
Expand Down

0 comments on commit 13400b9

Please sign in to comment.