Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Commit

Permalink
feat(dispute): use new evidence shape with submitter info
Browse files Browse the repository at this point in the history
  • Loading branch information
epiqueras committed Feb 14, 2018
1 parent a323b8b commit 58143f2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
16 changes: 7 additions & 9 deletions src/containers/dispute/components/evidence/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import LabelValueGroup from '../../../../components/label-value-group'

import './evidence.css'

const Evidence = ({ date, partyAddress, URIs }) => (
const Evidence = ({ date, partyAddress, URI }) => (
<div className="Evidence">
<small>
{dateToString(date, { withTime: false, numericMonth: false })}
Expand All @@ -17,13 +17,11 @@ const Evidence = ({ date, partyAddress, URIs }) => (
{ label: 'By', value: partyAddress, identiconSeed: partyAddress }
]}
/>
{URIs.map(URI => (
<div key={URI} className="Evidence-file">
<a href={URI} target="_blank">
{URI.slice(URI.lastIndexOf('/') + 1)}
</a>
</div>
))}
<div key={URI} className="Evidence-file">
<a href={URI} target="_blank">
{URI.slice(URI.lastIndexOf('/') + 1)}
</a>
</div>
<hr />
</div>
)
Expand All @@ -32,7 +30,7 @@ Evidence.propTypes = {
// State
date: PropTypes.instanceOf(Date).isRequired,
partyAddress: PropTypes.string.isRequired,
URIs: PropTypes.arrayOf(PropTypes.string.isRequired).isRequired
URI: PropTypes.string.isRequired
}

export default Evidence
10 changes: 5 additions & 5 deletions src/containers/dispute/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,17 @@ class Dispute extends PureComponent {
/>
)
},
{
...dispute.data.evidence.map(e => ({
anchor: 'Evidence',
element: (
<Evidence
key={2}
key={e.url}
date={new Date()}
partyAddress={dispute.data.partyA}
URIs={dispute.data.evidence}
partyAddress={e.submitter}
URI={e.url}
/>
)
},
})),
{
anchor: 'Ruling',
element: (
Expand Down
11 changes: 9 additions & 2 deletions src/reducers/dispute.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import PropTypes from 'prop-types'

import createReducer, { createResource } from '../utils/redux'

// Reusable Shapes
// Base Shapes
const dispute = PropTypes.shape({
disputeId: PropTypes.number.isRequired,
disputeState: PropTypes.number.isRequired,
Expand All @@ -16,7 +16,14 @@ const dispute = PropTypes.shape({
partyA: PropTypes.string.isRequired,
partyB: PropTypes.string.isRequired,
email: PropTypes.string.isRequired,
evidence: PropTypes.arrayOf(PropTypes.string.isRequired).isRequired,
evidence: PropTypes.arrayOf(
PropTypes.shape({
submitter: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
description: PropTypes.string.isRequired,
url: PropTypes.string.isRequired
}).isRequired
).isRequired,
session: PropTypes.number.isRequired,
isJuror: PropTypes.bool.isRequired,
hasRuled: PropTypes.bool.isRequired,
Expand Down

0 comments on commit 58143f2

Please sign in to comment.