This repository has been archived by the owner on Jul 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.js
67 lines (56 loc) · 1.61 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import React, { Component } from 'react'
import { ArbitrablePermissionList } from 'kleros-api/lib/contracts/implementations/arbitrable'
import { eth, env } from '../../../bootstrap/dapp-api'
import LinkBox from '../../link-box'
import './doges-on-trial-evidence.css'
class DogesOnTrialEvidence extends Component {
state = {
evidence: null
}
componentDidMount() {
window.onmessage = this.receiveEvidence.bind(this)
window.parent.postMessage(
{
target: 'evidence',
loaded: true
},
'*'
)
}
async receiveEvidence(message) {
if (message.data && message.data.target === 'evidence') {
const arbitrablePermissionList = new ArbitrablePermissionList(
eth.currentProvider,
message.data.arbitrableContractAddress
)
const itemHash = await arbitrablePermissionList.getItemByDisputeId(
message.data.disputeID
)
message.data.metaEvidence.fileURI =
process.env[`REACT_APP_${env}_DOGE_IMAGES_BASE_URL`] + itemHash
this.setState({
evidence: message.data
})
}
}
render() {
const { evidence } = this.state
if (!evidence) return null
const uri = evidence.metaEvidence.fileURI
return (
<div className="DogesOnTrialEvidence">
<h4>The Doge in Question:</h4>
<div className="DogesOnTrialEvidence-picture">
<a
className="DogesOnTrialEvidence-picture-link"
href={ uri }
target="_blank"
>
<LinkBox link={ uri } />
</a>
</div>
</div>
)
}
}
export default DogesOnTrialEvidence