diff --git a/js/src/redux/providers/requestsActions.js b/js/src/redux/providers/requestsActions.js index 6a011a0b0..fedfabc5e 100644 --- a/js/src/redux/providers/requestsActions.js +++ b/js/src/redux/providers/requestsActions.js @@ -19,7 +19,7 @@ import BigNumber from 'bignumber.js'; import { outTransaction } from '@parity/api/format/output'; import { trackRequest as trackRequestUtil, parseTransactionReceipt } from '~/util/tx'; -import SavedRequests from '~/shell/Application/Requests/savedRequests'; +import SavedRequests from '~/shell/Requests/savedRequests'; const savedRequests = new SavedRequests(); diff --git a/js/src/redux/reducers.js b/js/src/redux/reducers.js index 50d9e84c9..95a71f7ae 100644 --- a/js/src/redux/reducers.js +++ b/js/src/redux/reducers.js @@ -27,13 +27,11 @@ import certificationsReducer from './providers/certifications/reducer'; import registryReducer from './providers/registry/reducer'; import errorReducer from '~/ui/Errors/reducers'; -import tooltipReducer from '~/ui/Tooltips/reducers'; export default function () { return combineReducers({ api: apiReducer, errors: errorReducer, - tooltip: tooltipReducer, routing: routerReducer, settings: settingsReducer, diff --git a/js/src/shell/Application/Container/container.js b/js/src/shell/Application/Container/container.js deleted file mode 100644 index 43a76ad40..000000000 --- a/js/src/shell/Application/Container/container.js +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -import React, { PropTypes } from 'react'; - -import { Errors, Tooltips } from '~/ui'; - -import FirstRun from '../../FirstRun'; -import UpgradeParity from '../../UpgradeParity'; - -import styles from '../application.css'; - -export default function Container ({ children, onCloseFirstRun, showFirstRun, upgradeStore }) { - return ( -
- - - - - { children } -
- ); -} - -Container.propTypes = { - children: PropTypes.node.isRequired, - onCloseFirstRun: PropTypes.func, - showFirstRun: PropTypes.bool, - upgradeStore: PropTypes.object.isRequired -}; diff --git a/js/src/shell/Application/Container/index.js b/js/src/shell/Application/Container/index.js deleted file mode 100644 index 0deedaecc..000000000 --- a/js/src/shell/Application/Container/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -export default from './container'; diff --git a/js/src/shell/Application/DappContainer/dappContainer.js b/js/src/shell/Application/DappContainer/dappContainer.js deleted file mode 100644 index 51f8c34cc..000000000 --- a/js/src/shell/Application/DappContainer/dappContainer.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -import React, { PropTypes } from 'react'; - -import { Errors } from '~/ui'; - -import styles from '../application.css'; - -export default function DappContainer ({ children }) { - return ( -
- - { children } -
- ); -} - -DappContainer.propTypes = { - children: PropTypes.node.isRequired -}; diff --git a/js/src/shell/Application/DappContainer/index.js b/js/src/shell/Application/DappContainer/index.js deleted file mode 100644 index 6fa199541..000000000 --- a/js/src/shell/Application/DappContainer/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -export default from './dappContainer'; diff --git a/js/src/shell/Application/FrameError/frameError.css b/js/src/shell/Application/FrameError/frameError.css deleted file mode 100644 index bf3d76f99..000000000 --- a/js/src/shell/Application/FrameError/frameError.css +++ /dev/null @@ -1,21 +0,0 @@ -/* Copyright 2015-2017 Parity Technologies (UK) Ltd. -/* This file is part of Parity. -/* -/* Parity is free software: you can redistribute it and/or modify -/* it under the terms of the GNU General Public License as published by -/* the Free Software Foundation, either version 3 of the License, or -/* (at your option) any later version. -/* -/* Parity is distributed in the hope that it will be useful, -/* but WITHOUT ANY WARRANTY; without even the implied warranty of -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -/* GNU General Public License for more details. -/* -/* You should have received a copy of the GNU General Public License -/* along with Parity. If not, see . -*/ -.error { - padding: 2em; - background: red; - color: white; -} diff --git a/js/src/shell/Application/FrameError/frameError.js b/js/src/shell/Application/FrameError/frameError.js deleted file mode 100644 index 0a6d84c46..000000000 --- a/js/src/shell/Application/FrameError/frameError.js +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -import React from 'react'; -import { FormattedMessage } from 'react-intl'; - -import styles from './frameError.css'; - -export default function FrameError () { - return ( -
- -
- ); -} diff --git a/js/src/shell/Application/FrameError/index.js b/js/src/shell/Application/FrameError/index.js deleted file mode 100644 index 7b0ea95ea..000000000 --- a/js/src/shell/Application/FrameError/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -export default from './frameError'; diff --git a/js/src/shell/Application/application.css b/js/src/shell/Application/application.css index dc1754bd1..ea4029714 100644 --- a/js/src/shell/Application/application.css +++ b/js/src/shell/Application/application.css @@ -24,3 +24,9 @@ .content { padding-bottom: 1.25em; } + +.error { + padding: 2em; + background: red; + color: white; +} diff --git a/js/src/shell/Application/application.js b/js/src/shell/Application/application.js index 8603d6a89..8e32d0608 100644 --- a/js/src/shell/Application/application.js +++ b/js/src/shell/Application/application.js @@ -16,21 +16,22 @@ import { observer } from 'mobx-react'; import React, { Component, PropTypes } from 'react'; +import { FormattedMessage } from 'react-intl'; import { connect } from 'react-redux'; +import { Errors } from '~/ui'; + import Connection from '../Connection'; +import Extension from '../Extension'; +import FirstRun from '../FirstRun'; import ParityBar from '../ParityBar'; +import Requests from '../Requests'; +import Snackbar from '../Snackbar'; +import Status from '../Status'; +import UpgradeParity from '../UpgradeParity'; import UpgradeStore from '../UpgradeParity/store'; -import Snackbar from './Snackbar'; -import Container from './Container'; -import DappContainer from './DappContainer'; -import Extension from './Extension'; -import FrameError from './FrameError'; -import Requests from './Requests'; -import Status from './Status'; import Store from './store'; - import styles from './application.css'; const inFrame = window.parent !== window && window.parent.frames.length !== 0; @@ -55,17 +56,14 @@ class Application extends Component { const [root] = (window.location.hash || '').replace('#/', '').split('/'); const isMinimized = root !== ''; - if (process.env.NODE_ENV !== 'production' && root === 'playground') { - return ( -
- { this.props.children } -
- ); - } - if (inFrame) { return ( - +
+ +
); } @@ -87,22 +85,24 @@ class Application extends Component { const { blockNumber, children } = this.props; return ( - -
- { children } -
+
+ + + + + { blockNumber ? : null } - - - +
+ { children } +
+
); } @@ -110,9 +110,10 @@ class Application extends Component { const { children } = this.props; return ( - +
+ { children } - +
); } } diff --git a/js/src/shell/Application/Extension/extension.css b/js/src/shell/Extension/extension.css similarity index 86% rename from js/src/shell/Application/Extension/extension.css rename to js/src/shell/Extension/extension.css index 98d094a9f..92864aef3 100644 --- a/js/src/shell/Application/Extension/extension.css +++ b/js/src/shell/Extension/extension.css @@ -15,32 +15,27 @@ /* along with Parity. If not, see . */ +$backgroundColor: #f80; +$buttonColor: rgba(0, 0, 0, 0.5); +$textColor: white; + .body { - background: #f80; + background: $backgroundColor; color: white; - opacity: 1; max-width: 500px; + opacity: 1; padding: 1em 4em 1em 2em; position: fixed; right: 1.5em; top: 1.5em; z-index: 1000; - .button { - background: rgba(0, 0, 0, 0.5); - color: white !important; - - svg { - fill: white !important; - } - } - .buttonrow { text-align: right; } p { - color: white; + color: $textColor; } .close { diff --git a/js/src/shell/Application/Extension/extension.js b/js/src/shell/Extension/extension.js similarity index 100% rename from js/src/shell/Application/Extension/extension.js rename to js/src/shell/Extension/extension.js diff --git a/js/src/shell/Application/Extension/index.js b/js/src/shell/Extension/index.js similarity index 100% rename from js/src/shell/Application/Extension/index.js rename to js/src/shell/Extension/index.js diff --git a/js/src/shell/Application/Extension/store.js b/js/src/shell/Extension/store.js similarity index 100% rename from js/src/shell/Application/Extension/store.js rename to js/src/shell/Extension/store.js diff --git a/js/src/shell/Application/Requests/index.js b/js/src/shell/Requests/index.js similarity index 100% rename from js/src/shell/Application/Requests/index.js rename to js/src/shell/Requests/index.js diff --git a/js/src/shell/Application/Requests/requests.css b/js/src/shell/Requests/requests.css similarity index 100% rename from js/src/shell/Application/Requests/requests.css rename to js/src/shell/Requests/requests.css diff --git a/js/src/shell/Application/Requests/requests.js b/js/src/shell/Requests/requests.js similarity index 100% rename from js/src/shell/Application/Requests/requests.js rename to js/src/shell/Requests/requests.js diff --git a/js/src/shell/Application/Requests/savedRequests.js b/js/src/shell/Requests/savedRequests.js similarity index 100% rename from js/src/shell/Application/Requests/savedRequests.js rename to js/src/shell/Requests/savedRequests.js diff --git a/js/src/shell/Application/Requests/savedRequests.spec.js b/js/src/shell/Requests/savedRequests.spec.js similarity index 100% rename from js/src/shell/Application/Requests/savedRequests.spec.js rename to js/src/shell/Requests/savedRequests.spec.js diff --git a/js/src/shell/Application/Snackbar/index.js b/js/src/shell/Snackbar/index.js similarity index 100% rename from js/src/shell/Application/Snackbar/index.js rename to js/src/shell/Snackbar/index.js diff --git a/js/src/shell/Application/Snackbar/snackbar.js b/js/src/shell/Snackbar/snackbar.js similarity index 69% rename from js/src/shell/Application/Snackbar/snackbar.js rename to js/src/shell/Snackbar/snackbar.js index 8965d9f28..9d1865abe 100644 --- a/js/src/shell/Application/Snackbar/snackbar.js +++ b/js/src/shell/Snackbar/snackbar.js @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -import React, { Component, PropTypes } from 'react'; +import React, { PropTypes } from 'react'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; @@ -23,41 +23,32 @@ import { darkBlack, grey800 } from 'material-ui/styles/colors'; import { closeSnackbar } from '~/redux/providers/snackbarActions'; -const bodyStyle = { +const BODY_STYLE = { backgroundColor: darkBlack, borderStyle: 'solid', borderColor: grey800, borderWidth: '1px 1px 0 1px' }; -class Snackbar extends Component { - static propTypes = { - closeSnackbar: PropTypes.func.isRequired, - - open: PropTypes.bool, - cooldown: PropTypes.number, - message: PropTypes.any - }; - - render () { - const { open, message, cooldown } = this.props; - - return ( - - ); - } - - handleClose = () => { - this.props.closeSnackbar(); - } +function Snackbar ({ closeSnackbar, cooldown, message, open }) { + return ( + + ); } +Snackbar.propTypes = { + closeSnackbar: PropTypes.func.isRequired, + cooldown: PropTypes.number, + message: PropTypes.any, + open: PropTypes.bool +}; + function mapStateToProps (state) { const { open, message, cooldown } = state.snackbar; diff --git a/js/src/shell/Application/Status/Consensus/consensus.js b/js/src/shell/Status/Consensus/consensus.js similarity index 100% rename from js/src/shell/Application/Status/Consensus/consensus.js rename to js/src/shell/Status/Consensus/consensus.js diff --git a/js/src/shell/Application/Status/Consensus/index.js b/js/src/shell/Status/Consensus/index.js similarity index 100% rename from js/src/shell/Application/Status/Consensus/index.js rename to js/src/shell/Status/Consensus/index.js diff --git a/js/src/shell/Application/Status/Upgrade/index.js b/js/src/shell/Status/Upgrade/index.js similarity index 100% rename from js/src/shell/Application/Status/Upgrade/index.js rename to js/src/shell/Status/Upgrade/index.js diff --git a/js/src/shell/Application/Status/Upgrade/upgrade.js b/js/src/shell/Status/Upgrade/upgrade.js similarity index 100% rename from js/src/shell/Application/Status/Upgrade/upgrade.js rename to js/src/shell/Status/Upgrade/upgrade.js diff --git a/js/src/shell/Application/Status/index.js b/js/src/shell/Status/index.js similarity index 100% rename from js/src/shell/Application/Status/index.js rename to js/src/shell/Status/index.js diff --git a/js/src/shell/Application/Status/status.css b/js/src/shell/Status/status.css similarity index 81% rename from js/src/shell/Application/Status/status.css rename to js/src/shell/Status/status.css index 50b1c7317..144037356 100644 --- a/js/src/shell/Application/Status/status.css +++ b/js/src/shell/Status/status.css @@ -15,26 +15,28 @@ /* along with Parity. If not, see . */ +$backgroundColor: rgba(0, 0, 0, 0.8); +$textColor: #ccc; +$networkLiveColor: rgb(0, 136, 0); +$networkTestColor: rgb(136, 0, 0); + .status { align-items: center; - background-color: rgba(0, 0, 0, 0.8); + background-color: $backgroundColor; bottom: 0; - color: #ccc; + color: $textColor; display: flex; - font-size: 0.75em; left: 0; - padding: .4em .5em; + padding: 0.4em 0.5em; position: fixed; right: 0; z-index: 1000; } .netinfo { - color: #ddd; flex-grow: 1; text-align: right; vertical-align: middle; - text-align: right; div { display: inline-block; @@ -49,11 +51,11 @@ text-transform: uppercase; &.live { - background: rgb(0, 136, 0); + background: $networkLiveColor; } &.test { - background: rgb(136, 0, 0); + background: $networkTestColor; } } diff --git a/js/src/shell/Application/Status/status.js b/js/src/shell/Status/status.js similarity index 89% rename from js/src/shell/Application/Status/status.js rename to js/src/shell/Status/status.js index 4a1788543..a0ced9b5f 100644 --- a/js/src/shell/Application/Status/status.js +++ b/js/src/shell/Status/status.js @@ -25,10 +25,13 @@ import Upgrade from './Upgrade'; import styles from './status.css'; function Status ({ clientVersion, isTest, netChain, netPeers, upgradeStore }) { + const [ clientName, , versionString, , ] = (clientVersion || '').split('/'); + const [ versionNumber, versionType, , versionDate ] = (versionString || '').split('-'); + return (
- { clientVersion } + { clientName } { versionNumber }-{ versionDate } { versionType }
diff --git a/js/src/ui/Tooltips/Tooltip/index.js b/js/src/ui/Tooltips/Tooltip/index.js deleted file mode 100644 index 7128fc336..000000000 --- a/js/src/ui/Tooltips/Tooltip/index.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -export default from './tooltip'; diff --git a/js/src/ui/Tooltips/Tooltip/tooltip.js b/js/src/ui/Tooltips/Tooltip/tooltip.js deleted file mode 100644 index af3b5e0b3..000000000 --- a/js/src/ui/Tooltips/Tooltip/tooltip.js +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -import React, { Component, PropTypes } from 'react'; -import { FormattedMessage } from 'react-intl'; -import { connect } from 'react-redux'; -import { bindActionCreators } from 'redux'; -import { FlatButton } from 'material-ui'; - -import { CancelIcon, DoneIcon, NextIcon } from '~/ui/Icons'; -import { nodeOrStringProptype } from '~/util/proptypes'; - -import { newTooltip, nextTooltip, closeTooltips } from '../actions'; - -import styles from '../tooltips.css'; - -let tooltipId = 0; - -class Tooltip extends Component { - static propTypes = { - className: PropTypes.string, - currentId: PropTypes.number, - maxId: PropTypes.number, - onNewTooltip: PropTypes.func, - onNextTooltip: PropTypes.func, - onCloseTooltips: PropTypes.func, - right: PropTypes.bool, - text: nodeOrStringProptype(), - title: nodeOrStringProptype() - } - - state = { - id: tooltipId - } - - componentWillMount () { - const { onNewTooltip } = this.props; - - onNewTooltip(tooltipId); - tooltipId++; - } - - render () { - const { id } = this.state; - const { className, currentId, maxId, right, onCloseTooltips, onNextTooltip, text, title } = this.props; - - if (id !== currentId) { - return null; - } - - const buttons = id !== maxId - ? [ - } - key='skipButton' - label={ - - } - onTouchTap={ onCloseTooltips } - />, - } - key='nextButton' - label={ - - } - onTouchTap={ onNextTooltip } - /> - ] : ( - } - label={ - - } - onTouchTap={ onCloseTooltips } - /> - ); - - return ( -
-
- { title } -
-
- { text } -
-
- { buttons } -
-
- ); - } -} - -function mapStateToProps (state) { - const { currentId, maxId } = state.tooltip; - - return { - currentId, - maxId - }; -} - -function mapDispatchToProps (dispatch) { - return bindActionCreators({ - onNewTooltip: newTooltip, - onNextTooltip: nextTooltip, - onCloseTooltips: closeTooltips - }, dispatch); -} - -export default connect( - mapStateToProps, - mapDispatchToProps -)(Tooltip); diff --git a/js/src/ui/Tooltips/Tooltip/tooltip.spec.js b/js/src/ui/Tooltips/Tooltip/tooltip.spec.js deleted file mode 100644 index 57e820c96..000000000 --- a/js/src/ui/Tooltips/Tooltip/tooltip.spec.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -import React from 'react'; -import { shallow } from 'enzyme'; -import sinon from 'sinon'; - -import Tooltip from './'; - -let component; -let store; - -function createRedux (currentId = 0) { - store = { - dispatch: sinon.stub(), - subscribe: sinon.stub(), - getState: () => { - return { - tooltip: { - currentId, - maxId: 2 - } - }; - } - }; - - return store; -} - -function render () { - component = shallow( - , - { - context: { - store: createRedux() - } - } - ).find('Tooltip').shallow(); - - return component; -} - -describe('ui/Tooltips/Tooltip', () => { - beforeEach(() => { - render(); - }); - - it('renders defaults', () => { - expect(component.get(0)).to.be.ok; - }); - - it('renders null when id !== currentId', () => { - expect(render(1).get(0)).to.be.null; - }); -}); diff --git a/js/src/ui/Tooltips/actions.js b/js/src/ui/Tooltips/actions.js deleted file mode 100644 index 13fa0172c..000000000 --- a/js/src/ui/Tooltips/actions.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -export function newTooltip (newId) { - return { - type: 'newTooltip', - newId - }; -} - -export function nextTooltip () { - return { - type: 'nextTooltip' - }; -} - -export function closeTooltips () { - return { - type: 'closeTooltips' - }; -} diff --git a/js/src/ui/Tooltips/index.js b/js/src/ui/Tooltips/index.js deleted file mode 100644 index 8918ce14c..000000000 --- a/js/src/ui/Tooltips/index.js +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -export default from './tooltips'; - -export Tooltip from './Tooltip'; -export tooltipReducer from './reducers'; diff --git a/js/src/ui/Tooltips/reducers.js b/js/src/ui/Tooltips/reducers.js deleted file mode 100644 index 4a294dc4f..000000000 --- a/js/src/ui/Tooltips/reducers.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -import store from 'store'; - -const LS_KEY = 'tooltips'; - -let currentId = -1; -let maxId = 0; - -function closeTooltips (state, action) { - store.set(LS_KEY, '{"state":"off"}'); - - currentId = -1; - - return Object.assign({}, state, { - currentId - }); -} - -function newTooltip (state, action) { - const { newId } = action; - - maxId = Math.max(newId, maxId); - - return Object.assign({}, state, { - currentId, - maxId - }); -} - -function nextTooltip (state, action) { - const hideTips = store.get(LS_KEY); - - currentId = hideTips - ? -1 - : currentId + 1; - - return Object.assign({}, state, { - currentId - }); -} - -export default function tooltipReducer (state = {}, action) { - switch (action.type) { - case 'newTooltip': - return newTooltip(state, action); - - case 'nextTooltip': - return nextTooltip(state, action); - - case 'closeTooltips': - return closeTooltips(state, action); - - default: - return state; - } -} diff --git a/js/src/ui/Tooltips/tooltips.css b/js/src/ui/Tooltips/tooltips.css deleted file mode 100644 index 940587da7..000000000 --- a/js/src/ui/Tooltips/tooltips.css +++ /dev/null @@ -1,103 +0,0 @@ -/* Copyright 2015-2017 Parity Technologies (UK) Ltd. -/* This file is part of Parity. -/* -/* Parity is free software: you can redistribute it and/or modify -/* it under the terms of the GNU General Public License as published by -/* the Free Software Foundation, either version 3 of the License, or -/* (at your option) any later version. -/* -/* Parity is distributed in the hope that it will be useful, -/* but WITHOUT ANY WARRANTY; without even the implied warranty of -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -/* GNU General Public License for more details. -/* -/* You should have received a copy of the GNU General Public License -/* along with Parity. If not, see . -*/ -.container { - height: 100%; - width: 100%; -} - -.overlay { - position: fixed; - top: 0; - left: 0; - bottom: 0; - right: 0; - background: rgba(0, 0, 0, 0.25); - z-index: 499; -} - -.box { - position: absolute; - background: #663600; /* rgba(48, 48, 48, 0.95); #88b7d5; */ - border: 4px solid #f80; /* #c2e1f5; */ - max-width: 450px; - border-radius: 0.5em; - z-index: 500; - opacity: 1; - line-height: 1.618em; - white-space: normal; - opacity: 0.95; -} - -.box:after, .box:before { - bottom: 100%; - border: solid transparent; - content: " "; - height: 0; - width: 0; - position: absolute; - pointer-events: none; -} - -.box:after { - border-color: rgba(136, 183, 213, 0); - border-bottom-color: #663600; /* rgba(48, 48, 48, 0.95); #88b7d5; */ - border-width: 20px; -} - -.box:before { - border-color: rgba(194, 225, 245, 0); - border-bottom-color: #f80; /* #c2e1f5; */ - border-width: 26px; -} - -.arrowLeft:after, .arrowLeft:before { - left: 15%; -} - -.arrowLeft:after { - margin-left: -20px; -} - -.arrowLeft:before { - margin-left: -26px; -} - -.arrowRight:after, .arrowRight:before { - right: 15%; -} - -.arrowRight:after { - margin-right: -20px; -} - -.arrowRight:before { - margin-right: -26px; -} - -.title { - text-transform: uppercase; -} - -.text { - padding: 1em; -} - -.buttons { - margin: 0; - padding: 0 0.5em 0.5em 0; - text-align: right; -} diff --git a/js/src/ui/Tooltips/tooltips.js b/js/src/ui/Tooltips/tooltips.js deleted file mode 100644 index 0647cae37..000000000 --- a/js/src/ui/Tooltips/tooltips.js +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -import React, { Component, PropTypes } from 'react'; -import { connect } from 'react-redux'; -import { bindActionCreators } from 'redux'; - -import { nextTooltip } from './actions'; - -import styles from './tooltips.css'; - -class Tooltips extends Component { - static contextTypes = { - router: PropTypes.object.isRequired - }; - - static propTypes = { - currentId: PropTypes.number, - onNextTooltip: PropTypes.func - } - - componentDidMount () { - const { onNextTooltip } = this.props; - - onNextTooltip(); - this.redirect(); - } - - componentWillReceiveProps (nextProps) { - if (nextProps.currentId !== this.props.currentId) { - this.redirect(nextProps); - } - } - - redirect (props = this.props) { - const { currentId } = props; - - if (currentId !== undefined && currentId !== -1) { - const viewLink = '/accounts/'; - - this.context.router.push(viewLink); - } - } - - render () { - const { currentId } = this.props; - - if (currentId === -1) { - return null; - } - - return ( -
- ); - } -} - -function mapStateToProps (state) { - const { currentId } = state.tooltip; - - return { - currentId - }; -} - -function mapDispatchToProps (dispatch) { - return bindActionCreators({ - onNextTooltip: nextTooltip - }, dispatch); -} - -export default connect( - mapStateToProps, - mapDispatchToProps -)(Tooltips); diff --git a/js/src/ui/Tooltips/tooltips.spec.js b/js/src/ui/Tooltips/tooltips.spec.js deleted file mode 100644 index b52153f8e..000000000 --- a/js/src/ui/Tooltips/tooltips.spec.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2015-2017 Parity Technologies (UK) Ltd. -// This file is part of Parity. - -// Parity is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Parity is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Parity. If not, see . - -import { shallow } from 'enzyme'; -import React from 'react'; -import sinon from 'sinon'; - -import Tooltips from './'; - -let component; -let router; -let store; - -function createRedux () { - store = { - dispatch: sinon.stub(), - subscribe: sinon.stub(), - getState: () => { - return { - tooltip: { - currentId: 1 - } - }; - } - }; - - return store; -} - -function createRouter () { - router = { - push: sinon.stub() - }; - - return router; -} - -function render () { - component = shallow( - , - { - context: { - store: createRedux() - } - } - ).find('Tooltips').shallow({ - context: { - router: createRouter() - } - }); - - return component; -} - -describe('ui/Tooltips', () => { - beforeEach(() => { - render(); - }); - - it('renders defaults', () => { - expect(component.get(0)).to.be.ok; - }); -}); diff --git a/js/src/ui/index.js b/js/src/ui/index.js index aa88d94ec..3d24d98ca 100644 --- a/js/src/ui/index.js +++ b/js/src/ui/index.js @@ -58,7 +58,6 @@ export ShortenedHash from './ShortenedHash'; export SignerIcon from './SignerIcon'; export Tags from './Tags'; export Title from './Title'; -export Tooltips, { Tooltip } from './Tooltips'; export TxHash from './TxHash'; export TxList from './TxList'; export VaultCard from './VaultCard'; diff --git a/js/src/views/Accounts/accounts.js b/js/src/views/Accounts/accounts.js index ee3340d3a..cfafb05d6 100644 --- a/js/src/views/Accounts/accounts.js +++ b/js/src/views/Accounts/accounts.js @@ -23,7 +23,7 @@ import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import HardwareStore from '~/mobx/hardwareStore'; -import { Actionbar, ActionbarSearch, ActionbarSort, Button, Page, Tooltip } from '~/ui'; +import { Actionbar, ActionbarSearch, ActionbarSort, Button, Page } from '~/ui'; import { AddIcon, FileDownloadIcon } from '~/ui/Icons'; import { setVisibleAccounts } from '~/redux/providers/personalActions'; @@ -102,16 +102,6 @@ class Accounts extends Component { { this.renderActionbar() } - - } - /> - { this.renderExternalAccounts() } { this.renderWallets() } { this.renderAccounts() } @@ -295,18 +285,7 @@ class Accounts extends Component { /> } buttons={ buttons } - > - - } - /> - + /> ); } diff --git a/js/src/views/Home/home.js b/js/src/views/Home/home.js index 8079ce0a8..a9e8dfa00 100644 --- a/js/src/views/Home/home.js +++ b/js/src/views/Home/home.js @@ -22,8 +22,9 @@ import HistoryStore from '~/mobx/historyStore'; import { Page } from '~/ui'; import WebStore from '~/views/Web/store'; +// FIXME: Don't really want to import from ~/shell import DappsStore from '~/shell/Dapps/dappsStore'; -import ExtensionStore from '~/shell/Application/Extension/store'; +import ExtensionStore from '~/shell/Extension/store'; import Accounts from './Accounts'; import Dapps from './Dapps';