Skip to content

Commit

Permalink
fix: proposal table component propagation
Browse files Browse the repository at this point in the history
  • Loading branch information
poomthiti committed May 11, 2023
1 parent 56b526c commit a71392a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Bug fixes

- [#330](https://github.com/alleslabs/celatone-frontend/pull/330) Fix proposal table component propagation

## v1.0.4

### Bug fixes
Expand Down
8 changes: 8 additions & 0 deletions src/lib/components/StopPropagationBox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Box } from "@chakra-ui/react";
import type { ReactNode } from "react";

export const StopPropagationBox = ({ children }: { children: ReactNode }) => (
<Box onClick={(e) => e.stopPropagation()} cursor="initial">
{children}
</Box>
);
2 changes: 2 additions & 0 deletions src/lib/components/table/proposals/VotingEndTime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export const VotingEndTime = ({
fontSize: "12px",
},
}}
onClick={(e) => e.stopPropagation()}
cursor="initial"
>
<p>{isDepositPeriod ? "Voting not started" : formatUTC(votingEndTime)}</p>
<p>
Expand Down
2 changes: 2 additions & 0 deletions src/lib/pages/proposals/components/ProposalTextCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ export const ProposalTextCell = ({
maxW={showName ? undefined : "full"}
onMouseOver={() => setIsHoverText(true)}
onMouseOut={() => setIsHoverText(false)}
onClick={(e) => e.stopPropagation()}
cursor="initial"
>
<Text
ref={titleRef}
Expand Down
19 changes: 12 additions & 7 deletions src/lib/pages/proposals/table/ProposalTableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useWallet } from "@cosmos-kit/react";
import { ProposalTextCell } from "../components/ProposalTextCell";
import { getExplorerProposalUrl } from "lib/app-fns/explorer";
import { ExplorerLink } from "lib/components/ExplorerLink";
import { StopPropagationBox } from "lib/components/StopPropagationBox";
import { TableRow, TableRowFreeze } from "lib/components/table";
import { Proposer } from "lib/components/table/proposals/Proposer";
import { ResolvedHeight } from "lib/components/table/proposals/ResolvedHeight";
Expand Down Expand Up @@ -84,7 +85,9 @@ export const ProposalTableRow = ({
/>
</TableRowFreeze>
<TableRow justifyContent="center">
<StatusChip status={proposal.status} />
<StopPropagationBox>
<StatusChip status={proposal.status} />
</StopPropagationBox>
</TableRow>
<TableRow>
<VotingEndTime
Expand All @@ -94,12 +97,14 @@ export const ProposalTableRow = ({
/>
</TableRow>
<TableRow>
<ResolvedHeight
resolvedHeight={proposal.resolvedHeight}
isDepositFailed={isDepositFailed}
isDepositOrVoting={isDepositOrVoting}
amptrackSection="proposal-list"
/>
<StopPropagationBox>
<ResolvedHeight
resolvedHeight={proposal.resolvedHeight}
isDepositFailed={isDepositFailed}
isDepositOrVoting={isDepositOrVoting}
amptrackSection="proposal-list"
/>
</StopPropagationBox>
</TableRow>
<TableRow>
<Proposer
Expand Down

0 comments on commit a71392a

Please sign in to comment.