@material-ui/icons#MergeType JavaScript Examples

The following examples show how to use @material-ui/icons#MergeType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Account.js    From web-wallet with Apache License 2.0 4 votes vote down vote up
function Account () {
  const dispatch = useDispatch();
  const isSynced = useSelector(selectIsSynced);
  const childBalance = useSelector(selectChildchainBalance, isEqual);
  const rootBalance = useSelector(selectRootchainBalance, isEqual);
  const pendingExits = useSelector(selectPendingExits, isEqual);
  const transactions = useSelector(selectChildchainTransactions, isEqual);
  const criticalTransactionLoading = useSelector(selectLoading([ 'EXIT/CREATE' ]));

  const exitPending = useMemo(() => pendingExits.some(i => i.status === 'Pending'), [ pendingExits ]);
  const transferPending = useMemo(() => transactions.some(i => i.status === 'Pending'), [ transactions ]);
  const disabled = !childBalance.length || !isSynced || exitPending || transferPending;

  const handleModalClick = useCallback(
    (name) => dispatch(openModal(name)),
    [ dispatch ]
  );

  return (
    <div className={styles.Account}>
      <h2>Account</h2>
      <div className={styles.wallet}>
        <span className={styles.address}>{`Wallet Address : ${networkService.account ? truncate(networkService.account, 6, 4, '...') : ''}`}</span>
        <Copy value={networkService.account} />
      </div>

      <div className={styles.balances}>
        <div className={styles.box}>
          <div className={styles.header}>
            <div className={styles.title}>
              <span>Balance on Childchain</span>
              <span>OMG Network</span>
            </div>
            <div className={styles.actions}>
              <div
                onClick={() => handleModalClick('mergeModal')}
                className={[
                  styles.transfer,
                  (disabled || criticalTransactionLoading) ? styles.disabled : ''
                ].join(' ')}
              >
                <MergeType />
                <span>Merge</span>
              </div>
              <div
                onClick={() => handleModalClick('transferModal')}
                className={[
                  styles.transfer,
                  (disabled || criticalTransactionLoading) ? styles.disabled : ''
                ].join(' ')}
              >
                <Send />
                <span>Transfer</span>
              </div>
            </div>
          </div>
          {childBalance.map((i, index) => {
            return (
              <div key={index} className={styles.row}>
                <div className={styles.token}>
                  <span className={styles.symbol}>{i.name}</span>
                </div>
                <span>{logAmount(i.amount, i.decimals)}</span>
              </div>
            );
          })}
          <div className={styles.buttons}>
            <Button
              onClick={() => handleModalClick('depositModal')}
              type='primary'
              disabled={!isSynced}
            >
              DEPOSIT
            </Button>
            <Button
              onClick={() => handleModalClick('exitModal')}
              type='secondary'
              disabled={disabled}
            >
              EXIT
            </Button>
          </div>
        </div>

        <div className={styles.box}>
          <div className={styles.header}>
            <div className={styles.title}>
              <span>Balance on Rootchain</span>
              <span>Ethereum Network</span>
            </div>
          </div>

          {rootBalance.map((i, index) => {
            return (
              <div key={index} className={styles.row}>
                <div className={styles.token}>
                  <span className={styles.symbol}>{i.name}</span>
                </div>
                <span>{logAmount(i.amount, i.decimals)}</span>
              </div>
            );
          })}
        </div>
      </div>
    </div>
  );
}