Skip to content

Commit 4a4b27e

Browse files
fix(web): ensure-chain-and-close-on-icon-click
1 parent 7599a23 commit 4a4b27e

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

web/src/pages/Cases/CaseDetails/MaintenanceButtons/MenuButton.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ const StyledDottedMenu = styled(DottedMenu)`
6868
`;
6969

7070
interface IMenuButton {
71-
setIsOpen: (open: boolean) => void;
71+
toggle: () => void;
7272
displayRipple: boolean;
7373
}
7474

75-
const MenuButton: React.FC<IMenuButton> = ({ setIsOpen, displayRipple }) => {
75+
const MenuButton: React.FC<IMenuButton> = ({ toggle, displayRipple }) => {
7676
return (
7777
<Container {...{ displayRipple }}>
7878
<ButtonContainer>
79-
<StyledDottedMenu onClick={() => setIsOpen(true)} />
79+
<StyledDottedMenu onClick={toggle} />
8080
</ButtonContainer>
8181
</Container>
8282
);

web/src/pages/Cases/CaseDetails/MaintenanceButtons/index.tsx

+16-10
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ import { useDisputeDetailsQuery } from "queries/useDisputeDetailsQuery";
88
import { Periods } from "src/consts/periods";
99
import { Period } from "src/graphql/graphql";
1010

11+
import { EnsureChain } from "components/EnsureChain";
1112
import { Overlay } from "components/Overlay";
1213

13-
import DistributeRewards from "./DistributeRewads";
14+
import DistributeRewards from "./DistributeRewards";
1415
import DrawButton from "./DrawButton";
1516
import ExecuteRulingButton from "./ExecuteRuling";
1617
import MenuButton from "./MenuButton";
@@ -86,24 +87,29 @@ const MaintenanceButtons: React.FC = () => {
8687
return () => clearInterval(intervalId);
8788
}, [dispute]);
8889

90+
const toggle = () => setIsOpen((prevValue) => !prevValue);
8991
return (
9092
<Container>
9193
{isOpen ? (
9294
<>
9395
<Overlay onClick={() => setIsOpen(false)} />
9496
<PopupContainer>
95-
<DrawButton {...{ id, setIsOpen }} numberOfVotes={dispute?.currentRound.nbVotes} />
96-
<PassPeriodButton {...{ id, setIsOpen }} />
97-
<DistributeRewards
98-
{...{ id, setIsOpen }}
99-
roundIndex={dispute?.currentRoundIndex}
100-
numberOfVotes={dispute?.currentRound.nbVotes}
101-
/>
102-
<ExecuteRulingButton {...{ id, setIsOpen }} />
97+
<EnsureChain>
98+
<>
99+
<DrawButton {...{ id, setIsOpen }} numberOfVotes={dispute?.currentRound.nbVotes} />
100+
<PassPeriodButton {...{ id, setIsOpen }} />
101+
<DistributeRewards
102+
{...{ id, setIsOpen }}
103+
roundIndex={dispute?.currentRoundIndex}
104+
numberOfVotes={dispute?.currentRound.nbVotes}
105+
/>
106+
<ExecuteRulingButton {...{ id, setIsOpen }} />
107+
</>
108+
</EnsureChain>
103109
</PopupContainer>
104110
</>
105111
) : null}
106-
<MenuButton {...{ setIsOpen, displayRipple }} />
112+
<MenuButton {...{ toggle, displayRipple }} />
107113
</Container>
108114
);
109115
};

0 commit comments

Comments
 (0)