diff --git a/packages/app-accounts/package.json b/packages/app-accounts/package.json index a1a92f83d8..3838f87c48 100644 --- a/packages/app-accounts/package.json +++ b/packages/app-accounts/package.json @@ -9,11 +9,6 @@ ], "contributors": [], "license": "ISC", - "scripts": { - "build": "polkadot-dev-build-babel", - "check": "stylelint 'src/**/*.css' && eslint src && flow check", - "test": "jest --coverage" - }, "dependencies": { "@babel/runtime": "^7.0.0-beta.51", "@polkadot/ui-app": "^0.19.33" diff --git a/packages/app-accounts/src/index.tsx b/packages/app-accounts/src/index.tsx index 258539c022..20983e87ad 100644 --- a/packages/app-accounts/src/index.tsx +++ b/packages/app-accounts/src/index.tsx @@ -17,7 +17,9 @@ import Creator from './Creator'; import Editor from './Editor'; import translate from './translate'; -type Props = I18nProps & {}; +type Props = I18nProps & { + basePath: string +}; type Actions = 'create' | 'edit'; diff --git a/packages/app-addresses/package.json b/packages/app-addresses/package.json index da1923576e..2a6888843e 100644 --- a/packages/app-addresses/package.json +++ b/packages/app-addresses/package.json @@ -9,11 +9,6 @@ ], "contributors": [], "license": "ISC", - "scripts": { - "build": "polkadot-dev-build-babel", - "check": "stylelint 'src/**/*.css' && eslint src && flow check", - "test": "jest --coverage" - }, "dependencies": { "@babel/runtime": "^7.0.0-beta.51", "@polkadot/ui-app": "^0.19.33" diff --git a/packages/app-addresses/src/index.tsx b/packages/app-addresses/src/index.tsx index 8fd86ddf05..3735b6196a 100644 --- a/packages/app-addresses/src/index.tsx +++ b/packages/app-addresses/src/index.tsx @@ -18,7 +18,9 @@ import Creator from './Creator'; import Editor from './Editor'; import translate from './translate'; -type Props = I18nProps & {}; +type Props = I18nProps & { + basePath: string +}; type Actions = 'create' | 'edit'; diff --git a/packages/app-democracy/src/index.tsx b/packages/app-democracy/src/index.tsx index 3f47153355..cb5210cf84 100644 --- a/packages/app-democracy/src/index.tsx +++ b/packages/app-democracy/src/index.tsx @@ -13,7 +13,9 @@ import Proposals from './Proposals'; import Referendums from './Referendums'; import Summary from './Summary'; -type Props = BareProps & {}; +type Props = BareProps & { + basePath: string +}; export default class App extends React.PureComponent { render () { diff --git a/packages/app-example/src/index.tsx b/packages/app-example/src/index.tsx index 96eb089bd7..2c6d206db7 100644 --- a/packages/app-example/src/index.tsx +++ b/packages/app-example/src/index.tsx @@ -2,6 +2,8 @@ // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. +import { BareProps } from '@polkadot/ui-app/types'; + import React from 'react'; import Navigation from '@polkadot/ui-app/Navigation'; import Page from '@polkadot/ui-app/Page'; @@ -19,12 +21,16 @@ const Components: { [index: string]: React.ComponentType } = { Tut002, Tut003, Tut004, Tut005, Tut006, Tut007 }; +type Props = BareProps & { + basePath: string +}; + type State = { Component: React.ComponentType }; -export default class App extends React.PureComponent { - constructor (props: any) { +export default class App extends React.PureComponent { + constructor (props: Props) { super(props); this.state = { diff --git a/packages/app-explorer/package.json b/packages/app-explorer/package.json index 5a3cd9cbae..be0aa56f60 100644 --- a/packages/app-explorer/package.json +++ b/packages/app-explorer/package.json @@ -9,11 +9,6 @@ ], "contributors": [], "license": "ISC", - "scripts": { - "build": "polkadot-dev-build-babel", - "check": "stylelint 'src/**/*.css' && eslint src && flow check", - "test": "jest --coverage" - }, "dependencies": { "@babel/runtime": "^7.0.0-beta.51", "@polkadot/primitives": "^0.28.14", diff --git a/packages/app-explorer/src/index.tsx b/packages/app-explorer/src/index.tsx index 0272bc770b..d15e147bea 100644 --- a/packages/app-explorer/src/index.tsx +++ b/packages/app-explorer/src/index.tsx @@ -13,7 +13,9 @@ import classes from '@polkadot/ui-app/util/classes'; import Summary from './Summary'; import BlockHeaders from './BlockHeaders'; -type Props = BareProps & {}; +type Props = BareProps & { + basePath: string +}; export default class ExplorerApp extends React.PureComponent { render () { diff --git a/packages/app-extrinsics/package.json b/packages/app-extrinsics/package.json index d1198060ce..303f1023ab 100644 --- a/packages/app-extrinsics/package.json +++ b/packages/app-extrinsics/package.json @@ -9,11 +9,6 @@ ], "contributors": [], "license": "ISC", - "scripts": { - "build": "polkadot-dev-build-babel", - "check": "stylelint 'src/**/*.css' && eslint src && flow check", - "test": "jest --coverage" - }, "dependencies": { "@babel/runtime": "^7.0.0-beta.51", "@polkadot/extrinsics": "^0.28.14", diff --git a/packages/app-extrinsics/src/index.tsx b/packages/app-extrinsics/src/index.tsx index d8ea54d706..2e04e0eb95 100644 --- a/packages/app-extrinsics/src/index.tsx +++ b/packages/app-extrinsics/src/index.tsx @@ -14,7 +14,9 @@ import { QueueConsumer } from '@polkadot/ui-signer/Context'; import Selection from './Selection'; -type Props = BareProps; +type Props = BareProps & { + basePath: string +}; export default class ExtrinsicsApp extends React.PureComponent { render () { diff --git a/packages/app-rpc/package.json b/packages/app-rpc/package.json index c4f498b91f..cc888aaf39 100644 --- a/packages/app-rpc/package.json +++ b/packages/app-rpc/package.json @@ -9,11 +9,6 @@ ], "contributors": [], "license": "ISC", - "scripts": { - "build": "polkadot-dev-build-babel", - "check": "stylelint 'src/**/*.css' && eslint src && flow check", - "test": "jest --coverage" - }, "dependencies": { "@babel/runtime": "^7.0.0-beta.51", "@polkadot/ui-app": "^0.19.33", diff --git a/packages/app-rpc/src/index.tsx b/packages/app-rpc/src/index.tsx index 035e9275f6..d97bc2646d 100644 --- a/packages/app-rpc/src/index.tsx +++ b/packages/app-rpc/src/index.tsx @@ -15,7 +15,9 @@ import { QueueConsumer } from '@polkadot/ui-signer/Context'; import Results from './Results'; import Selection from './Selection'; -type Props = BareProps & {}; +type Props = BareProps & { + basePath: string +}; export default class RpcApp extends React.PureComponent { render () { diff --git a/packages/app-staking/src/index.tsx b/packages/app-staking/src/index.tsx index 70f50d2d6a..737251e3c8 100644 --- a/packages/app-staking/src/index.tsx +++ b/packages/app-staking/src/index.tsx @@ -17,6 +17,7 @@ import StakeList from './StakeList'; import Summary from './Summary'; type Props = BareProps & { + basePath: string, validatingBalances?: RxBalanceMap, stakingIntentions?: Array, sessionValidators?: Array diff --git a/packages/app-storage/package.json b/packages/app-storage/package.json index e70dd8fb55..7b1eb56456 100644 --- a/packages/app-storage/package.json +++ b/packages/app-storage/package.json @@ -9,11 +9,6 @@ ], "contributors": [], "license": "ISC", - "scripts": { - "build": "polkadot-dev-build-babel", - "check": "stylelint 'src/**/*.css' && eslint src && flow check", - "test": "jest --coverage" - }, "dependencies": { "@babel/runtime": "^7.0.0-beta.51", "@polkadot/ui-app": "^0.19.33" diff --git a/packages/app-storage/src/index.tsx b/packages/app-storage/src/index.tsx index 9505d08bfa..10d3881c06 100644 --- a/packages/app-storage/src/index.tsx +++ b/packages/app-storage/src/index.tsx @@ -15,7 +15,9 @@ import Queries from './Queries'; import Selection from './Selection'; import translate from './translate'; -type Props = I18nProps & {}; +type Props = I18nProps & { + basePath: string +}; type State = { queue: Array diff --git a/packages/app-toolbox/package.json b/packages/app-toolbox/package.json index 9ce951f903..c382fe70d7 100644 --- a/packages/app-toolbox/package.json +++ b/packages/app-toolbox/package.json @@ -9,11 +9,6 @@ ], "contributors": [], "license": "ISC", - "scripts": { - "build": "polkadot-dev-build-babel", - "check": "stylelint 'src/**/*.css' && eslint src && flow check", - "test": "jest --coverage" - }, "dependencies": { "@babel/runtime": "^7.0.0-beta.51", "@polkadot/ui-app": "^0.19.33", diff --git a/packages/app-toolbox/src/index.tsx b/packages/app-toolbox/src/index.tsx index 14a3eed200..0cac859199 100644 --- a/packages/app-toolbox/src/index.tsx +++ b/packages/app-toolbox/src/index.tsx @@ -19,7 +19,9 @@ import translate from './translate'; type Actions = 'hash' | 'sign' | 'verify'; -type Props = I18nProps & {}; +type Props = I18nProps & { + basePath: string +}; type State = { action: Actions diff --git a/packages/app-vanitygen/package.json b/packages/app-vanitygen/package.json index 8262e4129d..c2c702d0a6 100644 --- a/packages/app-vanitygen/package.json +++ b/packages/app-vanitygen/package.json @@ -9,11 +9,6 @@ ], "contributors": [], "license": "ISC", - "scripts": { - "build": "polkadot-dev-build-babel", - "check": "stylelint 'src/**/*.css' && eslint src && flow check", - "test": "jest --coverage" - }, "dependencies": { "@babel/runtime": "^7.0.0-beta.51", "@polkadot/ui-app": "^0.19.33", diff --git a/packages/app-vanitygen/src/index.tsx b/packages/app-vanitygen/src/index.tsx index 7a4f31493d..0ca5dc0c09 100644 --- a/packages/app-vanitygen/src/index.tsx +++ b/packages/app-vanitygen/src/index.tsx @@ -21,7 +21,9 @@ import matchRegex from './generator/regex'; import generatorSort from './generator/sort'; import translate from './translate'; -type Props = I18nProps & {}; +type Props = I18nProps & { + basePath: string +}; type State = { elapsed: number, diff --git a/packages/apps/package.json b/packages/apps/package.json index 1849c5d9b5..f0676efc77 100644 --- a/packages/apps/package.json +++ b/packages/apps/package.json @@ -11,10 +11,6 @@ ], "contributors": [], "license": "ISC", - "scripts": { - "build": "polkadot-dev-build-babel", - "check": "stylelint 'src/**/*.css' && eslint src && flow check" - }, "dependencies": { "@babel/runtime": "^7.0.0-beta.51", "@polkadot/app-accounts": "^0.19.33", diff --git a/packages/apps/src/Content/NotFound.tsx b/packages/apps/src/Content/NotFound.tsx new file mode 100644 index 0000000000..d1409605cd --- /dev/null +++ b/packages/apps/src/Content/NotFound.tsx @@ -0,0 +1,20 @@ +// Copyright 2017-2018 @polkadot/apps authors & contributors +// This software may be modified and distributed under the terms +// of the ISC license. See the LICENSE file for details. + +import React from 'react'; +import { Redirect } from 'react-router'; + +import routing from '../routing'; + +type Props = {}; + +const defaultTo = `/${routing.default}`; + +export default class NotFound extends React.PureComponent { + render () { + return ( + + ); + } +} diff --git a/packages/apps/src/Content/index.tsx b/packages/apps/src/Content/index.tsx index 10723b94ae..edf3e68fcf 100644 --- a/packages/apps/src/Content/index.tsx +++ b/packages/apps/src/Content/index.tsx @@ -3,7 +3,6 @@ // of the ISC license. See the LICENSE file for details. import { I18nProps } from '@polkadot/ui-app/types'; -import { Route } from '../types'; import './Content.css'; @@ -13,28 +12,32 @@ import { withRouter } from 'react-router'; import classes from '@polkadot/ui-app/util/classes'; import routing from '../routing'; +import NotFound from './NotFound'; type Props = I18nProps & { location: Location }; +const unknown = { + Component: NotFound, + name: '' +}; + class Content extends React.PureComponent { render () { const { className, location, style } = this.props; - const app = location.pathname.slice(1) || routing.default; - const { Component } = routing.routes.find((route: Route | null) => - route - ? route.name === app - : false - ) || routing.unknown; + const app = location.pathname.slice(1) || ''; + const { Component, name } = routing.routes.find((route) => + !!(route && app.indexOf(route.name) === 0) + ) || unknown; return (
- +
); } diff --git a/packages/apps/src/NotFound/NotFound.css b/packages/apps/src/NotFound/NotFound.css deleted file mode 100644 index 97e7701241..0000000000 --- a/packages/apps/src/NotFound/NotFound.css +++ /dev/null @@ -1,7 +0,0 @@ -/* Copyright 2017-2018 @polkadot/apps authors & contributors -/* This software may be modified and distributed under the terms -/* of the ISC license. See the LICENSE file for details. */ - -.apps--NotFound { - color: red; -} diff --git a/packages/apps/src/NotFound/index.tsx b/packages/apps/src/NotFound/index.tsx deleted file mode 100644 index 7f19bfbe9e..0000000000 --- a/packages/apps/src/NotFound/index.tsx +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2017-2018 @polkadot/apps authors & contributors -// This software may be modified and distributed under the terms -// of the ISC license. See the LICENSE file for details. - -import { I18nProps } from '@polkadot/ui-app/types'; - -import './NotFound.css'; - -import React from 'react'; - -import classes from '@polkadot/ui-app/util/classes'; - -import translate from '../translate'; - -type Props = I18nProps & {}; - -class NotFound extends React.PureComponent { - render () { - const { className, style, t } = this.props; - - return ( -
- {t('notfound.error', { - defaultValue: 'ERROR: You have tried to access an application that does not exist' - })} -
- ); - } -} - -export default translate(NotFound); diff --git a/packages/apps/src/SideBar/Item.tsx b/packages/apps/src/SideBar/Item.tsx index 135257ae6e..3bc9113868 100644 --- a/packages/apps/src/SideBar/Item.tsx +++ b/packages/apps/src/SideBar/Item.tsx @@ -20,15 +20,14 @@ type Props = I18nProps & { class Item extends React.PureComponent { render () { - const { route: { i18n, icon, isExact, name, path = '' }, t } = this.props; + const { route: { i18n, icon, name }, t } = this.props; return ( {t(`sidebar.${name}`, i18n)} diff --git a/packages/apps/src/routing/accounts.ts b/packages/apps/src/routing/accounts.ts index bcf2a3850f..7c6f892841 100644 --- a/packages/apps/src/routing/accounts.ts +++ b/packages/apps/src/routing/accounts.ts @@ -13,7 +13,6 @@ export default ([ defaultValue: 'Accounts' }, icon: 'users', - isExact: false, isHidden: false, name: 'accounts' } diff --git a/packages/apps/src/routing/addresses.ts b/packages/apps/src/routing/addresses.ts index a51e160d5e..8bf314e5a0 100644 --- a/packages/apps/src/routing/addresses.ts +++ b/packages/apps/src/routing/addresses.ts @@ -13,7 +13,6 @@ export default ([ defaultValue: 'Addresses' }, icon: 'address book', - isExact: false, isHidden: false, name: 'addresses' } diff --git a/packages/apps/src/routing/democracy.ts b/packages/apps/src/routing/democracy.ts index 7d5631aed9..a212e81196 100644 --- a/packages/apps/src/routing/democracy.ts +++ b/packages/apps/src/routing/democracy.ts @@ -13,7 +13,6 @@ export default ([ defaultValue: 'Democracy' }, icon: 'calendar check', - isExact: false, isHidden: false, name: 'democracy' } diff --git a/packages/apps/src/routing/example.ts b/packages/apps/src/routing/example.ts index ba8f836974..de7ee58653 100644 --- a/packages/apps/src/routing/example.ts +++ b/packages/apps/src/routing/example.ts @@ -13,7 +13,6 @@ export default ([ defaultValue: 'Example' }, icon: 'hand spock', - isExact: false, isHidden: true, name: 'example' } diff --git a/packages/apps/src/routing/explorer.ts b/packages/apps/src/routing/explorer.ts index b8dfeb7877..93d75ffa0f 100644 --- a/packages/apps/src/routing/explorer.ts +++ b/packages/apps/src/routing/explorer.ts @@ -13,9 +13,7 @@ export default ([ defaultValue: 'Explorer' }, icon: 'braille', - isExact: true, isHidden: false, - name: 'explorer', - path: '/' + name: 'explorer' } ] as Routes); diff --git a/packages/apps/src/routing/extrinsics.ts b/packages/apps/src/routing/extrinsics.ts index 68aefaa0eb..b7e4694b6a 100644 --- a/packages/apps/src/routing/extrinsics.ts +++ b/packages/apps/src/routing/extrinsics.ts @@ -13,7 +13,6 @@ export default ([ defaultValue: 'Extrinsics' }, icon: 'send', - isExact: false, isHidden: false, name: 'extrinsics' } diff --git a/packages/apps/src/routing/index.ts b/packages/apps/src/routing/index.ts index d9a90ba12c..f9f94419d1 100644 --- a/packages/apps/src/routing/index.ts +++ b/packages/apps/src/routing/index.ts @@ -16,7 +16,6 @@ import rpc from './rpc'; import staking from './staking'; import storage from './storage'; import toolbox from './toolbox'; -import unknown from './unknown'; import vanitygen from './vanitygen'; export default ({ @@ -36,6 +35,5 @@ export default ({ null, rpc, toolbox - ), - unknown + ) } as Routing); diff --git a/packages/apps/src/routing/rpc.ts b/packages/apps/src/routing/rpc.ts index 0b288abcdd..f5214420ef 100644 --- a/packages/apps/src/routing/rpc.ts +++ b/packages/apps/src/routing/rpc.ts @@ -13,7 +13,6 @@ export default ([ defaultValue: 'Raw RPC' }, icon: 'code', - isExact: false, isHidden: false, name: 'rpc' } diff --git a/packages/apps/src/routing/staking.ts b/packages/apps/src/routing/staking.ts index 6c70990804..415f0de9f2 100644 --- a/packages/apps/src/routing/staking.ts +++ b/packages/apps/src/routing/staking.ts @@ -13,7 +13,6 @@ export default ([ defaultValue: 'Staking' }, icon: 'certificate', - isExact: false, isHidden: false, name: 'staking' } diff --git a/packages/apps/src/routing/storage.ts b/packages/apps/src/routing/storage.ts index f273b11bb8..571cc6512d 100644 --- a/packages/apps/src/routing/storage.ts +++ b/packages/apps/src/routing/storage.ts @@ -13,7 +13,6 @@ export default ([ defaultValue: 'Storage' }, icon: 'database', - isExact: false, isHidden: false, name: 'storage' } diff --git a/packages/apps/src/routing/toolbox.ts b/packages/apps/src/routing/toolbox.ts index 294aba9373..6dc184d2ae 100644 --- a/packages/apps/src/routing/toolbox.ts +++ b/packages/apps/src/routing/toolbox.ts @@ -13,7 +13,6 @@ export default ([ defaultValue: 'Toolbox' }, icon: 'configure', - isExact: false, isHidden: false, name: 'toolbox' } diff --git a/packages/apps/src/routing/unknown.ts b/packages/apps/src/routing/unknown.ts deleted file mode 100644 index 597794c804..0000000000 --- a/packages/apps/src/routing/unknown.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2017-2018 @polkadot/apps authors & contributors -// This software may be modified and distributed under the terms -// of the ISC license. See the LICENSE file for details. - -import { Route } from '../types'; - -import NotFound from '../NotFound'; - -export default ({ - Component: NotFound, - i18n: { - defaultValue: 'Not found' - }, - icon: 'warning circle', - isExact: false, - isHidden: true, - name: 'unknown' -} as Route); diff --git a/packages/apps/src/routing/vanitygen.ts b/packages/apps/src/routing/vanitygen.ts index 1214c0cc86..50e3436059 100644 --- a/packages/apps/src/routing/vanitygen.ts +++ b/packages/apps/src/routing/vanitygen.ts @@ -13,7 +13,6 @@ export default ([ defaultValue: 'Vanity' }, icon: 'hand lizard', - isExact: false, isHidden: false, name: 'vanitygen' } diff --git a/packages/apps/src/types.d.ts b/packages/apps/src/types.d.ts index 3b6d87f4d7..ec0f186bf0 100644 --- a/packages/apps/src/types.d.ts +++ b/packages/apps/src/types.d.ts @@ -5,20 +5,21 @@ import { SemanticICONS } from 'semantic-ui-react/dist/commonjs'; import { BareProps } from '@polkadot/ui-app/types'; +export type RouteProps = BareProps & { + basePath: string +} + export type Route = { - Component: React.ComponentType, + Component: React.ComponentType, i18n: any, // I18Next$Translate$Config, icon: SemanticICONS, - isExact: boolean, isHidden: boolean, - name: string, - path?: string + name: string }; export type Routes = Array; export type Routing = { default: string, - routes: Routes, - unknown: Route + routes: Routes } diff --git a/packages/ui-keyring/package.json b/packages/ui-keyring/package.json index 1bd62b1a79..018d1b1eb6 100644 --- a/packages/ui-keyring/package.json +++ b/packages/ui-keyring/package.json @@ -9,11 +9,6 @@ ], "contributors": [], "license": "ISC", - "scripts": { - "build": "polkadot-dev-build-babel", - "check": "stylelint 'src/**/*.css' && eslint src && flow check", - "test": "jest --coverage" - }, "dependencies": { "@babel/runtime": "^7.0.0-beta.51", "@polkadot/ui-react": "^0.19.33", diff --git a/packages/ui-react-rx/package.json b/packages/ui-react-rx/package.json index 038e487668..8fa8f8790f 100644 --- a/packages/ui-react-rx/package.json +++ b/packages/ui-react-rx/package.json @@ -29,11 +29,6 @@ "url": "https://github.com/polkadot-js/ui/issues" }, "homepage": "https://github.com/polkadot-js/ui/tree/master/packages/ui-react-rx#readme", - "scripts": { - "build": "polkadot-dev-build-babel", - "check": "eslint src && flow check", - "test": "echo \"Tests only available from root wrapper\"" - }, "dependencies": { "@babel/runtime": "^7.0.0-beta.51", "@polkadot/api-rx": "^0.28.14", diff --git a/packages/ui-react/package.json b/packages/ui-react/package.json index b474e105f2..b8f9ce8356 100644 --- a/packages/ui-react/package.json +++ b/packages/ui-react/package.json @@ -3,11 +3,6 @@ "version": "0.19.33", "description": "A collection of base React components", "main": "index.js", - "scripts": { - "build": "polkadot-dev-build-babel", - "check": "stylelint 'src/**/*.css' && eslint src && flow check", - "test": "echo \"Tests only available from root wrapper\"" - }, "author": "Jaco Greeff ", "maintainers": [ "Jaco Greeff " diff --git a/packages/ui-signer/package.json b/packages/ui-signer/package.json index 8e60376e08..2267f6ab69 100644 --- a/packages/ui-signer/package.json +++ b/packages/ui-signer/package.json @@ -9,11 +9,6 @@ ], "contributors": [], "license": "ISC", - "scripts": { - "build": "polkadot-dev-build-babel", - "check": "stylelint 'src/**/*.css' && eslint src && flow check", - "test": "jest --coverage" - }, "dependencies": { "@babel/runtime": "^7.0.0-beta.51", "@polkadot/extrinsics": "^0.28.14",