diff --git a/src/js/features/escrow/helpers.js b/src/js/features/escrow/helpers.js index ef550ca1..92f2f0d4 100644 --- a/src/js/features/escrow/helpers.js +++ b/src/js/features/escrow/helpers.js @@ -1,5 +1,7 @@ +import {ARBITRATION_UNSOLVED} from "../arbitration/constants"; + export const tradeStates = { - released: 'released', + released: 'released', funded: 'funded', paid: 'paid', arbitration_open: 'arbitration_open', @@ -23,7 +25,7 @@ export function getTradeStatus(trade) { case escrowStatus.FUNDED: return tradeStates.funded; case escrowStatus.PAID: { if(trade.arbitration && trade.arbitration.open){ - if(trade.arbitration.result !== "0"){ + if(trade.arbitration.result !== ARBITRATION_UNSOLVED){ return tradeStates.arbitration_closed; } return tradeStates.arbitration_open; diff --git a/src/js/pages/Arbitration/index.jsx b/src/js/pages/Arbitration/index.jsx index 5bd8d5b6..d83feb9d 100644 --- a/src/js/pages/Arbitration/index.jsx +++ b/src/js/pages/Arbitration/index.jsx @@ -152,7 +152,7 @@ class Arbitration extends Component {

Dispute Details {status}

- {escrow.arbitration.result.toString() !== "0" && + {escrow.arbitration.result.toString() !== ARBITRATION_UNSOLVED &&

Dispute resolved

Winner: {escrow.arbitration.result.toString() === ARBITRATION_SOLVED_BUYER ? 'Buyer' : 'Seller'}

} diff --git a/src/js/pages/Escrow/components/CardEscrowBuyer.jsx b/src/js/pages/Escrow/components/CardEscrowBuyer.jsx index 6989f5d6..0d433a5a 100644 --- a/src/js/pages/Escrow/components/CardEscrowBuyer.jsx +++ b/src/js/pages/Escrow/components/CardEscrowBuyer.jsx @@ -19,7 +19,7 @@ import four from "../../../../images/escrow/04.png"; import Dispute from "./Dispute"; import ResolvedDispute from "./ResolvedDispute"; -import {ARBITRATION_SOLVED_BUYER} from "../../../features/arbitration/constants"; +import {ARBITRATION_SOLVED_BUYER, ARBITRATION_UNSOLVED} from "../../../features/arbitration/constants"; const Done = ({trade, rateTransaction, rateStatus}) => ( @@ -132,8 +132,8 @@ class CardEscrowBuyer extends Component { if (arbitrationDetails && arbitrationDetails.open && arbitrationDetails.result.toString() === "0") { component = ; } - if (arbitrationDetails && arbitrationDetails.result.toString() !== "0") { - component = ; + if (arbitrationDetails && arbitrationDetails.result.toString() !== ARBITRATION_UNSOLVED) { + component = ; } } diff --git a/src/js/pages/Escrow/components/CardEscrowSeller.jsx b/src/js/pages/Escrow/components/CardEscrowSeller.jsx index 819e44c2..1a3b8095 100644 --- a/src/js/pages/Escrow/components/CardEscrowSeller.jsx +++ b/src/js/pages/Escrow/components/CardEscrowSeller.jsx @@ -17,7 +17,7 @@ import two from "../../../../images/escrow/02.png"; import four from "../../../../images/escrow/04.png"; import Loading from "../../../components/Loading"; import ResolvedDispute from "./ResolvedDispute"; -import {ARBITRATION_SOLVED_SELLER} from "../../../features/arbitration/constants"; +import {ARBITRATION_SOLVED_SELLER, ARBITRATION_UNSOLVED} from "../../../features/arbitration/constants"; import Dispute from "./Dispute"; @@ -173,7 +173,7 @@ class CardEscrowSeller extends Component { if (releaseStatus === States.pending || (trade.mining && (trade.status === escrow.helpers.tradeStates.funded || trade.status === escrow.helpers.tradeStates.paid))) step = 5; if (releaseStatus === States.success || trade.status === escrow.helpers.tradeStates.released) step = 6; if (arbitrationDetails && arbitrationDetails.open && arbitrationDetails.result.toString() === "0") step = 10; - if (arbitrationDetails && arbitrationDetails.result.toString() !== "0") step = 11; + if (arbitrationDetails && arbitrationDetails.result.toString() !== ARBITRATION_UNSOLVED) step = 11; let component; switch (step) { @@ -181,7 +181,7 @@ class CardEscrowSeller extends Component { component = ; break; case 11: - component = ; + component = ; break; case 6: component = ; diff --git a/src/js/pages/Escrow/components/ResolvedDispute.jsx b/src/js/pages/Escrow/components/ResolvedDispute.jsx index 8d0f89d8..85784bba 100644 --- a/src/js/pages/Escrow/components/ResolvedDispute.jsx +++ b/src/js/pages/Escrow/components/ResolvedDispute.jsx @@ -3,16 +3,17 @@ import PropTypes from 'prop-types'; import {faTimes, faCheck} from "@fortawesome/free-solid-svg-icons"; import RoundedIcon from "../../../ui/RoundedIcon"; -const ResolvedDispute = ({winner}) => ( +const ResolvedDispute = ({winner, isBuyer}) => (

Dispute Resolved

-

The dispute was resolved and you are the {winner ? 'winner' : 'loser'}

+

The dispute was resolved {winner ? 'in your favor' : `in favor of the ${isBuyer ? 'seller' : 'buyer'}`}

); ResolvedDispute.propTypes = { - winner: PropTypes.bool + winner: PropTypes.bool, + isBuyer: PropTypes.bool }; export default ResolvedDispute; diff --git a/src/js/pages/OpenDispute/index.jsx b/src/js/pages/OpenDispute/index.jsx index 0498cf95..06d22e46 100644 --- a/src/js/pages/OpenDispute/index.jsx +++ b/src/js/pages/OpenDispute/index.jsx @@ -9,6 +9,7 @@ import {withRouter} from "react-router-dom"; import {connect} from "react-redux"; import arbitration from '../../features/arbitration'; import successImage from '../../../images/success.png'; +import {ARBITRATION_UNSOLVED} from "../../features/arbitration/constants"; class OpenDispute extends Component { state = { @@ -23,7 +24,7 @@ class OpenDispute extends Component { componentDidUpdate() { if (this.props.escrow.arbitration) { - if(this.props.escrow.arbitration.open || this.props.escrow.arbitration.result !== "0"){ + if(this.props.escrow.arbitration.open || this.props.escrow.arbitration.result !== ARBITRATION_UNSOLVED){ this.props.history.push('/'); } }