Add conditional rendering for null accountOnChain

This commit is contained in:
abefernan
2023-04-24 22:42:21 +02:00
parent 11499f078c
commit dfe68ccb89
+43 -35
View File
@@ -111,35 +111,35 @@ const Multipage = () => {
</div>
</StackableContainer>
)}
{txView === "send" && (
{txView === "send" && accountOnChain && (
<TransactionForm
address={multisigAddress}
accountOnChain={accountOnChain}
closeForm={closeForm}
/>
)}
{txView === "delegate" && (
{txView === "delegate" && accountOnChain && (
<DelegationForm
delegatorAddress={multisigAddress}
accountOnChain={accountOnChain}
closeForm={closeForm}
/>
)}
{txView === "undelegate" && (
{txView === "undelegate" && accountOnChain && (
<UnDelegationForm
delegatorAddress={multisigAddress}
accountOnChain={accountOnChain}
closeForm={closeForm}
/>
)}
{txView === "redelegate" && (
{txView === "redelegate" && accountOnChain && (
<ReDelegationForm
delegatorAddress={multisigAddress}
accountOnChain={accountOnChain}
closeForm={closeForm}
/>
)}
{txView === "claimRewards" && (
{txView === "claimRewards" && accountOnChain && (
<RewardsForm
delegatorAddress={multisigAddress}
accountOnChain={accountOnChain}
@@ -158,36 +158,44 @@ const Multipage = () => {
Once a transaction is created, it can be signed by the multisig members, and then
broadcast.
</p>
<Button
label="Create Transaction"
onClick={() => {
setTxView("send");
}}
/>
<Button
label="Create Delegation"
onClick={() => {
setTxView("delegate");
}}
/>
<Button
label="Create UnDelegation"
onClick={() => {
setTxView("undelegate");
}}
/>
<Button
label="Create Redelegate"
onClick={() => {
setTxView("redelegate");
}}
/>
<Button
label="Claim Rewards"
onClick={() => {
setTxView("claimRewards");
}}
/>
{accountOnChain ? (
<>
<Button
label="Create Transaction"
onClick={() => {
setTxView("send");
}}
/>
<Button
label="Create Delegation"
onClick={() => {
setTxView("delegate");
}}
/>
<Button
label="Create UnDelegation"
onClick={() => {
setTxView("undelegate");
}}
/>
<Button
label="Create Redelegate"
onClick={() => {
setTxView("redelegate");
}}
/>
<Button
label="Claim Rewards"
onClick={() => {
setTxView("claimRewards");
}}
/>
</>
) : (
<p>
An account needs to be present on the multisig before creating a transaction.
</p>
)}
</StackableContainer>
</div>
</div>