From 5db23c15e4c5a27499b245e80e12545e04756a9a Mon Sep 17 00:00:00 2001 From: Isaac Kang Date: Tue, 7 Aug 2018 20:41:56 -0400 Subject: [PATCH] rm extraneous components, mv ListingCard comp. --- src/containers/Listings/Pagination.js | 107 ------------- src/containers/Listings/VisibleListings.js | 27 ---- .../Listings/{ => components}/ListingCard.js | 16 +- src/containers/Listings/index.js | 16 +- src/containers/Registry/ListingCard.js | 148 ------------------ src/containers/Registry/VisibleListings.js | 27 ---- src/containers/Registry/index.js | 2 +- src/containers/Stepper/StepperProvider.js | 30 ---- 8 files changed, 17 insertions(+), 356 deletions(-) delete mode 100644 src/containers/Listings/Pagination.js delete mode 100644 src/containers/Listings/VisibleListings.js rename src/containers/Listings/{ => components}/ListingCard.js (89%) delete mode 100644 src/containers/Registry/ListingCard.js delete mode 100644 src/containers/Registry/VisibleListings.js delete mode 100644 src/containers/Stepper/StepperProvider.js diff --git a/src/containers/Listings/Pagination.js b/src/containers/Listings/Pagination.js deleted file mode 100644 index ebab1d39..00000000 --- a/src/containers/Listings/Pagination.js +++ /dev/null @@ -1,107 +0,0 @@ -import React from 'react' -import { withStyles } from '@material-ui/core/styles' - -import IconButton from '@material-ui/core/IconButton' -import FirstPageIcon from '@material-ui/icons/FirstPage' -import KeyboardArrowLeft from '@material-ui/icons/KeyboardArrowLeft' -import KeyboardArrowRight from '@material-ui/icons/KeyboardArrowRight' -import LastPageIcon from '@material-ui/icons/LastPage' - -const actionsStyles = theme => ({ - root: { - flexShrink: 0, - color: theme.textSecondary, - marginLeft: theme.spacing.unit * 2.5, - }, - prevPage: { - position: 'fixed', - left: '30px', - top: '45%', - height: '5em', - width: '5em', - }, - nextPage: { - position: 'fixed', - right: '30px', - top: '45%', - height: '5em', - width: '5em', - }, -}) - -class TablePaginationActions extends React.Component { - componentDidMount() { - this.handleKeyPress() - } - handleFirstPageButtonClick = event => { - this.props.onChangePage(event, 0) - } - - handleBackButtonClick = event => { - this.props.onChangePage(event, this.props.page - 1) - } - - handleNextButtonClick = event => { - this.props.onChangePage(event, this.props.page + 1) - } - - handleLastPageButtonClick = event => { - this.props.onChangePage( - event, - Math.max(0, Math.ceil(this.props.count / this.props.rowsPerPage) - 1) - ) - } - handleKeyPress = () => { - document.addEventListener('keydown', e => { - if (e.code === 'ArrowLeft' && this.props.page !== 0) { - this.handleBackButtonClick(e) - } else if ( - e.code === 'ArrowRight' && - !(this.props.page >= Math.ceil(this.props.count / this.props.rowsPerPage) - 1) - ) { - this.handleNextButtonClick(e) - } - }) - } - - render() { - const { classes, count, page, rowsPerPage } = this.props - - return ( -
- - - - - - - = Math.ceil(count / rowsPerPage) - 1} - aria-label="Next Page" - className={classes.nextPage} - > - - - = Math.ceil(count / rowsPerPage) - 1} - aria-label="Last Page" - > - - -
- ) - } -} - -export default withStyles(actionsStyles)(TablePaginationActions) diff --git a/src/containers/Listings/VisibleListings.js b/src/containers/Listings/VisibleListings.js deleted file mode 100644 index 954e0b20..00000000 --- a/src/containers/Listings/VisibleListings.js +++ /dev/null @@ -1,27 +0,0 @@ -import * as React from 'react' -import { connect } from 'react-redux' -import { compose } from 'redux' -import { withRouter } from 'react-router-dom' -import { createStructuredSelector } from 'reselect' -import toJS from 'components/toJS' -import { makeSelectVisibleListings } from 'modules/listings/selectors' - -function VisibleListings({ visibleListings }) { - return ( -
- {JSON.stringify(visibleListings)} - {/* {visibleListings.map(li => ( -
{li.listingID}
- ))} */} -
- ) -} - -const mapStateToProps = createStructuredSelector({ - visibleListings: makeSelectVisibleListings(), -}) - -export default compose( - withRouter, - connect(mapStateToProps) -)(toJS(VisibleListings)) diff --git a/src/containers/Listings/ListingCard.js b/src/containers/Listings/components/ListingCard.js similarity index 89% rename from src/containers/Listings/ListingCard.js rename to src/containers/Listings/components/ListingCard.js index a81cf697..77cfbb9f 100644 --- a/src/containers/Listings/ListingCard.js +++ b/src/containers/Listings/components/ListingCard.js @@ -1,4 +1,5 @@ import React from 'react' +import styled from 'styled-components' import { withStyles } from '@material-ui/core/styles' import Typography from '@material-ui/core/Typography' import Card from '@material-ui/core/Card' @@ -7,8 +8,7 @@ import Button from 'components/Button' import Img from 'components/Img' import Countdown from 'components/Countdown' -import styled from 'styled-components' -import { tsToMonthDate } from '../../utils/_datetime' +import { tsToMonthDate } from 'utils/_datetime' const CardContent = styled.div` padding: 1em; @@ -49,7 +49,7 @@ function ListingCard(props) { listingType, updateTrigger, revealTrigger, - openSidePanel, + openTxPanel, claimRewardTrigger, } = props @@ -85,7 +85,7 @@ function ListingCard(props) { - - ) : ( - revealTrigger && - !updateTrigger && ( -
- - -
- ) - )} - - ) : ( -
- - -
- )} - {claimRewardTrigger && ( - - )} - {updateTrigger && ( - - )} - - - - ) -} - -export default withStyles(styles)(ListingCard) diff --git a/src/containers/Registry/VisibleListings.js b/src/containers/Registry/VisibleListings.js deleted file mode 100644 index 954e0b20..00000000 --- a/src/containers/Registry/VisibleListings.js +++ /dev/null @@ -1,27 +0,0 @@ -import * as React from 'react' -import { connect } from 'react-redux' -import { compose } from 'redux' -import { withRouter } from 'react-router-dom' -import { createStructuredSelector } from 'reselect' -import toJS from 'components/toJS' -import { makeSelectVisibleListings } from 'modules/listings/selectors' - -function VisibleListings({ visibleListings }) { - return ( -
- {JSON.stringify(visibleListings)} - {/* {visibleListings.map(li => ( -
{li.listingID}
- ))} */} -
- ) -} - -const mapStateToProps = createStructuredSelector({ - visibleListings: makeSelectVisibleListings(), -}) - -export default compose( - withRouter, - connect(mapStateToProps) -)(toJS(VisibleListings)) diff --git a/src/containers/Registry/index.js b/src/containers/Registry/index.js index 06c9b923..86f42ed1 100644 --- a/src/containers/Registry/index.js +++ b/src/containers/Registry/index.js @@ -13,8 +13,8 @@ import { makeSelectVisibleListings } from 'modules/listings/selectors' import { selectStats, selectTCR } from 'modules/home/selectors' import toJS from 'components/toJS' +import Listings from 'containers/Listings/Loadable' import Wrapper from '../Wrapper' -import Listings from '../Listings/Loadable' const Table = styled.div` flex-grow: 1; diff --git a/src/containers/Stepper/StepperProvider.js b/src/containers/Stepper/StepperProvider.js deleted file mode 100644 index a9fd1e3b..00000000 --- a/src/containers/Stepper/StepperProvider.js +++ /dev/null @@ -1,30 +0,0 @@ -import React, { Component } from 'react' - -export const StepperContext = React.createContext() -// const {Provider, Consumer} = React.createContext(defaultValue); - -class StepperProvider extends Component { - constructor(props) { - super(props) - this.state = { - stage: 1, - } - } - render() { - return ( - - this.setState({ - stage: this.state.stage + 1, - }), - }} - > - {this.props.children} - - ) - } -} - -export default StepperProvider