1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-30 16:18:07 +01:00
metamask-extension/ui/app/first-time/disclaimer.js

86 lines
2.2 KiB
JavaScript
Raw Normal View History

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-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-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-family: arial sans-serif;
font-weight: bold;
}
`),
h('div.markdown', {
onScroll: (e) => {
var object = e.currentTarget
if (object.offsetHeight + object.scrollTop + 100 >= object.scrollHeight) {
var button = document.getElementById('agree')
button.disabled = false
button.addEventListener('click', () => this.props.dispatch(actions.agreeToDisclaimer()))
}
},
2016-06-17 01:55:22 +02:00
style: {
2016-07-01 06:46:19 +02:00
// whiteSpace: 'pre-line',
2016-06-17 01:55:22 +02:00
background: 'rgb(235, 235, 235)',
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
h('button#agree', {
2016-06-17 01:55:22 +02:00
style: { marginTop: '18px' },
disabled: true,
2016-06-21 22:18:32 +02:00
onClick: () => this.props.dispatch(actions.agreeToDisclaimer()),
}, 'I Agree'),
2016-06-17 01:55:22 +02:00
])
)
}