2016-06-17 01:55:22 +02:00
|
|
|
const inherits = require('util').inherits
|
|
|
|
const Component = require('react').Component
|
|
|
|
const h = require('react-hyperscript')
|
|
|
|
const connect = require('react-redux').connect
|
|
|
|
const actions = require('../actions')
|
2016-07-01 06:46:19 +02:00
|
|
|
const ReactMarkdown = require('react-markdown')
|
2016-06-17 01:55:22 +02:00
|
|
|
const fs = require('fs')
|
|
|
|
const path = require('path')
|
2016-07-01 05:54:51 +02:00
|
|
|
const disclaimer = fs.readFileSync(path.join(__dirname, '..', '..', '..', 'USER_AGREEMENT.md')).toString()
|
2016-06-17 01:55:22 +02:00
|
|
|
module.exports = connect(mapStateToProps)(DisclaimerScreen)
|
|
|
|
|
2016-06-21 22:18:32 +02:00
|
|
|
function mapStateToProps (state) {
|
2016-06-17 01:55:22 +02:00
|
|
|
return {}
|
|
|
|
}
|
|
|
|
|
|
|
|
inherits(DisclaimerScreen, Component)
|
2016-06-21 22:18:32 +02:00
|
|
|
function DisclaimerScreen () {
|
2016-06-17 01:55:22 +02:00
|
|
|
Component.call(this)
|
|
|
|
}
|
|
|
|
|
2016-06-21 22:18:32 +02:00
|
|
|
DisclaimerScreen.prototype.render = function () {
|
2016-10-05 11:42:19 +02:00
|
|
|
const state = this.state || {disclaimerDisabled: true}
|
|
|
|
const disabled = state.disclaimerDisabled
|
|
|
|
|
2016-06-17 01:55:22 +02:00
|
|
|
return (
|
|
|
|
h('.flex-column.flex-center.flex-grow', [
|
|
|
|
|
2016-07-01 08:50:20 +02:00
|
|
|
h('h3.flex-center.text-transform-uppercase.terms-header', {
|
2016-06-17 01:55:22 +02:00
|
|
|
style: {
|
|
|
|
background: '#EBEBEB',
|
|
|
|
color: '#AEAEAE',
|
|
|
|
marginBottom: 24,
|
|
|
|
width: '100%',
|
|
|
|
fontSize: '20px',
|
2016-07-01 08:50:20 +02:00
|
|
|
textAlign: 'center',
|
2016-06-17 01:55:22 +02:00
|
|
|
padding: 6,
|
|
|
|
},
|
|
|
|
}, [
|
|
|
|
'MetaMask Terms & Conditions',
|
|
|
|
]),
|
|
|
|
|
2016-07-01 08:15:45 +02:00
|
|
|
h('style', `
|
|
|
|
|
|
|
|
.markdown {
|
|
|
|
font-family: Times New Roman;
|
2016-10-05 06:03:14 +02:00
|
|
|
overflow-x: hidden;
|
2016-07-01 08:15:45 +02:00
|
|
|
}
|
2016-07-01 08:50:20 +02:00
|
|
|
.markdown h1, .markdown h2, .markdown h3 {
|
2016-07-01 08:15:45 +02:00
|
|
|
margin: 10px 0;
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
|
2016-10-05 03:39:54 +02:00
|
|
|
.markdown strong {
|
|
|
|
font-weight: bold;
|
|
|
|
}
|
|
|
|
.markdown em {
|
|
|
|
font-style: italic;
|
|
|
|
}
|
|
|
|
|
2016-10-05 03:45:01 +02:00
|
|
|
.markdown p {
|
|
|
|
margin: 10px 0;
|
|
|
|
}
|
|
|
|
|
2016-10-05 06:03:14 +02:00
|
|
|
.markdown a {
|
|
|
|
color: blue;
|
|
|
|
}
|
|
|
|
|
2016-07-01 08:15:45 +02:00
|
|
|
`),
|
|
|
|
|
|
|
|
h('div.markdown', {
|
2016-10-05 02:42:17 +02:00
|
|
|
onScroll: (e) => {
|
|
|
|
var object = e.currentTarget
|
2016-10-05 11:42:19 +02:00
|
|
|
if (object.offsetHeight + object.scrollTop + 100 >= object.scrollHeight) {
|
|
|
|
this.setState({disclaimerDisabled: false})
|
2016-10-05 02:42:17 +02:00
|
|
|
}
|
|
|
|
},
|
2016-06-17 01:55:22 +02:00
|
|
|
style: {
|
|
|
|
background: 'rgb(235, 235, 235)',
|
2016-06-28 20:38:29 +02:00
|
|
|
height: '310px',
|
2016-06-17 02:11:13 +02:00
|
|
|
padding: '6px',
|
2016-06-17 01:55:22 +02:00
|
|
|
width: '80%',
|
|
|
|
overflowY: 'scroll',
|
2016-06-21 22:18:32 +02:00
|
|
|
},
|
2016-07-01 06:46:19 +02:00
|
|
|
}, [
|
|
|
|
|
|
|
|
h(ReactMarkdown, {
|
|
|
|
source: disclaimer,
|
|
|
|
skipHtml: true,
|
|
|
|
}),
|
|
|
|
|
|
|
|
]),
|
2016-06-17 01:55:22 +02:00
|
|
|
|
2016-10-05 11:42:19 +02:00
|
|
|
h('button', {
|
2016-06-17 01:55:22 +02:00
|
|
|
style: { marginTop: '18px' },
|
2016-10-12 00:50:02 +02:00
|
|
|
disabled,
|
2016-06-21 22:18:32 +02:00
|
|
|
onClick: () => this.props.dispatch(actions.agreeToDisclaimer()),
|
2016-10-05 11:42:19 +02:00
|
|
|
}, disabled ? 'Scroll Down to Enable' : 'I Agree'),
|
2016-06-17 01:55:22 +02:00
|
|
|
])
|
|
|
|
)
|
|
|
|
}
|