mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 01:39:44 +01:00
Merge pull request #1140 from MetaMask/i1128-noticesdev
Add notice functionality
This commit is contained in:
commit
838d19e17f
File diff suppressed because one or more lines are too long
@ -9,6 +9,23 @@ QUnit.test('render init screen', function (assert) {
|
|||||||
wait().then(function() {
|
wait().then(function() {
|
||||||
app = $('iframe').contents().find('#app-content .mock-app-root')
|
app = $('iframe').contents().find('#app-content .mock-app-root')
|
||||||
|
|
||||||
|
const recurseNotices = function () {
|
||||||
|
let button = app.find('button')
|
||||||
|
if (button.html() === 'Continue') {
|
||||||
|
let termsPage = app.find('.markdown')[0]
|
||||||
|
termsPage.scrollTop = termsPage.scrollHeight
|
||||||
|
return wait().then(() => {
|
||||||
|
button.click()
|
||||||
|
return wait()
|
||||||
|
}).then(() => {
|
||||||
|
return recurseNotices()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
return wait()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return recurseNotices()
|
||||||
|
}).then(function() {
|
||||||
// Scroll through terms
|
// Scroll through terms
|
||||||
var title = app.find('h1').text()
|
var title = app.find('h1').text()
|
||||||
assert.equal(title, 'MetaMask', 'title screen')
|
assert.equal(title, 'MetaMask', 'title screen')
|
||||||
|
@ -350,7 +350,7 @@ App.prototype.renderPrimary = function () {
|
|||||||
var props = this.props
|
var props = this.props
|
||||||
|
|
||||||
// notices
|
// notices
|
||||||
if (!props.noActiveNotices && !global.METAMASK_DEBUG) {
|
if (!props.noActiveNotices) {
|
||||||
log.debug('rendering notice screen for unread notices.')
|
log.debug('rendering notice screen for unread notices.')
|
||||||
return h(NoticeScreen, {
|
return h(NoticeScreen, {
|
||||||
notice: props.lastUnreadNotice,
|
notice: props.lastUnreadNotice,
|
||||||
|
@ -15,10 +15,12 @@ function Notice () {
|
|||||||
Notice.prototype.render = function () {
|
Notice.prototype.render = function () {
|
||||||
const { notice, onConfirm } = this.props
|
const { notice, onConfirm } = this.props
|
||||||
const { title, date, body } = notice
|
const { title, date, body } = notice
|
||||||
|
const state = this.state || { disclaimerDisabled: true }
|
||||||
|
const disabled = state.disclaimerDisabled
|
||||||
|
|
||||||
return (
|
return (
|
||||||
h('.flex-column.flex-center.flex-grow', [
|
h('.flex-column.flex-center.flex-grow', [
|
||||||
h('h3.flex-center.text-transform-uppercacse.terms-header', {
|
h('h3.flex-center.text-transform-uppercase.terms-header', {
|
||||||
style: {
|
style: {
|
||||||
background: '#EBEBEB',
|
background: '#EBEBEB',
|
||||||
color: '#AEAEAE',
|
color: '#AEAEAE',
|
||||||
@ -31,7 +33,7 @@ Notice.prototype.render = function () {
|
|||||||
title,
|
title,
|
||||||
]),
|
]),
|
||||||
|
|
||||||
h('h5.flex-center.text-transform-uppercacse.terms-header', {
|
h('h5.flex-center.text-transform-uppercase.terms-header', {
|
||||||
style: {
|
style: {
|
||||||
background: '#EBEBEB',
|
background: '#EBEBEB',
|
||||||
color: '#AEAEAE',
|
color: '#AEAEAE',
|
||||||
@ -74,6 +76,12 @@ Notice.prototype.render = function () {
|
|||||||
`),
|
`),
|
||||||
|
|
||||||
h('div.markdown', {
|
h('div.markdown', {
|
||||||
|
onScroll: (e) => {
|
||||||
|
var object = e.currentTarget
|
||||||
|
if (object.offsetHeight + object.scrollTop + 100 >= object.scrollHeight) {
|
||||||
|
this.setState({disclaimerDisabled: false})
|
||||||
|
}
|
||||||
|
},
|
||||||
style: {
|
style: {
|
||||||
background: 'rgb(235, 235, 235)',
|
background: 'rgb(235, 235, 235)',
|
||||||
height: '310px',
|
height: '310px',
|
||||||
@ -90,6 +98,7 @@ Notice.prototype.render = function () {
|
|||||||
]),
|
]),
|
||||||
|
|
||||||
h('button', {
|
h('button', {
|
||||||
|
disabled,
|
||||||
onClick: onConfirm,
|
onClick: onConfirm,
|
||||||
style: {
|
style: {
|
||||||
marginTop: '18px',
|
marginTop: '18px',
|
||||||
|
Loading…
Reference in New Issue
Block a user