From 3ce9071eb936de0903558e3d95f50b491162b65a Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Mon, 24 Apr 2017 12:20:12 +0200 Subject: [PATCH] Addresses as dapp --- js/src/config/dappsViews.json | 11 +++++++++ js/src/routes.js | 12 +--------- js/src/views/Addresses/index.js | 32 ++++++++++++++++++++++++- js/src/views/Addresses/package.json | 19 +++++++++++++++ js/src/views/Addresses/parity.js | 21 ++++++++++++++++ js/src/views/Settings/Views/defaults.js | 9 +------ js/src/views/index.js | 1 - 7 files changed, 84 insertions(+), 21 deletions(-) create mode 100644 js/src/views/Addresses/package.json create mode 100644 js/src/views/Addresses/parity.js diff --git a/js/src/config/dappsViews.json b/js/src/config/dappsViews.json index ccb21241f..199faeb2f 100644 --- a/js/src/config/dappsViews.json +++ b/js/src/config/dappsViews.json @@ -1,4 +1,15 @@ [ + { + "id": "addresses", + "url": "addresses", + "src": "Addresses", + "name": "Addresses", + "description": "Display the accounts added to the addressbook", + "author": "Parity Team ", + "version": "2.0.0", + "visible": true, + "secure": true + }, { "id": "home", "url": "home", diff --git a/js/src/routes.js b/js/src/routes.js index 32a5586db..018e0299d 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 { Accounts, Account, Addresses, Address, Application, Contract, Contracts, Dapp, Dapps, Signer, Wallet, Web, WriteContract } from '~/views'; +import { Accounts, Account, Application, Contract, Contracts, Dapp, Dapps, Signer, Wallet, Web, WriteContract } from '~/views'; import builtinDapps from '~/config/dappsBuiltin.json'; import viewsDapps from '~/config/dappsViews.json'; @@ -64,10 +64,6 @@ const accountsRoutes = [ } ]; -const addressesRoutes = [ - { path: ':address', component: Address } -]; - const contractsRoutes = [ { path: 'develop', component: WriteContract }, { path: ':address', component: Contract } @@ -76,7 +72,6 @@ const contractsRoutes = [ const routes = [ // Backward Compatible routes { path: '/account/:address', onEnter: handleDeprecatedRoute }, - { path: '/address/:address', onEnter: handleDeprecatedRoute }, { path: '/contract/:address', onEnter: handleDeprecatedRoute }, { path: '/', onEnter: redirectTo('/apps') }, @@ -90,11 +85,6 @@ const childRoutes = [ indexRoute: { component: Accounts }, childRoutes: accountsRoutes }, - { - path: 'addresses', - indexRoute: { component: Addresses }, - childRoutes: addressesRoutes - }, { path: 'contracts', indexRoute: { component: Contracts }, diff --git a/js/src/views/Addresses/index.js b/js/src/views/Addresses/index.js index c5fd947d1..82560f2be 100644 --- a/js/src/views/Addresses/index.js +++ b/js/src/views/Addresses/index.js @@ -14,4 +14,34 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -export default from './addresses'; +import ReactDOM from 'react-dom'; +import React from 'react'; +import { hashHistory } from 'react-router'; + +import injectTapEventPlugin from 'react-tap-event-plugin'; +injectTapEventPlugin(); + +import { api } from './parity'; + +import ContractInstances from '~/contracts'; +import { initStore } from '~/redux'; +import ContextProvider from '~/ui/ContextProvider'; +import muiTheme from '~/ui/Theme'; + +import Addresses from './addresses'; + +import '~/../assets/fonts/Roboto/font.css'; +import '~/../assets/fonts/RobotoMono/font.css'; + +import './addresses.css'; + +ContractInstances.get(api); + +const store = initStore(api, hashHistory); + +ReactDOM.render( + + + , + document.querySelector('#container') +); diff --git a/js/src/views/Addresses/package.json b/js/src/views/Addresses/package.json new file mode 100644 index 000000000..022919800 --- /dev/null +++ b/js/src/views/Addresses/package.json @@ -0,0 +1,19 @@ +{ + "name": "@parity/view-addresses", + "description": "Parity default addressbook view", + "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/Addresses/parity.js b/js/src/views/Addresses/parity.js new file mode 100644 index 000000000..7118ce087 --- /dev/null +++ b/js/src/views/Addresses/parity.js @@ -0,0 +1,21 @@ +// 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 . + +const api = window.parent.secureApi; + +export { + api +}; diff --git a/js/src/views/Settings/Views/defaults.js b/js/src/views/Settings/Views/defaults.js index 1683db7e5..11ce6c706 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 { AccountsIcon, AddressesIcon, AppsIcon, ContactsIcon, FingerprintIcon } from '~/ui/Icons'; +import { AccountsIcon, AppsIcon, ContactsIcon, FingerprintIcon } from '~/ui/Icons'; const defaultViews = { accounts: { @@ -27,13 +27,6 @@ const defaultViews = { value: 'account' }, - addresses: { - active: true, - icon: , - route: '/addresses', - value: 'address' - }, - apps: { active: true, icon: , diff --git a/js/src/views/index.js b/js/src/views/index.js index 0e018b351..16bbd1514 100644 --- a/js/src/views/index.js +++ b/js/src/views/index.js @@ -17,7 +17,6 @@ export Account from './Account'; export Accounts from './Accounts'; export Address from './Address'; -export Addresses from './Addresses'; export Application from './Application'; export Contract from './Contract'; export Contracts from './Contracts';