diff --git a/js/src/config/dappsBuiltin.json b/js/src/config/dappsBuiltin.json index 673b4acd3..ef6d07375 100644 --- a/js/src/config/dappsBuiltin.json +++ b/js/src/config/dappsBuiltin.json @@ -5,7 +5,8 @@ "description": "Deploy all basic contracts, names & applications to the network", "author": "Parity Team ", "version": "1.0.0", - "visible": false + "visible": false, + "noselect": false }, { "id": "0xf9f2d620c2e08f83e45555247146c62185e4ab7cf82a4b9002a265a0d020348f", diff --git a/js/src/config/dappsViews.json b/js/src/config/dappsViews.json index dc034f785..a273a70f9 100644 --- a/js/src/config/dappsViews.json +++ b/js/src/config/dappsViews.json @@ -10,6 +10,18 @@ "visible": true, "secure": true }, + { + "id": "account", + "url": "account", + "src": "Account", + "name": "Account", + "description": "Display a single account", + "author": "Parity Team ", + "version": "2.0.0", + "visible": true, + "secure": true, + "noselect": true + }, { "id": "addresses", "url": "addresses", diff --git a/js/src/routes.js b/js/src/routes.js index 2ca390347..d6c009a18 100644 --- a/js/src/routes.js +++ b/js/src/routes.js @@ -66,6 +66,15 @@ const childRoutes = [ } } }, + { + path: 'app/:id/:details', + component: Dapp, + onEnter: ({ params }) => { + if (!dapps[params.id] || !dapps[params.id].skipHistory) { + dappsHistory.add(params.id); + } + } + }, { path: 'apps', component: Dapps }, { path: 'web', component: Web }, { path: 'web/:url', component: Web } diff --git a/js/src/ui/Container/container.js b/js/src/ui/Container/container.js index 81e48f7f3..068cccadf 100644 --- a/js/src/ui/Container/container.js +++ b/js/src/ui/Container/container.js @@ -20,6 +20,7 @@ import { Card } from 'material-ui/Card'; import { nodeOrStringProptype } from '~/util/proptypes'; +import DappLink from '../DappLink'; import Title from './Title'; import styles from './container.css'; @@ -29,6 +30,7 @@ export default class Container extends Component { children: PropTypes.node, className: PropTypes.string, compact: PropTypes.bool, + dappLink: PropTypes.bool, hover: PropTypes.node, light: PropTypes.bool, link: PropTypes.string, @@ -76,15 +78,7 @@ export default class Container extends Component { > { link - ? ( - - { card } - { this.renderHover() } - - ) + ? this.renderLink(link, card) : (
{ card } @@ -96,6 +90,32 @@ export default class Container extends Component { ); } + renderLink (link, card) { + const { dappLink } = this.props; + + if (dappLink) { + return ( + + { card } + { this.renderHover() } + + ); + } + + return ( + + { card } + { this.renderHover() } + + ); + } + renderHover () { const { hover } = this.props; diff --git a/js/src/ui/DappLink/dappLink.css b/js/src/ui/DappLink/dappLink.css new file mode 100644 index 000000000..c126e7017 --- /dev/null +++ b/js/src/ui/DappLink/dappLink.css @@ -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 . +*/ + +.link { + color: rgb(0, 151, 167); + cursor: pointer; +} diff --git a/js/src/ui/DappLink/dappLink.js b/js/src/ui/DappLink/dappLink.js new file mode 100644 index 000000000..d8b458e51 --- /dev/null +++ b/js/src/ui/DappLink/dappLink.js @@ -0,0 +1,48 @@ +// 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 { nodeOrStringProptype } from '~/util/proptypes'; + +import styles from './dappLink.css'; + +export default class DappLink extends Component { + static propTypes = { + children: nodeOrStringProptype().isRequired, + className: PropTypes.string, + to: PropTypes.string.isRequired + }; + + render () { + const { children, className } = this.props; + + return ( +
+ { children } +
+ ); + } + + onClick = () => { + const { to } = this.props; + + window.parent.location.hash = `/app${to}`; + } +} diff --git a/js/src/ui/DappLink/index.js b/js/src/ui/DappLink/index.js new file mode 100644 index 000000000..d18b87935 --- /dev/null +++ b/js/src/ui/DappLink/index.js @@ -0,0 +1,17 @@ +// 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 './dappLink'; diff --git a/js/src/ui/index.js b/js/src/ui/index.js index 1cb0e468b..d4b9aadf9 100644 --- a/js/src/ui/index.js +++ b/js/src/ui/index.js @@ -28,6 +28,7 @@ export CopyToClipboard from './CopyToClipboard'; export CurrencySymbol from './CurrencySymbol'; export DappCard from './DappCard'; export DappIcon from './DappIcon'; +export DappLink from './DappLink'; export Errors from './Errors'; export Features, { FEATURES, FeaturesStore } from './Features'; export Form, { AddressSelect, DappUrlInput, FileSelect, FormWrap, Input, InputAddress, InputAddressSelect, InputChip, InputDate, InputInline, InputTime, Label, RadioButtons, Select, TypedInput, VaultSelect } from './Form'; diff --git a/js/src/views/Account/account.js b/js/src/views/Account/account.js index 6f38cdf72..262d3950d 100644 --- a/js/src/views/Account/account.js +++ b/js/src/views/Account/account.js @@ -56,6 +56,8 @@ class Account extends Component { hwstore = HardwareStore.get(this.context.api); componentDidMount () { + console.log('Account', 'componentDidMount'); + this.props.fetchCertifiers(); this.setVisibleAccounts(); } diff --git a/js/src/views/Account/index.js b/js/src/views/Account/index.js index 8023eb211..febb9c5bb 100644 --- a/js/src/views/Account/index.js +++ b/js/src/views/Account/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 './account'; +import ReactDOM from 'react-dom'; +import React from 'react'; +import { Route, Router, 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 Account from './account'; + +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/Account/package.json b/js/src/views/Account/package.json new file mode 100644 index 000000000..31c3aae0d --- /dev/null +++ b/js/src/views/Account/package.json @@ -0,0 +1,19 @@ +{ + "name": "@parity/view-address", + "description": "Parity default account 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/Account/parity.js b/js/src/views/Account/parity.js new file mode 100644 index 000000000..7118ce087 --- /dev/null +++ b/js/src/views/Account/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/Accounts/Summary/summary.js b/js/src/views/Accounts/Summary/summary.js index ded53ab7c..3e0ab7eab 100644 --- a/js/src/views/Accounts/Summary/summary.js +++ b/js/src/views/Accounts/Summary/summary.js @@ -96,6 +96,7 @@ class Summary extends Component { return ( { this.renderBalance(false) } @@ -228,7 +229,7 @@ class Summary extends Component { const { address } = account; const baseLink = account.wallet ? 'wallet' - : link || 'accounts'; + : link || 'account'; return `/${baseLink}/${address}`; } diff --git a/js/src/views/Accounts/package.json b/js/src/views/Accounts/package.json index 022919800..4e697c965 100644 --- a/js/src/views/Accounts/package.json +++ b/js/src/views/Accounts/package.json @@ -1,6 +1,6 @@ { "name": "@parity/view-addresses", - "description": "Parity default addressbook view", + "description": "Parity default accounts list view", "version": "0.0.0", "main": "index.js", "author": "Parity Team ", diff --git a/js/src/views/Dapp/dapp.js b/js/src/views/Dapp/dapp.js index 815ae35dd..a1de61040 100644 --- a/js/src/views/Dapp/dapp.js +++ b/js/src/views/Dapp/dapp.js @@ -123,7 +123,7 @@ export default class Dapp extends Component { className={ styles.frame } frameBorder={ 0 } name={ name } - sandbox='allow-forms allow-popups allow-same-origin allow-scripts' + sandbox='allow-forms allow-popups allow-same-origin allow-scripts allow-top-navigation' scrolling='auto' src={ src } /> diff --git a/js/src/views/Dapps/dappsStore.js b/js/src/views/Dapps/dappsStore.js index 573ab6208..dd0b24311 100644 --- a/js/src/views/Dapps/dappsStore.js +++ b/js/src/views/Dapps/dappsStore.js @@ -78,7 +78,7 @@ export default class DappsStore extends EventEmitter { } @computed get visibleBuiltin () { - return this.visibleApps.filter((app) => app.type === 'builtin'); + return this.visibleApps.filter((app) => !app.noselect && app.type === 'builtin'); } @computed get visibleLocal () { @@ -90,7 +90,7 @@ export default class DappsStore extends EventEmitter { } @computed get visibleViews () { - return this.visibleApps.filter((app) => app.type === 'view'); + return this.visibleApps.filter((app) => !app.noselect && app.type === 'view'); } /** diff --git a/js/src/views/index.js b/js/src/views/index.js index 833d41ca0..daf2ac46b 100644 --- a/js/src/views/index.js +++ b/js/src/views/index.js @@ -14,7 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -export Account from './Account'; export Address from './Address'; export Application from './Application'; export Contract from './Contract';