Accounts as dapp

This commit is contained in:
Jaco Greeff 2017-04-24 12:45:01 +02:00
parent 3ce9071eb9
commit 84d1151a1f
7 changed files with 99 additions and 35 deletions

View File

@ -1,4 +1,15 @@
[
{
"id": "accounts",
"url": "accounts",
"src": "Accounts",
"name": "Accounts",
"description": "Display the accounts",
"author": "Parity Team <admin@ethcore.io>",
"version": "2.0.0",
"visible": true,
"secure": true
},
{
"id": "addresses",
"url": "addresses",

View File

@ -15,13 +15,13 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import HistoryStore from '~/mobx/historyStore';
import { Accounts, Account, Application, Contract, Contracts, Dapp, Dapps, Signer, Wallet, Web, WriteContract } from '~/views';
import { Application, Contract, Contracts, Dapp, Dapps, Signer, Web, WriteContract } from '~/views';
import builtinDapps from '~/config/dappsBuiltin.json';
import viewsDapps from '~/config/dappsViews.json';
const dapps = [].concat(viewsDapps, builtinDapps);
const accountsHistory = HistoryStore.get('accounts');
// const accountsHistory = HistoryStore.get('accounts');
const dappsHistory = HistoryStore.get('dapps');
function handleDeprecatedRoute (nextState, replace) {
@ -47,22 +47,22 @@ function redirectTo (path) {
};
}
const accountsRoutes = [
{
path: ':address',
component: Account,
onEnter: ({ params }) => {
accountsHistory.add(params.address, 'account');
}
},
{
path: '/wallet/:address',
component: Wallet,
onEnter: ({ params }) => {
accountsHistory.add(params.address, 'wallet');
}
}
];
// const accountsRoutes = [
// {
// path: ':address',
// component: Account,
// onEnter: ({ params }) => {
// accountsHistory.add(params.address, 'account');
// }
// },
// {
// path: '/wallet/:address',
// component: Wallet,
// onEnter: ({ params }) => {
// accountsHistory.add(params.address, 'wallet');
// }
// }
// ];
const contractsRoutes = [
{ path: 'develop', component: WriteContract },
@ -71,7 +71,6 @@ const contractsRoutes = [
const routes = [
// Backward Compatible routes
{ path: '/account/:address', onEnter: handleDeprecatedRoute },
{ path: '/contract/:address', onEnter: handleDeprecatedRoute },
{ path: '/', onEnter: redirectTo('/apps') },
@ -80,11 +79,6 @@ const routes = [
];
const childRoutes = [
{
path: 'accounts',
indexRoute: { component: Accounts },
childRoutes: accountsRoutes
},
{
path: 'contracts',
indexRoute: { component: Contracts },

View File

@ -14,4 +14,32 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
export default from './accounts';
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 Accounts from './accounts';
import '~/../assets/fonts/Roboto/font.css';
import '~/../assets/fonts/RobotoMono/font.css';
ContractInstances.get(api);
const store = initStore(api, hashHistory);
ReactDOM.render(
<ContextProvider api={ api } muiTheme={ muiTheme } store={ store }>
<Accounts />
</ContextProvider>,
document.querySelector('#container')
);

View File

@ -0,0 +1,19 @@
{
"name": "@parity/view-addresses",
"description": "Parity default addressbook view",
"version": "0.0.0",
"main": "index.js",
"author": "Parity Team <admin@parity.io>",
"maintainers": [],
"contributors": [],
"license": "GPL-3.0",
"repository": {
"type": "git",
"url": "git+https://github.com/paritytech/parity.git"
},
"keywords": [],
"scripts": {},
"devDependencies": {},
"dependencies": {},
"peerDependencies": {}
}

View File

@ -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 <http://www.gnu.org/licenses/>.
const api = window.parent.secureApi;
export {
api
};

View File

@ -16,17 +16,9 @@
import React from 'react';
import { AccountsIcon, AppsIcon, ContactsIcon, FingerprintIcon } from '~/ui/Icons';
import { AppsIcon, ContactsIcon, FingerprintIcon } from '~/ui/Icons';
const defaultViews = {
accounts: {
active: true,
fixed: true,
icon: <AccountsIcon />,
route: '/accounts',
value: 'account'
},
apps: {
active: true,
icon: <AppsIcon />,

View File

@ -15,7 +15,6 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
export Account from './Account';
export Accounts from './Accounts';
export Address from './Address';
export Application from './Application';
export Contract from './Contract';