aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/containers/latest_error.tsx
diff options
context:
space:
mode:
authorHsuan Lee <hsuan@cobinhood.com>2019-01-19 18:42:04 +0800
committerHsuan Lee <hsuan@cobinhood.com>2019-01-19 18:42:04 +0800
commit7ae38906926dc09bc10670c361af0d2bf0050426 (patch)
tree5fb10ae366b987db09e4ddb4bc3ba0f75404ad08 /packages/instant/src/containers/latest_error.tsx
parentb5fd3c72a08aaa6957917d74c333387a16edf66b (diff)
downloaddexon-sol-tools-7ae38906926dc09bc10670c361af0d2bf0050426.tar.gz
dexon-sol-tools-7ae38906926dc09bc10670c361af0d2bf0050426.tar.zst
dexon-sol-tools-7ae38906926dc09bc10670c361af0d2bf0050426.zip
Update dependency packages
Diffstat (limited to 'packages/instant/src/containers/latest_error.tsx')
-rw-r--r--packages/instant/src/containers/latest_error.tsx68
1 files changed, 0 insertions, 68 deletions
diff --git a/packages/instant/src/containers/latest_error.tsx b/packages/instant/src/containers/latest_error.tsx
deleted file mode 100644
index 57a2dbdc2..000000000
--- a/packages/instant/src/containers/latest_error.tsx
+++ /dev/null
@@ -1,68 +0,0 @@
-import * as React from 'react';
-
-import { connect } from 'react-redux';
-import { Dispatch } from 'redux';
-
-import { SlidingError } from '../components/sliding_error';
-import { Container } from '../components/ui/container';
-import { Overlay } from '../components/ui/overlay';
-import { Action } from '../redux/actions';
-import { State } from '../redux/reducer';
-import { ScreenWidths } from '../style/media';
-import { generateOverlayBlack } from '../style/theme';
-import { zIndex } from '../style/z_index';
-import { Asset, DisplayStatus, Omit, SlideAnimationState } from '../types';
-import { errorFlasher } from '../util/error_flasher';
-
-interface LatestErrorComponentProps {
- asset?: Asset;
- latestErrorMessage?: string;
- animationState: SlideAnimationState;
- shouldRenderOverlay: boolean;
- onOverlayClick: () => void;
-}
-
-const LatestErrorComponent: React.StatelessComponent<LatestErrorComponentProps> = props => {
- if (!props.latestErrorMessage) {
- // Render a hidden SlidingError such that instant does not move when a real error is rendered.
- return (
- <Container isHidden={true}>
- <SlidingError animationState="slidIn" icon="😢" message="" />
- </Container>
- );
- }
- return (
- <React.Fragment>
- <SlidingError animationState={props.animationState} icon="😢" message={props.latestErrorMessage} />
- {props.shouldRenderOverlay && (
- <Overlay
- onClick={props.onOverlayClick}
- zIndex={zIndex.containerOverlay}
- showMaxWidth={ScreenWidths.Sm}
- backgroundColor={generateOverlayBlack(0.4)}
- />
- )}
- </React.Fragment>
- );
-};
-
-export interface LatestErrorProps {}
-interface ConnectedState extends Omit<LatestErrorComponentProps, 'onOverlayClick'> {}
-const mapStateToProps = (state: State, _ownProps: LatestErrorProps): ConnectedState => ({
- asset: state.selectedAsset,
- latestErrorMessage: state.latestErrorMessage,
- animationState: state.latestErrorDisplayStatus === DisplayStatus.Present ? 'slidIn' : 'slidOut',
- shouldRenderOverlay: state.latestErrorDisplayStatus === DisplayStatus.Present,
-});
-
-type ConnectedDispatch = Pick<LatestErrorComponentProps, 'onOverlayClick'>;
-const mapDispatchToProps = (dispatch: Dispatch<Action>, _ownProps: LatestErrorProps): ConnectedDispatch => ({
- onOverlayClick: () => {
- errorFlasher.clearError(dispatch);
- },
-});
-
-export const LatestError = connect(
- mapStateToProps,
- mapDispatchToProps,
-)(LatestErrorComponent);