@material-ui/icons#AccessTime TypeScript Examples

The following examples show how to use @material-ui/icons#AccessTime. 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: TxResultRenderer.tsx    From anchor-web-app with Apache License 2.0 4 votes vote down vote up
export function TxResultRenderer({
  resultRendering,
  onExit,
  minimizable,
  onMinimize,
}: TxResultRendererProps) {
  const {
    dimTextColor,
    colors: { primary },
  } = useTheme();

  const {
    phase,
    message = 'Waiting for Terra Station...',
    description = 'Transaction broadcasted. There is no need to send another until it has been complete.',
    failedReason,
  } = resultRendering;

  const handleMinimize = useCallback(() => {
    onMinimize?.();
    onExit?.();
  }, [onExit, onMinimize]);

  switch (phase) {
    case TxStreamPhase.POST:
      return (
        <Layout>
          <article>
            <figure data-state={phase}>
              <PushSpinner color={dimTextColor} />
            </figure>

            <h2>{message}</h2>

            <Receipts resultRendering={resultRendering} />

            <SubmitButton onClick={() => onExit?.()}>Stop</SubmitButton>
          </article>
        </Layout>
      );
    case TxStreamPhase.BROADCAST:
      return (
        <Layout>
          <article>
            <figure data-state={phase}>
              <GuardSpinner frontColor={primary} />
            </figure>

            <h2>
              <span>{message}</span>
              <p>{description}</p>
            </h2>

            <Receipts resultRendering={resultRendering} />
            {minimizable && (
              <Container direction="row" gap={10}>
                <ActionButton
                  className="minimize-button"
                  onClick={handleMinimize}
                >
                  Minimize
                </ActionButton>
              </Container>
            )}
          </article>
        </Layout>
      );
    case TxStreamPhase.SUCCEED:
      return (
        <Layout>
          <article>
            <figure data-state={phase}>
              <DoneIcon />
            </figure>

            <h2>Complete!</h2>

            <Receipts resultRendering={resultRendering} />

            <SubmitButton onClick={() => onExit?.()}>OK</SubmitButton>
          </article>
        </Layout>
      );
    case TxStreamPhase.FAILED:
      return (
        <Layout>
          <article>
            {failedReason?.error instanceof PollingTimeout ? (
              <figure data-state={TxStreamPhase.SUCCEED}>
                <AccessTime />
              </figure>
            ) : (
              <figure data-state={phase}>
                <Close />
              </figure>
            )}

            {failedReason && renderTxFailedReason(failedReason)}

            <Receipts resultRendering={resultRendering} />

            <SubmitButton onClick={() => onExit?.()}>OK</SubmitButton>
          </article>
        </Layout>
      );
  }
}