react-icons/fa#FaHourglass TypeScript Examples

The following examples show how to use react-icons/fa#FaHourglass. 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: pending-button.tsx    From polkabtc-ui with Apache License 2.0 6 votes vote down vote up
ButtonMaybePending = ({
  isPending,
  disabled,
  children,
  ...rest
}: Props & ButtonProps): JSX.Element => (
  <Button
    disabled={isPending || disabled}
    {...rest}>
    {(isPending && <FaHourglass className='inline-block' />) || children}
  </Button>
)
Example #2
Source File: IssueRequests.tsx    From polkabtc-ui with Apache License 2.0 4 votes vote down vote up
function IssueRequests(): JSX.Element {
  const { address, extensions } = useSelector((state: StoreType) => state.general);
  const issueRequests = useSelector((state: StoreType) => state.issue.issueRequests).get(address) || [];
  const [issueModalOpen, setIssueModalOpen] = useState(false);
  const dispatch = useDispatch();
  const { t } = useTranslation();

  const handleIssueModalClose = () => {
    setIssueModalOpen(false);
  };

  const openWizard = () => {
    if (extensions.length && address) {
      setIssueModalOpen(true);
    } else {
      dispatch(showAccountModalAction(true));
    }
  };

  const handleCompleted = (status: IssueRequestStatus) => {
    switch (status) {
    case IssueRequestStatus.RequestedRefund:
    case IssueRequestStatus.Completed: {
      return <FaCheck className='inline-block' />;
    }
    case IssueRequestStatus.Cancelled:
    case IssueRequestStatus.Expired: {
      return (
        <Badge
          className='badge-style'
          variant='secondary'>
          {t('cancelled')}
        </Badge>
      );
    }
    default: {
      return <FaHourglass className='inline-block' />;
    }
    }
  };

  const requestClicked = (request: IssueRequest): void => {
    dispatch(changeIssueIdAction(request.id));
    openWizard();
  };

  return (
    <div
      className={clsx(
        'container',
        'mt-12',
        'mx-auto',
        'text-center'
      )}>
      {issueRequests?.length > 0 && (
        <>
          <h5
            className={clsx(
              'font-bold',
              'text-xl',
              'mb-2'
            )}>
            {t('issue_requests')}
          </h5>
          <p className='mb-4'>
            {t('issue_page.click_on_issue_request')}
          </p>
          <Table
            hover
            responsive
            size='md'>
            <thead>
              <tr>
                <th>{t('issue_page.updated')}</th>
                <th>{t('issue_page.amount')}</th>
                <th>{t('issue_page.btc_transaction')}</th>
                <th>{t('issue_page.confirmations')}</th>
                <th>{t('status')}</th>
              </tr>
            </thead>
            <tbody>
              {issueRequests.map((request: IssueRequest, index: number) => {
                return (
                  <tr
                    key={index}
                    onClick={() => requestClicked(request)}
                    className='table-row-opens-modal'>
                    <td>
                      {request.timestamp ?
                        formatDateTimePrecise(new Date(Number(request.timestamp))) :
                        t('pending')}
                    </td>
                    <td>
                      {request.issuedAmountBtc || request.requestedAmountPolkaBTC}{' '}
                      <span className='grey-text'>PolkaBTC</span>
                    </td>
                    <td>
                      <BitcoinTransaction
                        txId={request.btcTxId}
                        shorten />
                    </td>
                    <td>
                      {request.btcTxId === '' ?
                        t('not_applicable') :
                        Math.max(request.confirmations, 0)}
                    </td>
                    <td>{handleCompleted(request.status)}</td>
                  </tr>
                );
              })}
            </tbody>
          </Table>
          <IssueModal
            open={issueModalOpen}
            onClose={handleIssueModalClose} />
        </>
      )}
    </div>
  );
}
Example #3
Source File: RedeemRequests.tsx    From polkabtc-ui with Apache License 2.0 4 votes vote down vote up
export default function RedeemRequests(): ReactElement {
  const { address } = useSelector((state: StoreType) => state.general);
  const redeemRequests = useSelector((state: StoreType) => state.redeem.redeemRequests).get(address);
  const [showModal, setShowModal] = useState(false);
  const dispatch = useDispatch();
  const { t } = useTranslation();

  const closeModal = () => setShowModal(false);

  const handleStatusColumn = (request: RedeemRequest) => {
    switch (request.status) {
    case RedeemRequestStatus.Reimbursed: {
      return <div>{t('redeem_page.reimbursed')}</div>;
    }
    case RedeemRequestStatus.Expired: {
      return <div>{t('redeem_page.recover')}</div>;
    }
    case RedeemRequestStatus.Retried: {
      return <div>{t('redeem_page.retried')}</div>;
    }
    case RedeemRequestStatus.Completed: {
      return <FaCheck className='inline-block' />;
    }
    default: {
      return <FaHourglass className='inline-block' />;
    }
    }
  };

  const requestClicked = (request: RedeemRequest): void => {
    dispatch(changeRedeemIdAction(request.id));
    setShowModal(true);
  };

  return (
    <div
      className={clsx(
        'container',
        'mt-12',
        'mx-auto',
        'text-center'
      )}>
      {redeemRequests && redeemRequests.length > 0 && (
        <>
          <h5
            className={clsx(
              'font-bold',
              'text-xl',
              'mb-2'
            )}>
            {t('redeem_requests')}
          </h5>
          <Table
            hover
            responsive
            size='md'>
            <thead>
              <tr>
                <th>{t('issue_page.updated')}</th>
                <th>{t('issue_page.amount')}</th>
                <th>{t('issue_page.btc_transaction')}</th>
                <th>{t('issue_page.confirmations')}</th>
                <th>{t('status')}</th>
              </tr>
            </thead>
            <tbody>
              {redeemRequests &&
                redeemRequests.map(request => {
                  return (
                    <tr
                      key={request.id}
                      onClick={() => requestClicked(request)}
                      className='table-row-opens-modal'>
                      <td>
                        {request.timestamp ?
                          formatDateTimePrecise(new Date(Number(request.timestamp))) :
                          t('pending')}
                      </td>
                      <td>
                        {request.amountPolkaBTC}{' '}
                        <span className='grey-text'>PolkaBTC</span>
                      </td>
                      <td>
                        {request.status === RedeemRequestStatus.Expired ? (
                          <div>{t('redeem_page.failed')}</div>
                        ) : (
                          <BitcoinTransaction
                            txId={request.btcTxId}
                            shorten />
                        )}
                      </td>
                      <td>
                        {request.btcTxId === '' ?
                          t('not_applicable') :
                          Math.max(request.confirmations, 0)}
                      </td>
                      <td>{handleStatusColumn(request)}</td>
                    </tr>
                  );
                })}
            </tbody>
          </Table>
        </>
      )}
      <RedeemModal
        show={showModal}
        onClose={closeModal} />
    </div>
  );
}