diff --git a/src/js/components/tmp/ArbitrationList.jsx b/src/js/components/tmp/ArbitrationList.jsx deleted file mode 100644 index a8b03160..00000000 --- a/src/js/components/tmp/ArbitrationList.jsx +++ /dev/null @@ -1,68 +0,0 @@ -import React from 'react'; -import {Card, CardBody, CardHeader, CardTitle, Table} from 'reactstrap'; -import PropTypes from 'prop-types'; -import {withNamespaces} from "react-i18next"; -import {ARBITRATION_UNSOLVED} from "../../features/arbitration/constants"; -import ArbitrationResult from "./ArbitrationResult"; -import Address from "../UserInformation/Address"; -import TransactionResults from "./TransactionResults"; - -function getArbitrationState(escrow) { - if(escrow.arbitration.open && escrow.arbitration.result === ARBITRATION_UNSOLVED){ - return

In arbitration

; - } - return

Arbitration completed

; -} - -const ArbitrationList = (props) => ( - - - Disputed escrows - - - - {(props.escrows.length === 0) && !props.loading &&

No Arbitration cases

} - {props.escrows.length > 0 && - - - - - - - - - - - - - - {props.escrows.map(escrow => - - - - - - - - - - )} - -
#StateSellerBuyerOpen ByValueExpirationActions
{escrow.escrowId}{getArbitrationState(escrow)}
{escrow.buyer === escrow.arbitration.openBy ? 'Buyer' : 'Seller'}{escrow.amount}{escrow.expirationTime.toString()} - -
} -
-
); - -ArbitrationList.propTypes = { - escrows: PropTypes.array, - resolveDispute: PropTypes.func, - t: PropTypes.func, - loading: PropTypes.bool, - error: PropTypes.string, - txHash: PropTypes.string -}; - -export default withNamespaces()(ArbitrationList); diff --git a/src/js/components/tmp/ArbitrationResult.jsx b/src/js/components/tmp/ArbitrationResult.jsx deleted file mode 100644 index dc8458f7..00000000 --- a/src/js/components/tmp/ArbitrationResult.jsx +++ /dev/null @@ -1,48 +0,0 @@ -import React, {Component} from 'react'; -import {Button, FormGroup, Input} from "reactstrap"; -import PropTypes from 'prop-types'; -import {ARBITRATION_SOLVED_BUYER, ARBITRATION_SOLVED_SELLER, ARBITRATION_UNSOLVED} from "../../features/arbitration/constants"; - -class ArbitrationResult extends Component { - constructor(props) { - super(props); - this.state = { - decision: 0 - }; - } - - onChange(e) { - this.setState({decision: e.target.value}); - } - - submit() { - this.props.resolveDispute(this.props.escrowId, this.state.decision); - } - - render() { - const solved = this.props.decision.toString() !== ARBITRATION_UNSOLVED; - - if(solved){ - return {this.props.decision.toString() === ARBITRATION_SOLVED_BUYER ? "Funds released to buyer" : "Seller refunded" }; - } - - return - this.onChange(e)} - value={this.state.decision} disabled={this.props.disabled}> - - - - - - ; - } -} - -ArbitrationResult.propTypes = { - escrowId: PropTypes.string, - decision: PropTypes.number, - resolveDispute: PropTypes.func, - disabled: PropTypes.bool -}; - -export default ArbitrationResult; diff --git a/src/js/components/tmp/CreateEscrowForm.jsx b/src/js/components/tmp/CreateEscrowForm.jsx deleted file mode 100644 index 480ff103..00000000 --- a/src/js/components/tmp/CreateEscrowForm.jsx +++ /dev/null @@ -1,107 +0,0 @@ -import React, {Component} from 'react'; -import {Button, Card, CardBody, CardHeader, CardTitle, FormGroup, Label, FormFeedback} from 'reactstrap'; -import PropTypes from 'prop-types'; -import Datetime from 'react-datetime'; -import moment from 'moment'; -import classnames from 'classnames'; -import {withNamespaces} from 'react-i18next'; -import Form from 'react-validation/build/form'; -import Input from 'react-validation/build/input'; -import {isInteger, isAddress, required} from '../../validators'; -import TransactionResults from './TransactionResults'; - -import '../../../../node_modules/react-datetime/css/react-datetime.css'; -import '../../../css/Form.scss'; - -class CreateEscrowForm extends Component { - constructor(props) { - super(props); - this.state = { - amount: '', - expiration: moment(Date.now() + (15 * 60 * 1000)), - buyer: '', - expirationError: '', - error: '' - }; - } - - onBuyerChange(e) { - this.setState({buyer: e.target.value}); - } - - onAmountChange(e) { - this.setState({amount: e.target.value}); - } - - validateExpiration(expiration) { - let error = ''; - if (!expiration.unix()) { // Somehow, the user managed to return NOT a moment date - error = 'Expiration is not a valid date object. Please use the Date Picker.'; - } - if (expiration.unix() < moment().unix() + 600) { - error = 'Expiration date needs to be in at least 10 minutes'; - } - this.setState({expirationError: error}); - return error; - } - - onExpirationChange(newDate) { - this.validateExpiration(newDate); - this.setState({expiration: newDate}); - } - - submit = () => { - this.form.validateAll(); - const expirationError = this.validateExpiration(this.state.expiration); - if (this.form.getChildContext()._errors.length > 0 || expirationError) { - return this.setState({error: 'Please fix issues before submitting'}); - } - this.setState({error: ''}); - - this.props.create(this.state.buyer, this.state.amount, this.state.expiration.unix()); - }; - - render() { - const {expiration, buyer, amount, expirationError, error} = this.state; - const {t, isLoading, result, error: propsError, txHash} = this.props; - return - - {t('createEscrowFrom.title')} - - -
{ this.form = c; }}> - - - - this.onBuyerChange(e)} value={buyer} validations={[required, isAddress]} disabled={isLoading}/> - - - - this.onAmountChange(e)} value={amount} validations={[required, isInteger]} disabled={isLoading}/> - - - - this.onExpirationChange(newDate)}/> - {expirationError} - - - -
-
; - } -} - -CreateEscrowForm.propTypes = { - t: PropTypes.func, - create: PropTypes.func, - error: PropTypes.string, - result: PropTypes.object, - isLoading: PropTypes.bool, - txHash: PropTypes.string -}; - -export default withNamespaces()(CreateEscrowForm); diff --git a/src/js/components/tmp/EscrowList.jsx b/src/js/components/tmp/EscrowList.jsx deleted file mode 100644 index bdb854fd..00000000 --- a/src/js/components/tmp/EscrowList.jsx +++ /dev/null @@ -1,126 +0,0 @@ -/*global web3*/ -import React, {Fragment} from 'react'; -import {Card, CardBody, CardHeader, CardTitle, Table, Button} from 'reactstrap'; -import PropTypes from 'prop-types'; -import {withNamespaces} from 'react-i18next'; -import {getTradeStatus, tradeStates} from "../../features/escrow/helpers"; -import {SIGNATURE_PAYMENT, SIGNATURE_OPEN_CASE} from "../../features/escrow/constants"; -import Rating from "./Rating"; -import SignatureDialog from "./SignatureDialog"; -import TransactionResults from "./TransactionResults"; - -function getTradeStatusText(escrow, t) { - switch (getTradeStatus(escrow)) { - case tradeStates.released: - return

{t('escrowList.state.released')}

; - case tradeStates.paid: - return

{t('escrowList.state.paid')}

; - case tradeStates.canceled: - return

{t('escrowList.state.canceled')}

; - case tradeStates.expired: - return

{t('escrowList.state.expired')}

; - case tradeStates.arbitration_open: - return

{t('escrowList.state.inArbitration')}

; - case tradeStates.arbitration_closed: - return

{t('escrowList.state.arbitrationCompleted')}

; - case tradeStates.waiting: - default: - return

{t('escrowList.state.waiting')}

; - } -} - -const EscrowList = (props) => ( - - {props.signature && - {props.signature.type === SIGNATURE_PAYMENT && props.t('escrowList.actions.markAsPaid')} - {props.signature.type === SIGNATURE_OPEN_CASE && props.t('escrowList.actions.openCase')} - } - - - {props.t('escrowList.title')} - - - - {(!props.escrows || props.escrows.length === 0) && !props.loading &&

{props.t('escrowList.empty')}

} - {props.escrows && props.escrows.length > 0 && - - - - - - - - - - - - {props.escrows.map(escrow => { - escrow.state = getTradeStatus(escrow); - return escrow; - }) - .map(escrow => - - - - - - - )} - -
#{props.t('escrowList.head.state')}{props.escrows[0].buyer === web3.eth.defaultAccount ? props.t('escrowList.head.seller') : props.t('escrowList.head.buyer')}{props.t('escrowList.head.value')}{props.t('escrowList.head.expiration')}{props.t('escrowList.head.actions')}
{escrow.escrowId}{getTradeStatusText(escrow, props.t)}{escrow.buyer === web3.eth.defaultAccount ? escrow.seller : escrow.buyer}{escrow.amount}{escrow.expirationTime.toString()} - {escrow.state === tradeStates.waiting && escrow.seller === web3.eth.defaultAccount && - } - - {escrow.state === tradeStates.expired && escrow.seller === web3.eth.defaultAccount && - } - {escrow.state === tradeStates.released && !escrow.arbitration && escrow.buyer === web3.eth.defaultAccount && - } - {escrow.state === tradeStates.waiting && escrow.buyer === web3.eth.defaultAccount && - - - } - {escrow.state === tradeStates.paid && - - - - } - -
} -
-
-
); - -EscrowList.propTypes = { - t: PropTypes.func, - escrows: PropTypes.array, - signature: PropTypes.object, - releaseEscrow: PropTypes.func, - payEscrow: PropTypes.func, - payEscrowSignature: PropTypes.func, - openCase: PropTypes.func, - openCaseSignature: PropTypes.func, - cancelEscrow: PropTypes.func, - closeDialog: PropTypes.func, - rateTransaction: PropTypes.func, - loading: PropTypes.bool, - error: PropTypes.string, - txHash: PropTypes.string -}; - -export default withNamespaces()(EscrowList); diff --git a/src/js/components/tmp/License.jsx b/src/js/components/tmp/License.jsx deleted file mode 100644 index 0b2af926..00000000 --- a/src/js/components/tmp/License.jsx +++ /dev/null @@ -1,49 +0,0 @@ -import React from 'react'; -import {Card, CardHeader, CardBody, CardTitle, Button} from 'reactstrap'; -import PropTypes from 'prop-types'; -import { withNamespaces } from 'react-i18next'; -import TransactionResults from "./TransactionResults"; - -const BuyLicense = (props) => ( - -); - -BuyLicense.propTypes = { - t: PropTypes.func, - buyLicense: PropTypes.func, - disabled: PropTypes.bool -}; - -const IsLicenseOwner = (props) =>

{props.t('license.alreadyOwner')}

; - -IsLicenseOwner.propTypes = { - t: PropTypes.func -}; - -const License = (props) => ( - - - {props.t('license.title')} - - - - {props.isLicenseOwner ? : } - {props.isLicenseOwner && -

{props.t('license.rating')} {props.userRating ? props.userRating : props.t('license.noRating')}

- } -
-
-); - -License.propTypes = { - t: PropTypes.func, - error: PropTypes.string, - txHash: PropTypes.string, - isLicenseOwner: PropTypes.bool, - loading: PropTypes.bool, - userRating: PropTypes.number, - buyLicense: PropTypes.func -}; - -export default withNamespaces()(License); diff --git a/src/js/components/tmp/License.test.jsx b/src/js/components/tmp/License.test.jsx deleted file mode 100644 index edaed0e2..00000000 --- a/src/js/components/tmp/License.test.jsx +++ /dev/null @@ -1,18 +0,0 @@ -import React from "react"; -import { shallow } from "enzyme"; - -import License from "./License"; - -describe('License', () => { - it('should render correctly', () => { - const component = shallow(); - - expect(component).toMatchSnapshot(); - }); - - it('should render when being license owner', () => { - const component = shallow(); - - expect(component).toMatchSnapshot(); - }); -}); diff --git a/src/js/components/tmp/Rating.jsx b/src/js/components/tmp/Rating.jsx deleted file mode 100644 index fbb2b65c..00000000 --- a/src/js/components/tmp/Rating.jsx +++ /dev/null @@ -1,50 +0,0 @@ -import React, {Component} from 'react'; -import {Button, FormGroup, Input, Label} from "reactstrap"; -import PropTypes from 'prop-types'; -import { withNamespaces } from 'react-i18next'; - -const Options = () => { - const buttons = []; - for (let i = 5; i >= 1; i--) { - buttons.push(); - } - return buttons; -}; - -class Rating extends Component { - constructor(props) { - super(props); - this.state = { - rating: 0 - }; - } - - onChange(e) { - this.setState({rating: e.target.value}); - } - - submit() { - this.props.rateTransaction(this.props.escrowId, this.state.rating); - } - - render() { - const disabled = this.props.rating !== 0; - return ( - - this.onChange(e)} value={this.props.rating || this.state.rating}> - - - {!disabled && } - ); - } -} - -Rating.propTypes = { - t: PropTypes.func, - escrowId: PropTypes.string, - rating: PropTypes.number, - rateTransaction: PropTypes.func -}; - -export default withNamespaces()(Rating); diff --git a/src/js/components/tmp/__snapshots__/License.test.jsx.snap b/src/js/components/tmp/__snapshots__/License.test.jsx.snap deleted file mode 100644 index ce740c07..00000000 --- a/src/js/components/tmp/__snapshots__/License.test.jsx.snap +++ /dev/null @@ -1,56 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`License should render correctly 1`] = ` - - - - - - - - - -`; - -exports[`License should render when being license owner 1`] = ` - - - - - - - -

- -

-
-
-`; diff --git a/src/js/features/metadata/selectors.js b/src/js/features/metadata/selectors.js index 4ebeefab..db86ed6a 100644 --- a/src/js/features/metadata/selectors.js +++ b/src/js/features/metadata/selectors.js @@ -1,6 +1,5 @@ import {PAYMENT_METHODS, MARKET_TYPES} from './constants'; -import {addressCompare} from '../../utils/address'; - +import {addressCompare, toChecksumAddress} from '../../utils/address'; function enhanceOffer(state, offer) { return { @@ -12,7 +11,10 @@ function enhanceOffer(state, offer) { } export const getProfile = (state, address) => { - const lAddress = address.toLowerCase(); + if (!address) { + return null; + } + const lAddress = toChecksumAddress(address); if (!state.metadata.users[lAddress]) { return null; diff --git a/src/js/layout/App.jsx b/src/js/layout/App.jsx index 4a7c63ff..aa768704 100644 --- a/src/js/layout/App.jsx +++ b/src/js/layout/App.jsx @@ -39,9 +39,7 @@ import SellCurrency from '../wizards/Sell/5_Currency'; import SellMargin from '../wizards/Sell/6_Margin'; // Tmp -import EscrowsContainer from '../pages/tmp/EscrowsContainer'; import SignatureContainer from '../pages/tmp/SignatureContainer'; -import ArbitrationContainer from '../pages/tmp/ArbitrationContainer'; import prices from '../features/prices'; import network from '../features/network'; @@ -132,9 +130,7 @@ class App extends Component { ]}/> } - - diff --git a/src/js/pages/tmp/ArbitrationContainer.jsx b/src/js/pages/tmp/ArbitrationContainer.jsx deleted file mode 100644 index 7a7c93a4..00000000 --- a/src/js/pages/tmp/ArbitrationContainer.jsx +++ /dev/null @@ -1,42 +0,0 @@ -import React, {Component} from 'react'; -import {connect} from 'react-redux'; -import PropTypes from 'prop-types'; - -import ArbitrationList from "../../components/tmp/ArbitrationList"; -import arbitration from '../../features/arbitration'; - -class ArbitrationContainer extends Component { - componentDidMount() { - this.props.getDisputedEscrows(); - } - - render() { - return ; - } -} - -ArbitrationContainer.propTypes = { - resolveDispute: PropTypes.func, - getDisputedEscrows: PropTypes.func, - escrows: PropTypes.array, - errorGet: PropTypes.string, - escrowsLoading: PropTypes.bool -}; - -const mapStateToProps = state => ({ - errorGet: arbitration.selectors.errorGet(state), - escrowsLoading: arbitration.selectors.loading(state), - txHash: arbitration.selectors.txHash(state), - escrows: arbitration.selectors.escrows(state) -}); - -export default connect( - mapStateToProps, - { - getDisputedEscrows: arbitration.actions.getDisputedEscrows, - resolveDispute: arbitration.actions.resolveDispute - } -)(ArbitrationContainer); diff --git a/src/js/pages/tmp/EscrowsContainer.jsx b/src/js/pages/tmp/EscrowsContainer.jsx deleted file mode 100644 index 487da55b..00000000 --- a/src/js/pages/tmp/EscrowsContainer.jsx +++ /dev/null @@ -1,115 +0,0 @@ -import React, {Component, Fragment} from 'react'; -import {connect} from 'react-redux'; -import PropTypes from 'prop-types'; - -import EscrowList from "../../components/tmp/EscrowList"; -import CreateEscrowForm from '../../components/tmp/CreateEscrowForm'; -import License from '../../components/tmp/License'; -import license from '../../features/license'; -import escrow from '../../features/escrow'; - -class EscrowsContainer extends Component { - componentDidMount() { - this.props.checkLicenseOwner(); - this.props.checkUserRating(); - this.props.getEscrows(); - } - - buyLicense = () => { - this.props.buyLicense(); - }; - - createEscrow = (buyer, value, expiration) => { - this.props.createEscrow(buyer, value, expiration); - }; - - render() { - const {error, userRating, isLicenseOwner, isCreateLoading, escrowError, escrowReceipt, escrows, releaseEscrow, - openCase, payEscrow, signature, payEscrowSignature, openCaseSignature, closeDialog, cancelEscrow, - errorGet, loadingList, rateTransaction, createdTxHash, txHashList, licenseLoading, licenseTxHash} = this.props; - - return - - - {isLicenseOwner && - } - - - ; - } -} - -EscrowsContainer.propTypes = { - checkLicenseOwner: PropTypes.func, - licenseLoading: PropTypes.bool, - checkUserRating: PropTypes.func, - buyLicense: PropTypes.func, - licenseTxHash: PropTypes.string, - createEscrow: PropTypes.func, - releaseEscrow: PropTypes.func, - payEscrow: PropTypes.func, - payEscrowSignature: PropTypes.func, - openCase: PropTypes.func, - openCaseSignature: PropTypes.func, - closeDialog: PropTypes.func, - cancelEscrow: PropTypes.func, - rateTransaction: PropTypes.func, - getEscrows: PropTypes.func, - escrows: PropTypes.array, - isCreateLoading: PropTypes.bool, - createdTxHash: PropTypes.string, - txHashList: PropTypes.string, - signature: PropTypes.object, - loadingList: PropTypes.bool, - errorGet: PropTypes.string, - error: PropTypes.string, - userRating: PropTypes.number, - isLicenseOwner: PropTypes.bool, - escrowError: PropTypes.string, - escrowReceipt: PropTypes.object -}; - -const mapStateToProps = state => ({ - isLicenseOwner: license.selectors.isLicenseOwner(state), - licenseLoading: license.selectors.isLoading(state), - userRating: license.selectors.userRating(state), - error: license.selectors.error(state), - licenseTxHash: license.selectors.txHash(state), - escrowError: escrow.selectors.error(state), - isCreateLoading: escrow.selectors.isLoading(state), - escrowReceipt: escrow.selectors.receipt(state), - errorGet: escrow.selectors.errorGet(state), - loadingList: escrow.selectors.loadingList(state), - createdTxHash: escrow.selectors.txHash(state), - txHashList: escrow.selectors.txHashList(state), - escrows: escrow.selectors.escrows(state), - signature: escrow.selectors.signature(state) -}); - -export default connect( - mapStateToProps, - { - buyLicense: license.actions.buyLicense, - createEscrow: escrow.actions.createEscrow, - getEscrows: escrow.actions.getEscrows, - payEscrow: escrow.actions.payEscrow, - payEscrowSignature: escrow.actions.payEscrowSignature, - openCase: escrow.actions.openCase, - openCaseSignature: escrow.actions.openCaseSignature, - releaseEscrow: escrow.actions.releaseEscrow, - cancelEscrow: escrow.actions.cancelEscrow, - rateTransaction: escrow.actions.rateTransaction, - checkLicenseOwner: license.actions.checkLicenseOwner, - checkUserRating: escrow.actions.checkUserRating, - closeDialog: escrow.actions.closeDialog - } -)(EscrowsContainer); diff --git a/src/js/wizards/Sell/4_SelectArbitrator/components/ArbitratorSelectorForm.jsx b/src/js/wizards/Sell/4_SelectArbitrator/components/ArbitratorSelectorForm.jsx index 485be0ed..2191b86f 100644 --- a/src/js/wizards/Sell/4_SelectArbitrator/components/ArbitratorSelectorForm.jsx +++ b/src/js/wizards/Sell/4_SelectArbitrator/components/ArbitratorSelectorForm.jsx @@ -6,35 +6,31 @@ import {withNamespaces} from 'react-i18next'; import {compactAddress} from '../../../../utils/address'; class ArbitratorSelectorForm extends Component { - onInputChange = (text) => { - const arbitrator = this.props.arbitrators.find(x => x === text); - if (arbitrator) { - this.props.changeArbitrator(arbitrator); - } - - }; - onChange = (items) => { if(items.length){ const item = items[0]; - this.props.changeArbitrator(item); + const index = item.substring(0, item.indexOf(' - ')); + this.props.changeArbitrator(this.props.arbitrators[parseInt(index, 10)]); } }; render() { const {t, value} = this.props; let defaultSelectedValue = []; - if (value) { - const arbitrator = this.props.arbitrators.find(x => x === value); - defaultSelectedValue.push(arbitrator); - } - const arbitratorStrings = this.props.arbitrators.map(arbitratorAddr => { + const arbitratorStrings = this.props.arbitrators.map((arbitratorAddr, index) => { const user = this.props.users[arbitratorAddr]; + + let text; if (!user) { - return arbitratorAddr + ' - Loading...'; + text = arbitratorAddr + ' - Loading...'; + } else { + text = `${index} - ${user.username || compactAddress(arbitratorAddr, 3)}${user.location ? ' from ' + user.location : ''} - ${user.upCount || 0}↑ ${user.downCount || 0}↓`; } - return `${user.username || compactAddress(arbitratorAddr, 3)}${user.location ? ' from ' + user.location : ''} - ${user.upCount || 0}↑ ${user.downCount || 0}↓`; + if (value && value === arbitratorAddr) { + defaultSelectedValue.push(text); + } + return text; }); return ( @@ -46,7 +42,6 @@ class ArbitratorSelectorForm extends Component { onChange={this.onChange} options={arbitratorStrings} placeholder={t("arbitratorSelectorForm.placeholder")} - onInputChange={this.onInputChange} submitFormOnEnter={true} emptyLabel={t("arbitratorSelectorForm.emptyLabel")} defaultSelected={defaultSelectedValue} diff --git a/stories/tmp/arbitrationList.stories.jsx b/stories/tmp/arbitrationList.stories.jsx deleted file mode 100644 index 5ff6a07f..00000000 --- a/stories/tmp/arbitrationList.stories.jsx +++ /dev/null @@ -1,92 +0,0 @@ -import React from 'react'; - -import {storiesOf} from '@storybook/react'; -import {withInfo} from "@storybook/addon-info"; -import {action} from '@storybook/addon-actions'; -import moment from 'moment'; - -import ArbitrationList from '../../src/js/components/tmp/ArbitrationList'; - -global.web3 = { - eth: { - defaultAccount: '0xBa31E1a4Ce37FE67DcAEa7950D379CB89A36867d' - } -}; - -const escrows = [ - { - escrowId: 0, - buyer: '0xBa31E1a4Ce37FE67DcAEa7950D379CB89A36867d', - seller: '0xB8D851486d1C953e31A44374ACa11151D49B8bb3', - amount: 8, - arbitration: {open: true, result: "0", openBy: "0xBa31E1a4Ce37FE67DcAEa7950D379CB89A36867d" }, - expirationTime: moment(Date.now() - 60000), - rating: 0, - paid: true, - released: false, - canceled: false - }, - { - escrowId: 0, - buyer: '0xBa31E1a4Ce37FE67DcAEa7950D379CB89A36867d', - seller: '0xB8D851486d1C953e31A44374ACa11151D49B8bb3', - amount: 8, - arbitration: {open: true, result: "1"}, - expirationTime: moment(Date.now() - 60000), - rating: 0, - paid: true, - released: false, - canceled: false - }, - { - escrowId: 0, - buyer: '0xBa31E1a4Ce37FE67DcAEa7950D379CB89A36867d', - seller: '0xB8D851486d1C953e31A44374ACa11151D49B8bb3', - amount: 8, - arbitration: {open: true, result: "2"}, - expirationTime: moment(Date.now() - 60000), - rating: 0, - paid: true, - released: false, - canceled: false - } -]; - -const info = {inline: true}; - -storiesOf('tmp/ArbitrationList', module) - .add( - "List with disputes", - withInfo(info)(() => ( - - )) - ) - .add( - "Loading List", - withInfo(info)(() => ( - - )) - ) - .add( - "Loading List + Hash", - withInfo(info)(() => ( - - )) - ) - .add( - "Error doing something", - withInfo(info)(() => ( - - )) - ) - .add( - "Empty list", - withInfo(info)(() => ( - - )) - ); diff --git a/stories/tmp/createEscrowForm.stories.jsx b/stories/tmp/createEscrowForm.stories.jsx deleted file mode 100644 index bdae180e..00000000 --- a/stories/tmp/createEscrowForm.stories.jsx +++ /dev/null @@ -1,41 +0,0 @@ -import React from 'react'; - -import {storiesOf} from '@storybook/react'; -import {withInfo} from "@storybook/addon-info"; -import {action} from '@storybook/addon-actions'; - -import CreateEscrowForm from '../../src/js/components/tmp/CreateEscrowForm'; - -const info = {inline: true, propTables: [CreateEscrowForm.WrappedComponent]}; -storiesOf('tmp/CreateEscrowForm', module) - .add( - "Empty Form", - withInfo(info)(() => ( - - )) - ) - .add( - "Loading Form", - withInfo(info)(() => ( - - )) - ) - .add( - "Loading Form + Tx Hash", - withInfo(info)(() => ( - - )) - ) - .add( - "Form with error", - withInfo(info)(() => ( - - )) - ) - .add( - "Form with result", - withInfo(info)(() => ( - - )) - ); diff --git a/stories/tmp/escrowList.stories.jsx b/stories/tmp/escrowList.stories.jsx deleted file mode 100644 index 3c9e81c2..00000000 --- a/stories/tmp/escrowList.stories.jsx +++ /dev/null @@ -1,157 +0,0 @@ -import React from 'react'; - -import {storiesOf} from '@storybook/react'; -import {withInfo} from "@storybook/addon-info"; -import {action} from '@storybook/addon-actions'; -import cloneDeep from 'clone-deep'; -import moment from 'moment'; - -import EscrowList from '../../src/js/components/tmp/EscrowList'; - -global.web3 = { - eth: { - defaultAccount: '0xBa31E1a4Ce37FE67DcAEa7950D379CB89A36867d' - } -}; - -const escrows = [ - { - escrowId: 0, - buyer: '0xBa31E1a4Ce37FE67DcAEa7950D379CB89A36867d', - seller: '0xB8D851486d1C953e31A44374ACa11151D49B8bb3', - amount: 5, - expirationTime: moment(Date.now() + 60000), - rating: 4, - released: true, - canceled: false, - paid: false - }, - { - escrowId: 1, - buyer: '0xBa31E1a4Ce37FE67DcAEa7950D379CB89A36867d', - seller: '0xB8D851486d1C953e31A44374ACa11151D49B8bb3', - amount: 6, - expirationTime: moment(Date.now() + 60000), - rating: 0, - released: false, - canceled: false, - paid: false - }, - { - escrowId: 2, - buyer: '0xBa31E1a4Ce37FE67DcAEa7950D379CB89A36867d', - seller: '0xB8D851486d1C953e31A44374ACa11151D49B8bb3', - amount: 2, - expirationTime: moment(Date.now() - 60000), - rating: 0, - released: false, - canceled: false, - paid: false - }, - { - escrowId: 3, - buyer: '0xBa31E1a4Ce37FE67DcAEa7950D379CB89A36867d', - seller: '0xB8D851486d1C953e31A44374ACa11151D49B8bb3', - amount: 2, - expirationTime: moment(Date.now() - 60000), - rating: 0, - released: false, - canceled: false, - paid: true - }, - { - escrowId: 4, - buyer: '0xBa31E1a4Ce37FE67DcAEa7950D379CB89A36867d', - seller: '0xB8D851486d1C953e31A44374ACa11151D49B8bb3', - amount: 8, - expirationTime: moment(Date.now() - 60000), - rating: 0, - released: false, - canceled: true, - paid: false - }, - { - escrowId: 5, - buyer: '0xBa31E1a4Ce37FE67DcAEa7950D379CB89A36867d', - seller: '0xB8D851486d1C953e31A44374ACa11151D49B8bb3', - amount: 8, - arbitration: {open: true, result: "0"}, - expirationTime: moment(Date.now() - 60000), - rating: 0, - paid: true, - released: false, - canceled: false - }, - { - escrowId: 6, - buyer: '0xBa31E1a4Ce37FE67DcAEa7950D379CB89A36867d', - seller: '0xB8D851486d1C953e31A44374ACa11151D49B8bb3', - amount: 8, - arbitration: {open: true, result: "1"}, - expirationTime: moment(Date.now() - 60000), - rating: 0, - paid: true, - released: false, - canceled: false - } -]; - -const sellerEscrows = cloneDeep(escrows); - -sellerEscrows.forEach(escrow => { - const buyer = escrow.buyer; - escrow.buyer = escrow.seller; - escrow.seller = buyer; -}); - -const info = {inline: true, propTables: [EscrowList.WrappedComponent]}; - -storiesOf('tmp/EscrowList', module) - .add( - "Buyer List", - withInfo(info)(() => ( - - )) - ) - .add( - "Seller List", - withInfo(info)(() => ( - - )) - ) - .add( - "Loading List", - withInfo(info)(() => ( - - )) - ) - .add( - "Error doing something", - withInfo(info)(() => ( - - )) - ) - .add( - "List with tx hash", - withInfo(info)(() => ( - - )) - ) - .add( - "Empty list", - withInfo(info)(() => ( - - )) - ); diff --git a/stories/tmp/license.stories.jsx b/stories/tmp/license.stories.jsx deleted file mode 100644 index 837bfaf3..00000000 --- a/stories/tmp/license.stories.jsx +++ /dev/null @@ -1,47 +0,0 @@ -import React from 'react'; - -import { storiesOf } from '@storybook/react'; -import { withKnobs, number } from '@storybook/addon-knobs'; -import { withInfo } from "@storybook/addon-info"; -import { action } from '@storybook/addon-actions'; - -import License from '../../src/js/components/tmp/License'; - -const info = {inline: true, propTables: [License.WrappedComponent]}; - -const stories = storiesOf('tmp/License', module); - -stories.addDecorator(withKnobs); - -stories - .add( - "Display License", - withInfo(info)(() => ( - - )) - ) - .add( - "Display License when already own one (no rating)", - withInfo({ inline: true })(() => ( - - )) - ) - .add( - "Display License when already own one", - withInfo({ inline: true })(() => ( - - )) - ) - .add( - "Buying License", - withInfo({ inline: true })(() => ( - - )) - ) - .add( - "Buying License with Hash", - withInfo({ inline: true })(() => ( - - )) - ); -