Skip to content

Commit

Permalink
chore: prevent unchecking all chains in checkout (#3335)
Browse files Browse the repository at this point in the history
fixes #3190
  • Loading branch information
thelostone-mc authored Apr 22, 2024
1 parent cc0092b commit bf72647
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export function ChainConfirmationModalBody({
const getVotingTokenForChain = useCartStorage(
(state) => state.getVotingTokenForChain
);

return (
<>
<p className="text-sm text-grey-400">
Expand All @@ -52,6 +53,7 @@ export function ChainConfirmationModalBody({
selectedPayoutToken={getVotingTokenForChain(chainId)}
totalDonation={totalDonationsPerChain[chainId]}
checked={chainIdsBeingCheckedOut.includes(chainId)}
chainsBeingCheckedOut={chainIdsBeingCheckedOut.length}
onChange={(checked) =>
handleChainCheckboxChange(chainId, checked)
}
Expand All @@ -68,6 +70,7 @@ type ChainSummaryProps = {
selectedPayoutToken: VotingToken;
chainId: ChainId;
checked: boolean;
chainsBeingCheckedOut: number;
onChange: (checked: boolean) => void;
isLastItem: boolean;
};
Expand All @@ -77,9 +80,11 @@ export function ChainSummary({
totalDonation,
chainId,
checked,
chainsBeingCheckedOut,
onChange,
isLastItem,
}: ChainSummaryProps) {

return (
<div
className={`flex flex-col justify-center mt-2 font-semibold ${
Expand All @@ -89,8 +94,11 @@ export function ChainSummary({
<p>
<input
type="checkbox"
className="mr-2 rounded-sm"
className={`mr-2 rounded-sm ${
chainsBeingCheckedOut === 1 ? "invisible" : ""
}`}
checked={checked}
disabled={chainsBeingCheckedOut === 1}
onChange={(e) => onChange(e.target.checked)}
/>
<img
Expand Down

0 comments on commit bf72647

Please sign in to comment.