diff --git a/components/dataViews/CompletedTransaction.tsx b/components/dataViews/CompletedTransaction.tsx index 8a4d4f4..a8ca3c7 100644 --- a/components/dataViews/CompletedTransaction.tsx +++ b/components/dataViews/CompletedTransaction.tsx @@ -1,10 +1,8 @@ -import React from "react"; - +import { useAppContext } from "../../context/AppContext"; +import { explorerLinkTx } from "../../lib/displayHelpers"; +import Button from "../inputs/Button"; import StackableContainer from "../layout/StackableContainer"; import HashView from "./HashView"; -import Button from "../inputs/Button"; -import { explorerLinkTx } from "../../lib/displayHelpers"; -import { useAppContext } from "../../context/AppContext"; interface Props { transactionHash: string; @@ -21,7 +19,7 @@ const CompletedTransaction = ({ transactionHash }: Props) => { -

This transaction has been broadcast.

+

This transaction has been broadcast

diff --git a/components/dataViews/CopyAndPaste.tsx b/components/dataViews/CopyAndPaste.tsx index fb0276a..e89c8d2 100644 --- a/components/dataViews/CopyAndPaste.tsx +++ b/components/dataViews/CopyAndPaste.tsx @@ -1,4 +1,3 @@ -import React from "react"; import copy from "copy-to-clipboard"; interface Props { @@ -26,6 +25,7 @@ const CopyAndPaste = (props: Props) => ( .icon { cursor: pointer; + line-height: 0; } .icon:hover path { diff --git a/components/dataViews/ThresholdInfo.tsx b/components/dataViews/ThresholdInfo.tsx index 676e167..0271e0c 100644 --- a/components/dataViews/ThresholdInfo.tsx +++ b/components/dataViews/ThresholdInfo.tsx @@ -1,52 +1,72 @@ -import React from "react"; import { MultisigThresholdPubkey } from "@cosmjs/amino"; - +import { useEffect, useState } from "react"; import { DbSignature } from "../../types"; import StackableContainer from "../layout/StackableContainer"; +import CopyAndPaste from "./CopyAndPaste"; interface Props { signatures: DbSignature[]; pubkey: MultisigThresholdPubkey; } -const ThresholdInfo = ({ signatures, pubkey }: Props) => ( - -

Signatures

- -

- Once the number of required signatures have been created, this transaction will be ready to - broadcast. -

-
- -
-
{signatures.length}
-
of
-
{pubkey.value.threshold}
-
signatures complete
-
-
- -
-); +const ThresholdInfo = ({ signatures, pubkey }: Props) => { + const [urlToCopy, setUrlToCopy] = useState(""); + + useEffect(() => { + const urlWithoutQuery = window.location.href.split("?")[0]; + setUrlToCopy(urlWithoutQuery); + }, []); + + const remainingSignatures = Number(pubkey.value.threshold) - signatures.length; + if (!remainingSignatures) return null; + + return ( + <> + +
+
{signatures.length}
+
of
+
{pubkey.value.threshold}
+
signatures complete
+
+ +

+ {remainingSignatures} remaining {remainingSignatures > 1 ? "signatures" : "signature"}{" "} + before this transaction can be broadcast +

+
+ +
+ +

+ Copy the current URL and share it with the other members in the multisig so they can + sign it +

+
+
+
+ + + ); +}; export default ThresholdInfo; diff --git a/components/dataViews/TransactionInfo/TxMsgClaimRewardsDetails.tsx b/components/dataViews/TransactionInfo/TxMsgClaimRewardsDetails.tsx index 85357e3..9ecdd65 100644 --- a/components/dataViews/TransactionInfo/TxMsgClaimRewardsDetails.tsx +++ b/components/dataViews/TransactionInfo/TxMsgClaimRewardsDetails.tsx @@ -8,7 +8,7 @@ interface TxMsgClaimRewardsDetailsProps { const TxMsgClaimRewardsDetails = ({ msg }: TxMsgClaimRewardsDetailsProps) => ( <>
  • -

    MsgWithdrawDelegatorReward

    +

    MsgWithdrawDelegatorReward

  • @@ -17,7 +17,7 @@ const TxMsgClaimRewardsDetails = ({ msg }: TxMsgClaimRewardsDetailsProps) => (
  • -
    + ); }; diff --git a/pages/multi/[address]/transaction/[transactionID].tsx b/pages/multi/[address]/transaction/[transactionID].tsx index 3c944ed..51d2442 100644 --- a/pages/multi/[address]/transaction/[transactionID].tsx +++ b/pages/multi/[address]/transaction/[transactionID].tsx @@ -141,48 +141,51 @@ const TransactionPage = ({ } }; + const isThresholdMet = pubkey + ? currentSignatures.length >= Number(pubkey.value.threshold) + : false; + return (

    {transactionHash ? "Completed Transaction" : "In Progress Transaction"}

    - {accountError && ( + {accountError ? (

    Multisig address could not be found.

    - )} - {transactionHash && } - - {!transactionHash && pubkey && ( - - )} - {pubkey && - currentSignatures.length >= parseInt(pubkey.value.threshold, 10) && - !transactionHash && ( - <> -