From 83880a5c92df6024e3420ecf19d55585f5d2b185 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Thu, 15 Dec 2016 16:09:39 -0800 Subject: Remove morden testnet provider Instances configured to point at Morden will now point at Ropsten. --- ui/app/app.js | 9 --------- ui/app/components/drop-menu-item.js | 3 --- ui/app/components/network.js | 12 ------------ ui/app/config.js | 2 +- 4 files changed, 1 insertion(+), 25 deletions(-) (limited to 'ui') diff --git a/ui/app/app.js b/ui/app/app.js index 3a3b234cc..0646e3165 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -243,15 +243,6 @@ App.prototype.renderNetworkDropdown = function () { provider: props.provider, }), - h(DropMenuItem, { - label: 'Morden Test Network', - closeMenu: () => this.setState({ isNetworkMenuOpen: false }), - action: () => props.dispatch(actions.setProviderType('morden')), - icon: h('.menu-icon.red-dot'), - activeNetworkRender: props.network, - provider: props.provider, - }), - h(DropMenuItem, { label: 'Localhost 8545', closeMenu: () => this.setState({ isNetworkMenuOpen: false }), diff --git a/ui/app/components/drop-menu-item.js b/ui/app/components/drop-menu-item.js index b82114f03..ac0aecadd 100644 --- a/ui/app/components/drop-menu-item.js +++ b/ui/app/components/drop-menu-item.js @@ -44,9 +44,6 @@ DropMenuItem.prototype.activeNetworkRender = function () { case 'Ropsten Test Network': if (provider.type === 'testnet') return h('.check', '✓') break - case 'Morden Test Network': - if (provider.type === 'morden') return h('.check', '✓') - break case 'Localhost 8545': if (activeNetwork === 'http://localhost:8545') return h('.check', '✓') break diff --git a/ui/app/components/network.js b/ui/app/components/network.js index b7d3cdbf5..1f61ef73f 100644 --- a/ui/app/components/network.js +++ b/ui/app/components/network.js @@ -42,9 +42,6 @@ Network.prototype.render = function () { } else if (parseInt(networkNumber) === 3) { hoverText = 'Ropsten Test Network' iconName = 'ropsten-test-network' - } else if (parseInt(networkNumber) === 2) { - hoverText = 'Morden Test Network' - iconName = 'morden-test-network' } else { hoverText = 'Unknown Private Network' iconName = 'unknown-private-network' @@ -79,15 +76,6 @@ Network.prototype.render = function () { }}, 'Ropsten Test Net'), ]) - case 'morden-test-network': - return h('.network-indicator', [ - h('.menu-icon.red-dot'), - h('.network-name', { - style: { - color: '#ff6666', - }}, - 'Morden Test Net'), - ]) default: return h('.network-indicator', [ h('i.fa.fa-question-circle.fa-lg', { diff --git a/ui/app/config.js b/ui/app/config.js index e09a38cd8..8824c6bec 100644 --- a/ui/app/config.js +++ b/ui/app/config.js @@ -133,7 +133,7 @@ function currentProviderDisplay (metamaskState) { case 'testnet': title = 'Current Network' - value = 'Morden Test Network' + value = 'Ropsten Test Network' break default: -- cgit v1.2.3 From 8819475a2ed2ee7c34e983ebb5ab12661be1a961 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Wed, 7 Dec 2016 14:34:15 -0800 Subject: Add ability to show notices to user & get confirmation. Implement generation of markdown for notice files. Create npm command. Enhance notice generation. Add test files to test multiple notices. Add basic markdown support to notices. Interval checks for updates. Add extensionizer and linker Add terms and conditions state file Add link support to disclaimer. Changelog addition. --- ui/app/actions.js | 44 +++++++++++++++++ ui/app/app.js | 7 +++ ui/app/first-time/disclaimer.js | 12 +++++ ui/app/notice.js | 105 ++++++++++++++++++++++++++++++++++++++++ ui/app/reducers/app.js | 6 +++ ui/app/reducers/metamask.js | 13 +++++ 6 files changed, 187 insertions(+) create mode 100644 ui/app/notice.js (limited to 'ui') diff --git a/ui/app/actions.js b/ui/app/actions.js index 3d9588083..7bf39081a 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -7,6 +7,13 @@ var actions = { // remote state UPDATE_METAMASK_STATE: 'UPDATE_METAMASK_STATE', updateMetamaskState: updateMetamaskState, + // notices + MARK_NOTICE_READ: 'MARK_NOTICE_READ', + markNoticeRead: markNoticeRead, + SHOW_NOTICE: 'SHOW_NOTICE', + showNotice: showNotice, + CLEAR_NOTICES: 'CLEAR_NOTICES', + clearNotices: clearNotices, // intialize screen AGREE_TO_DISCLAIMER: 'AGREE_TO_DISCLAIMER', agreeToDisclaimer: agreeToDisclaimer, @@ -519,6 +526,43 @@ function goBackToInitView () { } } +// +// notice +// + +function markNoticeRead (notice) { + return (dispatch) => { + dispatch(this.showLoadingIndication()) + background.markNoticeRead(notice, (err, notice) => { + dispatch(this.hideLoadingIndication()) + if (err) { + return dispatch(actions.showWarning(err)) + } + if (notice) { + return dispatch(actions.showNotice(notice)) + } else { + dispatch(this.clearNotices()) + return { + type: actions.SHOW_ACCOUNTS_PAGE, + } + } + }) + } +} + +function showNotice (notice) { + return { + type: actions.SHOW_NOTICE, + value: notice, + } +} + +function clearNotices () { + return { + type: actions.CLEAR_NOTICES, + } +} + // // config // diff --git a/ui/app/app.js b/ui/app/app.js index 0646e3165..422b3739c 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -17,6 +17,8 @@ const AccountsScreen = require('./accounts') const AccountDetailScreen = require('./account-detail') const SendTransactionScreen = require('./send') const ConfirmTxScreen = require('./conf-tx') +// notice +const NoticeScreen = require('./notice') // other views const ConfigScreen = require('./config') const RevealSeedConfirmation = require('./recover-seed/confirmation') @@ -41,6 +43,7 @@ function mapStateToProps (state) { isLoading: state.appState.isLoading, isConfirmed: state.metamask.isConfirmed, isEthConfirmed: state.metamask.isEthConfirmed, + noActiveNotices: state.metamask.noActiveNotices, isInitialized: state.metamask.isInitialized, isUnlocked: state.metamask.isUnlocked, currentView: state.appState.currentView, @@ -425,6 +428,10 @@ App.prototype.renderPrimary = function () { return h(UnlockScreen, {key: 'locked'}) } + if (!props.noActiveNotices) { + return h(NoticeScreen, {key: 'NoticeScreen'}) + } + // show current view switch (props.currentView.name) { case 'EthStoreWarning': diff --git a/ui/app/first-time/disclaimer.js b/ui/app/first-time/disclaimer.js index 819d4a110..a8bafd39b 100644 --- a/ui/app/first-time/disclaimer.js +++ b/ui/app/first-time/disclaimer.js @@ -6,6 +6,8 @@ const actions = require('../actions') const ReactMarkdown = require('react-markdown') const fs = require('fs') const path = require('path') +const linker = require('extension-link-enabler') +const findDOMNode = require('react-dom').findDOMNode const disclaimer = fs.readFileSync(path.join(__dirname, '..', '..', '..', 'USER_AGREEMENT.md')).toString() module.exports = connect(mapStateToProps)(DisclaimerScreen) @@ -98,3 +100,13 @@ DisclaimerScreen.prototype.render = function () { ]) ) } + +DisclaimerScreen.prototype.componentDidMount = function () { + var node = findDOMNode(this) + linker.setupListener(node) +} + +DisclaimerScreen.prototype.componentWillUnmount = function () { + var node = findDOMNode(this) + linker.teardownListener(node) +} diff --git a/ui/app/notice.js b/ui/app/notice.js new file mode 100644 index 000000000..5e6028cff --- /dev/null +++ b/ui/app/notice.js @@ -0,0 +1,105 @@ +const inherits = require('util').inherits +const Component = require('react').Component +const h = require('react-hyperscript') +const ReactMarkdown = require('react-markdown') +const connect = require('react-redux').connect +const actions = require('./actions') +const linker = require('extension-link-enabler') +const findDOMNode = require('react-dom').findDOMNode + +module.exports = connect(mapStateToProps)(Notice) + +function mapStateToProps (state) { + return { + lastUnreadNotice: state.metamask.lastUnreadNotice, + } +} + +inherits(Notice, Component) +function Notice () { + Component.call(this) +} + +Notice.prototype.render = function () { + const props = this.props + const title = props.lastUnreadNotice.title + + return ( + h('.flex-column.flex-center.flex-grow', [ + h('h3.flex-center.text-transform-uppercacse.terms-header', { + style: { + background: '#EBEBEB', + color: '#AEAEAE', + marginBottom: 24, + width: '100%', + fontSize: '20px', + textAlign: 'center', + padding: 6, + }, + }, [ + title, + ]), + + h('style', ` + + .markdown { + overflow-x: hidden; + } + .markdown h1, .markdown h2, .markdown h3 { + margin: 10px 0; + font-weight: bold; + } + + .markdown strong { + font-weight: bold; + } + .markdown em { + font-style: italic; + } + + .markdown p { + margin: 10px 0; + } + + .markdown a { + color: blue; + } + + `), + + h('div.markdown', { + style: { + background: 'rgb(235, 235, 235)', + height: '310px', + padding: '6px', + width: '90%', + overflowY: 'scroll', + scroll: 'auto', + }, + }, [ + `${props.lastUnreadNotice.title}`, + h(ReactMarkdown, { + source: props.lastUnreadNotice.body, + skipHtml: true, + }), + ]), + + h('button', { + onClick: () => props.dispatch(actions.markNoticeRead(props.lastUnreadNotice)), + style: { + marginTop: '18px', + }, + }, 'Continue'), + ]) + ) +} + +Notice.prototype.componentDidMount = function () { + var node = findDOMNode(this) + linker.setupListener(node) +} + +Notice.prototype.componentWillUnmount = function () { + var node = findDOMNode(this) + linker.teardownListener(node) +} diff --git a/ui/app/reducers/app.js b/ui/app/reducers/app.js index c2ac099a6..5c5c0acce 100644 --- a/ui/app/reducers/app.js +++ b/ui/app/reducers/app.js @@ -229,6 +229,12 @@ function reduceApp (state, action) { scrollToBottom: false, }) + case actions.SHOW_NOTICE: + return extend(appState, { + transForward: true, + isLoading: false, + }) + case actions.REVEAL_ACCOUNT: return extend(appState, { scrollToBottom: true, diff --git a/ui/app/reducers/metamask.js b/ui/app/reducers/metamask.js index 84953d734..9a1c5814d 100644 --- a/ui/app/reducers/metamask.js +++ b/ui/app/reducers/metamask.js @@ -17,6 +17,8 @@ function reduceMetamask (state, action) { currentFiat: 'USD', conversionRate: 0, conversionDate: 'N/A', + noActiveNotices: true, + lastUnreadNotice: undefined, }, state.metamask) switch (action.type) { @@ -26,6 +28,17 @@ function reduceMetamask (state, action) { delete newState.seedWords return newState + case actions.SHOW_NOTICE: + return extend(metamaskState, { + noActiveNotices: false, + lastUnreadNotice: action.value, + }) + + case actions.CLEAR_NOTICES: + return extend(metamaskState, { + noActiveNotices: true, + }) + case actions.UPDATE_METAMASK_STATE: return extend(metamaskState, action.value) -- cgit v1.2.3 From 851ba66cdd50aae8e2f9cb70fbed016990df2a2a Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Wed, 7 Dec 2016 14:34:15 -0800 Subject: Add ability to show notices to user & get confirmation. Implement generation of markdown for notice files. Create npm command. Enhance notice generation. Add test files to test multiple notices. Add basic markdown support to notices. Interval checks for updates. Add extensionizer and linker Add terms and conditions state file Add link support to disclaimer. Changelog addition. --- ui/app/actions.js | 2 +- ui/app/app.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/app/actions.js b/ui/app/actions.js index 7bf39081a..07df5ada2 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -533,7 +533,7 @@ function goBackToInitView () { function markNoticeRead (notice) { return (dispatch) => { dispatch(this.showLoadingIndication()) - background.markNoticeRead(notice, (err, notice) => { + _accountManager.markNoticeRead(notice, (err, notice) => { dispatch(this.hideLoadingIndication()) if (err) { return dispatch(actions.showWarning(err)) diff --git a/ui/app/app.js b/ui/app/app.js index 422b3739c..aa0b814d2 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -432,6 +432,10 @@ App.prototype.renderPrimary = function () { return h(NoticeScreen, {key: 'NoticeScreen'}) } + if (!props.noActiveNotices) { + return h(NoticeScreen, {key: 'NoticeScreen'}) + } + // show current view switch (props.currentView.name) { case 'EthStoreWarning': -- cgit v1.2.3 From 4c390a622137b34687866ce0ec937b8dd54a3c1a Mon Sep 17 00:00:00 2001 From: kumavis Date: Fri, 16 Dec 2016 11:58:15 -0800 Subject: clean - code style --- ui/app/app.js | 4 ---- 1 file changed, 4 deletions(-) (limited to 'ui') diff --git a/ui/app/app.js b/ui/app/app.js index aa0b814d2..422b3739c 100644 --- a/ui/app/app.js +++ b/ui/app/app.js @@ -432,10 +432,6 @@ App.prototype.renderPrimary = function () { return h(NoticeScreen, {key: 'NoticeScreen'}) } - if (!props.noActiveNotices) { - return h(NoticeScreen, {key: 'NoticeScreen'}) - } - // show current view switch (props.currentView.name) { case 'EthStoreWarning': -- cgit v1.2.3 From 8d0f4c27991bb042562913a514054396abf4f917 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Fri, 16 Dec 2016 13:31:12 -0800 Subject: Add date to notices display. --- ui/app/notice.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/app/notice.js b/ui/app/notice.js index 5e6028cff..0b59ebef8 100644 --- a/ui/app/notice.js +++ b/ui/app/notice.js @@ -23,6 +23,7 @@ function Notice () { Notice.prototype.render = function () { const props = this.props const title = props.lastUnreadNotice.title + const date = props.lastUnreadNotice.date return ( h('.flex-column.flex-center.flex-grow', [ @@ -30,7 +31,6 @@ Notice.prototype.render = function () { style: { background: '#EBEBEB', color: '#AEAEAE', - marginBottom: 24, width: '100%', fontSize: '20px', textAlign: 'center', @@ -40,6 +40,20 @@ Notice.prototype.render = function () { title, ]), + h('h5.flex-center.text-transform-uppercacse.terms-header', { + style: { + background: '#EBEBEB', + color: '#AEAEAE', + marginBottom: 24, + width: '100%', + fontSize: '20px', + textAlign: 'center', + padding: 6, + }, + }, [ + date, + ]), + h('style', ` .markdown { -- cgit v1.2.3 From a5024aa372c34964a46810b112667ec6a8e389f1 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Fri, 16 Dec 2016 13:40:32 -0800 Subject: Clean up first notice Remove redundant title from notice component. Make link color the same orange as the rest of the UI. --- ui/app/notice.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'ui') diff --git a/ui/app/notice.js b/ui/app/notice.js index 0b59ebef8..3c2c746f2 100644 --- a/ui/app/notice.js +++ b/ui/app/notice.js @@ -76,7 +76,7 @@ Notice.prototype.render = function () { } .markdown a { - color: blue; + color: #df6b0e; } `), @@ -91,7 +91,6 @@ Notice.prototype.render = function () { scroll: 'auto', }, }, [ - `${props.lastUnreadNotice.title}`, h(ReactMarkdown, { source: props.lastUnreadNotice.body, skipHtml: true, -- cgit v1.2.3