mirror of
https://github.com/embarklabs/embark.git
synced 2025-02-20 01:18:52 +00:00
refactor(embark-ui): filter silent contracts from contracts listings (#1444)
Filter silent contracts in the views that display contracts lists rather than with `formatContractForDisplay` because the old approach prevents interaction with a silent contract if a link to it is followed from the blocks or transactions explorer, which is not desirable.
This commit is contained in:
parent
9afdbd9848
commit
f60c979c75
@ -15,7 +15,9 @@ const Contracts = ({contracts, title = "Contracts"}) => (
|
|||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardBody>
|
<CardBody>
|
||||||
{
|
{
|
||||||
contracts.map((contract, key) => {
|
contracts
|
||||||
|
.filter(contract => !contract.silent)
|
||||||
|
.map((contract, key) => {
|
||||||
const contractDisplay = formatContractForDisplay(contract);
|
const contractDisplay = formatContractForDisplay(contract);
|
||||||
if (!contractDisplay) {
|
if (!contractDisplay) {
|
||||||
return '';
|
return '';
|
||||||
|
@ -15,7 +15,9 @@ const ContractsList = ({contracts}) => (
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{
|
{
|
||||||
contracts.map((contract) => {
|
contracts
|
||||||
|
.filter(contract => !contract.silent)
|
||||||
|
.map((contract) => {
|
||||||
const contractDisplay = formatContractForDisplay(contract);
|
const contractDisplay = formatContractForDisplay(contract);
|
||||||
if (!contractDisplay) {
|
if (!contractDisplay) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
export function formatContractForDisplay(contract) {
|
export function formatContractForDisplay(contract) {
|
||||||
if (contract.silent) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let address = (contract.address || contract.deployedAddress);
|
let address = (contract.address || contract.deployedAddress);
|
||||||
let state = 'Deployed';
|
let state = 'Deployed';
|
||||||
let stateColor = 'success';
|
let stateColor = 'success';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user