Skip to content

Commit

Permalink
fix(proposals): voting error, ui (#1307)
Browse files Browse the repository at this point in the history
  • Loading branch information
happylolonly authored Sep 27, 2024
1 parent 90ceb8f commit ccb5108
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
14 changes: 11 additions & 3 deletions src/containers/governance/actionBarDatail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
BASE_DENOM,
MEMO_KEPLR,
} from 'src/constants/config';
import useCurrentAddress from 'src/hooks/useCurrentAddress';
import {
TransactionSubmitted,
Confirmed,
Expand Down Expand Up @@ -44,7 +45,13 @@ const {
STAGE_ERROR,
} = LEDGER;

function ActionBarDetail({ proposals, id, addressActive, update }) {
type Props = {
proposals: any;
id: number;
update: () => void;
};

function ActionBarDetail({ proposals, id, update }: Props) {
const queryClient = useQueryClient();
const { signer, signingClient } = useSigningClient();
const [stage, setStage] = useState(STAGE_INIT);
Expand All @@ -54,6 +61,8 @@ function ActionBarDetail({ proposals, id, addressActive, update }) {
const [valueSelect, setValueSelect] = useState(1);
const [valueDeposit, setValueDeposit] = useState('');

const addressActive = useCurrentAddress();

useEffect(() => {
const confirmTx = async () => {
if (queryClient && txHash !== null) {
Expand Down Expand Up @@ -100,7 +109,7 @@ function ActionBarDetail({ proposals, id, addressActive, update }) {
if (signingClient && signer && Object.keys(proposals).length > 0) {
try {
const [{ address }] = await signer.getAccounts();
if (addressActive !== null && addressActive.bech32 === address) {
if (addressActive === address) {
let response = {};
const fee = {
amount: [],
Expand Down Expand Up @@ -134,7 +143,6 @@ function ActionBarDetail({ proposals, id, addressActive, update }) {
);
}

console.log(`response`, response);
if (response.code === 0) {
setTxHash(response.transactionHash);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { ProposalStatus } from 'cosmjs-types/cosmos/gov/v1beta1/gov';
import { useGovParam } from 'src/hooks/governance/params/useGovParams';
import { useAppSelector } from 'src/redux/hooks';
import {
Account,
ActionBar,
ContainerGradientText,
IconStatus,
Expand Down Expand Up @@ -180,7 +181,7 @@ function ProposalsDetail() {
return (
<>
<MainContainer>
<Pane display="flex" alignItems="center">
<Pane display="flex" alignItems="center" marginBottom={20}>
<Text fontSize="25px" color="#fff">
{proposals.title && ` #${proposalId} ${proposals.title}`}
</Text>
Expand All @@ -190,16 +191,22 @@ function ProposalsDetail() {
<IconStatus status={proposals.status} text marginRight={8} />
</Pane>
)}
<br />
<ContainerGradientText>
<Item
marginBottom={15}
title="Proposer"
value={
<Link to={`/network/bostrom/contract/${proposals.proposer}`}>
{proposals.proposer}
</Link>
}
/>
{/* fix, should be something */}
{proposals.proposer && (
<Item
marginBottom={15}
title="Proposer"
value={
// <Link to={`/network/bostrom/contract/${proposals.proposer}`}>
// {proposals.proposer}
// </Link>

<Account address={proposals.proposer} avatar />
}
/>
)}
{proposals.type && (
<Item
marginBottom={15}
Expand Down

0 comments on commit ccb5108

Please sign in to comment.