diff --git a/js/src/config/dappsViews.json b/js/src/config/dappsViews.json index 6db59c776..dc034f785 100644 --- a/js/src/config/dappsViews.json +++ b/js/src/config/dappsViews.json @@ -55,11 +55,11 @@ "secure": true }, { - "id": "home", - "url": "home", - "src": "Home", - "name": "Home", - "description": "Display the status of the node, recently accessed applications, accounts and news", + "id": "requests", + "url": "requests", + "src": "Signer", + "name": "Requests", + "description": "Display the current and historic Signer requests", "author": "Parity Team ", "version": "2.0.0", "visible": true, diff --git a/js/src/routes.js b/js/src/routes.js index 0462db23f..e05e55a84 100644 --- a/js/src/routes.js +++ b/js/src/routes.js @@ -15,7 +15,7 @@ // along with Parity. If not, see . import HistoryStore from '~/mobx/historyStore'; -import { Application, Dapp, Dapps, Signer, Web } from '~/views'; +import { Application, Dapp, Dapps, Web } from '~/views'; import builtinDapps from '~/config/dappsBuiltin.json'; import viewsDapps from '~/config/dappsViews.json'; @@ -68,8 +68,7 @@ const childRoutes = [ }, { path: 'apps', component: Dapps }, { path: 'web', component: Web }, - { path: 'web/:url', component: Web }, - { path: 'signer', component: Signer } + { path: 'web/:url', component: Web } ]; // TODO : use ES6 imports when supported diff --git a/js/src/views/Application/TabBar/Tab/index.js b/js/src/views/Application/TabBar/Tab/index.js deleted file mode 100644 index 5c539709f..000000000 --- a/js/src/views/Application/TabBar/Tab/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 './tab'; diff --git a/js/src/views/Application/TabBar/Tab/tab.js b/js/src/views/Application/TabBar/Tab/tab.js deleted file mode 100644 index 9496c73e4..000000000 --- a/js/src/views/Application/TabBar/Tab/tab.js +++ /dev/null @@ -1,75 +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 { Tab as MUITab } from 'material-ui/Tabs'; -import React, { Component, PropTypes } from 'react'; -import { FormattedMessage } from 'react-intl'; - -import { Badge } from '~/ui'; - -import styles from '../tabBar.css'; - -const SIGNER_ID = 'signer'; - -export default class Tab extends Component { - static propTypes = { - pendings: PropTypes.number, - view: PropTypes.object.isRequired - }; - - render () { - const { view } = this.props; - - return ( - - ); - } - - renderLabel (id, bubble) { - return ( -
- - { bubble } -
- ); - } - - renderSignerLabel () { - const { pendings } = this.props; - let bubble; - - if (pendings) { - bubble = ( - - ); - } - - return this.renderLabel(SIGNER_ID, bubble); - } -} diff --git a/js/src/views/Application/TabBar/Tab/tabs.spec.js b/js/src/views/Application/TabBar/Tab/tabs.spec.js deleted file mode 100644 index c1771412a..000000000 --- a/js/src/views/Application/TabBar/Tab/tabs.spec.js +++ /dev/null @@ -1,77 +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 Tab from './'; - -let component; -let instance; - -function render (id = 'signer') { - component = shallow( - - ); - instance = component.instance(); - - return component; -} - -describe('views/Application/TabBar/Tab', () => { - beforeEach(() => { - render(); - }); - - it('renders defaults', () => { - expect(component).to.be.ok; - }); - - describe('instance methods', () => { - describe('renderLabel', () => { - it('renders the label with correct label', () => { - expect( - shallow(instance.renderLabel('test')).find('FormattedMessage').props().id - ).to.equal('settings.views.test.label'); - }); - - it('renders the bubble when passed', () => { - expect( - shallow(instance.renderLabel('test', 'testBubble')).text() - ).to.equal('testBubble'); - }); - }); - - describe('renderSignerLabel', () => { - beforeEach(() => { - sinon.stub(instance, 'renderLabel'); - }); - - afterEach(() => { - instance.renderLabel.restore(); - }); - - it('calls renderLabel with the details', () => { - instance.renderSignerLabel(); - expect(instance.renderLabel).to.have.been.calledWith('signer'); - }); - }); - }); -}); diff --git a/js/src/views/Application/TabBar/index.js b/js/src/views/Application/TabBar/index.js deleted file mode 100644 index 89941f3fd..000000000 --- a/js/src/views/Application/TabBar/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 './tabBar'; diff --git a/js/src/views/Application/TabBar/tabBar.css b/js/src/views/Application/TabBar/tabBar.css deleted file mode 100644 index 2903f3ed3..000000000 --- a/js/src/views/Application/TabBar/tabBar.css +++ /dev/null @@ -1,90 +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 . -*/ - -.toolbar { - background: none !important; - height: 72px !important; - position: relative; -} - -.tabs { - width: 100%; - position: relative; - display: flex; - - & > * { - flex: 1; - } -} - -.tabLink { - display: flex; - - > * { - flex: 1; - } - - &:hover { - background: rgba(0, 0, 0, 0.4) !important; - } - - &.tabactive, &.tabactive:hover { - background: rgba(0, 0, 0, 0.25) !important; - border-radius: 4px 4px 0 0; - - * { - color: white !important; - } - } -} - -.tabLink, -.settings, -.first, -.last { - background: rgba(0, 0, 0, 0.5) !important; /* rgba(0, 0, 0, 0.25) !important; */ -} - -.tabbarTooltip { - left: 3em; - top: 4em; -} - -.label { - position: relative; -} - -.labelBubble { - position: absolute; - top: -12px; - right: -12px; -} - -.first, -.last { - margin: 0; - padding: 36px 12px; - white-space: nowrap; -} - -.first { - margin-left: -24px; -} - -.last { - margin-right: -24px; -} diff --git a/js/src/views/Application/TabBar/tabBar.js b/js/src/views/Application/TabBar/tabBar.js deleted file mode 100644 index d136029e9..000000000 --- a/js/src/views/Application/TabBar/tabBar.js +++ /dev/null @@ -1,125 +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 { Link } from 'react-router'; -import { Toolbar, ToolbarGroup } from 'material-ui/Toolbar'; -import { isEqual } from 'lodash'; - -import { Tooltip } from '~/ui'; - -import Tab from './Tab'; -import styles from './tabBar.css'; - -class TabBar extends Component { - static contextTypes = { - router: PropTypes.object.isRequired - }; - - static propTypes = { - pending: PropTypes.array, - views: PropTypes.array.isRequired - }; - - static defaultProps = { - pending: [] - }; - - render () { - return ( - - -
- -
- { this.renderTabItems() } - - } - /> -
- -
- - - ); - } - - renderTabItems () { - const { views, pending } = this.props; - - return views.map((view, index) => { - return ( - - - - ); - }); - } -} - -function mapStateToProps (initState) { - const { views } = initState.settings; - - let filteredViewIds = Object - .keys(views) - .filter((id) => views[id].fixed || views[id].active); - - let filteredViews = filteredViewIds.map((id) => ({ - ...views[id], - id - })); - - return (state) => { - const { views } = state.settings; - - const viewIds = Object - .keys(views) - .filter((id) => views[id].fixed || views[id].active); - - if (isEqual(viewIds, filteredViewIds)) { - return { views: filteredViews }; - } - - filteredViewIds = viewIds; - filteredViews = viewIds.map((id) => ({ - ...views[id], - id - })); - - return { views: filteredViews }; - }; -} - -export default connect( - mapStateToProps, - null -)(TabBar); diff --git a/js/src/views/Application/TabBar/tabBar.spec.js b/js/src/views/Application/TabBar/tabBar.spec.js deleted file mode 100644 index e9717a572..000000000 --- a/js/src/views/Application/TabBar/tabBar.spec.js +++ /dev/null @@ -1,63 +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 TabBar from './'; - -let component; -let store; - -function createStore () { - store = { - dispatch: sinon.stub(), - subscribe: sinon.stub(), - getState: () => { - return { - settings: { - views: { - settings: { fixed: true } - } - } - }; - } - }; - - return store; -} - -function render (props = {}) { - component = shallow( - , - { - context: { store: createStore() } - } - ).find('TabBar').shallow(); - - return component; -} - -describe('views/Application/TabBar', () => { - beforeEach(() => { - render(); - }); - - it('renders defaults', () => { - expect(component).to.be.ok; - }); -}); diff --git a/js/src/views/Application/application.js b/js/src/views/Application/application.js index 2fac18c6f..d53c024d3 100644 --- a/js/src/views/Application/application.js +++ b/js/src/views/Application/application.js @@ -30,7 +30,6 @@ import Extension from './Extension'; import FrameError from './FrameError'; import Status from './Status'; import Store from './store'; -import TabBar from './TabBar'; import Requests from './Requests'; import styles from './application.css'; @@ -86,7 +85,7 @@ class Application extends Component { } renderApp () { - const { blockNumber, children, pending } = this.props; + const { blockNumber, children } = this.props; return ( -
{ children }
@@ -123,12 +121,10 @@ class Application extends Component { function mapStateToProps (state) { const { blockNumber } = state.nodeStatus; const { hasAccounts } = state.personal; - const { pending } = state.signer; return { blockNumber, - hasAccounts, - pending + hasAccounts }; } diff --git a/js/src/views/ParityBar/parityBar.js b/js/src/views/ParityBar/parityBar.js index b8dd669d5..01c297f61 100644 --- a/js/src/views/ParityBar/parityBar.js +++ b/js/src/views/ParityBar/parityBar.js @@ -27,7 +27,7 @@ import imagesEthcoreBlock from '~/../assets/images/parity-logo-white-no-text.svg import { AccountCard, Badge, Button, ContainerTitle, IdentityIcon, ParityBackground, SelectionList } from '~/ui'; import { CancelIcon, FingerprintIcon } from '~/ui/Icons'; import DappsStore from '~/views/Dapps/dappsStore'; -import { Embedded as Signer } from '~/views/Signer'; +import Signer from '~/views/Signer/Embedded'; import AccountStore from './accountStore'; import styles from './parityBar.css'; diff --git a/js/src/views/Settings/Views/defaults.js b/js/src/views/Settings/Views/defaults.js index f42190e5f..e09983cea 100644 --- a/js/src/views/Settings/Views/defaults.js +++ b/js/src/views/Settings/Views/defaults.js @@ -16,7 +16,7 @@ import React from 'react'; -import { AppsIcon, FingerprintIcon } from '~/ui/Icons'; +import { AppsIcon } from '~/ui/Icons'; const defaultViews = { apps: { @@ -24,14 +24,6 @@ const defaultViews = { icon: , route: '/apps', value: 'app' - }, - - signer: { - active: true, - fixed: true, - icon: , - route: '/signer', - value: 'signer' } }; diff --git a/js/src/views/Signer/containers/Embedded/embedded.css b/js/src/views/Signer/Embedded/embedded.css similarity index 100% rename from js/src/views/Signer/containers/Embedded/embedded.css rename to js/src/views/Signer/Embedded/embedded.css diff --git a/js/src/views/Signer/containers/Embedded/embedded.js b/js/src/views/Signer/Embedded/embedded.js similarity index 97% rename from js/src/views/Signer/containers/Embedded/embedded.js rename to js/src/views/Signer/Embedded/embedded.js index 02005d668..ce01e42b7 100644 --- a/js/src/views/Signer/containers/Embedded/embedded.js +++ b/js/src/views/Signer/Embedded/embedded.js @@ -20,11 +20,11 @@ import { FormattedMessage } from 'react-intl'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; -import Store from '../../store'; +import Store from '../store'; import * as RequestsActions from '~/redux/providers/signerActions'; import { Container } from '~/ui'; -import RequestPending from '../../components/RequestPending'; +import RequestPending from '../components/RequestPending'; import styles from './embedded.css'; diff --git a/js/src/views/Signer/containers/Embedded/index.js b/js/src/views/Signer/Embedded/index.js similarity index 100% rename from js/src/views/Signer/containers/Embedded/index.js rename to js/src/views/Signer/Embedded/index.js diff --git a/js/src/views/Signer/containers/RequestsPage/index.js b/js/src/views/Signer/RequestsPage/index.js similarity index 100% rename from js/src/views/Signer/containers/RequestsPage/index.js rename to js/src/views/Signer/RequestsPage/index.js diff --git a/js/src/views/Signer/containers/RequestsPage/requestsPage.css b/js/src/views/Signer/RequestsPage/requestsPage.css similarity index 100% rename from js/src/views/Signer/containers/RequestsPage/requestsPage.css rename to js/src/views/Signer/RequestsPage/requestsPage.css diff --git a/js/src/views/Signer/containers/RequestsPage/requestsPage.js b/js/src/views/Signer/RequestsPage/requestsPage.js similarity index 97% rename from js/src/views/Signer/containers/RequestsPage/requestsPage.js rename to js/src/views/Signer/RequestsPage/requestsPage.js index 327670a9d..318fffefc 100644 --- a/js/src/views/Signer/containers/RequestsPage/requestsPage.js +++ b/js/src/views/Signer/RequestsPage/requestsPage.js @@ -21,11 +21,11 @@ import { FormattedMessage } from 'react-intl'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; -import Store from '../../store'; +import Store from '../store'; import * as RequestsActions from '~/redux/providers/signerActions'; import { Container, Page, TxList } from '~/ui'; -import RequestPending from '../../components/RequestPending'; +import RequestPending from '../components/RequestPending'; import styles from './requestsPage.css'; diff --git a/js/src/views/Signer/index.js b/js/src/views/Signer/index.js index b0274b285..914c86eb7 100644 --- a/js/src/views/Signer/index.js +++ b/js/src/views/Signer/index.js @@ -14,10 +14,32 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -import Embedded from './containers/Embedded'; +import ReactDOM from 'react-dom'; +import React from 'react'; +import { hashHistory } from 'react-router'; -export default from './signer'; +import injectTapEventPlugin from 'react-tap-event-plugin'; +injectTapEventPlugin(); -export { - Embedded -}; +import { api } from './parity'; + +import ContractInstances from '~/contracts'; +import { initStore } from '~/redux'; +import ContextProvider from '~/ui/ContextProvider'; +import muiTheme from '~/ui/Theme'; + +import Signer from './signer'; + +import '~/../assets/fonts/Roboto/font.css'; +import '~/../assets/fonts/RobotoMono/font.css'; + +ContractInstances.get(api); + +const store = initStore(api, hashHistory); + +ReactDOM.render( + + + , + document.querySelector('#container') +); diff --git a/js/src/views/Signer/package.json b/js/src/views/Signer/package.json new file mode 100644 index 000000000..c53578410 --- /dev/null +++ b/js/src/views/Signer/package.json @@ -0,0 +1,19 @@ +{ + "name": "@parity/view-signer", + "description": "Parity signer views, embedded and requests", + "version": "0.0.0", + "main": "index.js", + "author": "Parity Team ", + "maintainers": [], + "contributors": [], + "license": "GPL-3.0", + "repository": { + "type": "git", + "url": "git+https://github.com/paritytech/parity.git" + }, + "keywords": [], + "scripts": {}, + "devDependencies": {}, + "dependencies": {}, + "peerDependencies": {} +} diff --git a/js/src/views/Signer/signer.js b/js/src/views/Signer/signer.js index 093a980ed..53a4f395e 100644 --- a/js/src/views/Signer/signer.js +++ b/js/src/views/Signer/signer.js @@ -14,26 +14,24 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -import React, { Component } from 'react'; +import React from 'react'; import { FormattedMessage } from 'react-intl'; import { Actionbar } from '~/ui'; -import RequestsPage from './containers/RequestsPage'; +import RequestsPage from './RequestsPage'; -export default class Signer extends Component { - render () { - return ( -
- - } - /> - -
- ); - } +export default function Signer () { + return ( +
+ + } + /> + +
+ ); }