diff --git a/package.json b/package.json index ee24adaf31..6041097fc5 100644 --- a/package.json +++ b/package.json @@ -20,12 +20,7 @@ "devops/eslint-config", "devops/prettier-config", "pioneer", - "pioneer/packages/apps*", - "pioneer/packages/page*", - "pioneer/packages/react*", - "pioneer/packages/joy-utils", - "pioneer/packages/joy-members", - "pioneer/packages/joy-pages", + "pioneer/packages/*", "utils/api-examples" ], "resolutions": { @@ -37,7 +32,8 @@ "@polkadot/util-crypto": "3.0.1", "@polkadot/wasm-crypto": "1.2.1", "babel-core": "^7.0.0-bridge.0", - "typescript": "^3.9.7" + "typescript": "^3.9.7", + "bn.js": "^5.1.2" }, "devDependencies": { "husky": "^4.2.5", diff --git a/pioneer/.eslintignore b/pioneer/.eslintignore index 42a2471efd..50caaf3056 100644 --- a/pioneer/.eslintignore +++ b/pioneer/.eslintignore @@ -1,14 +1,5 @@ **/build/* **/coverage/* **/node_modules/* -packages/old-apps/* -packages/joy-election/* -packages/joy-forum/* -packages/joy-help/* -packages/joy-media/* -packages/joy-proposals/* -packages/joy-roles/* -packages/joy-settings/* -packages/joy-utils-old/* .eslintrc.js i18next-scanner.config.js diff --git a/pioneer/.eslintrc.js b/pioneer/.eslintrc.js index a909f51bfc..4b3de541bd 100644 --- a/pioneer/.eslintrc.js +++ b/pioneer/.eslintrc.js @@ -27,6 +27,8 @@ module.exports = { 'react/jsx-max-props-per-line': 'off', 'sort-destructure-keys/sort-destructure-keys': 'off', '@typescript-eslint/unbound-method': 'warn', // Doesn't work well with our version of Formik, see: https://github.com/formium/formik/issues/2589 + 'react-hooks/exhaustive-deps': 'warn', // Causes more issues than it solves currently + 'no-void': 'off' // Otherwise we cannot mark unhandles promises }, // isolate pioneer from monorepo eslint rules root: true diff --git a/pioneer/.storybook/webpack.config.js b/pioneer/.storybook/webpack.config.js index 6c02952773..32d03f6c6a 100644 --- a/pioneer/.storybook/webpack.config.js +++ b/pioneer/.storybook/webpack.config.js @@ -1,81 +1,47 @@ const path = require('path') const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); module.exports = ({ config }) => { + // Styles (replace the provided rule): + const originalCssRuleIndex = config.module.rules.findIndex(rule => rule.test.source.includes('.css')); + config.module.rules[originalCssRuleIndex] = { + test: /\.(sa|sc|c)ss$/i, + use: [ + // Creates `style` nodes from JS strings + 'style-loader', + // Translates CSS into CommonJS + 'css-loader', + // Compiles Sass to CSS + 'sass-loader' + ] + }; -// Post CSS loader for sources: -config.module.rules.push({ - test: /\.css$/, - include: path.resolve(__dirname, '../packages'), - exclude: /(node_modules)/, - use: [ - { - loader: require.resolve('postcss-loader'), - options: { - // Set postcss.config.js config path && ctx - config: { - path: '../postcss.config.js', - }, - ident: 'postcss', - plugins: () => [ - require('precss'), - require('autoprefixer'), - require('postcss-simple-vars'), - require('postcss-nested'), - require('postcss-import'), - require('postcss-clean')(), - require('postcss-flexbugs-fixes') - ] - } - } - ] -}); + // TypeScript loader (via Babel to match polkadot/apps) + config.module.rules.push({ + test: /\.(js|ts|tsx)$/, + exclude: /(node_modules)/, + use: [ + { + loader: require.resolve('babel-loader'), + options: require('@polkadot/dev/config/babel') + }, + ], + }); + config.resolve.extensions.push('.js', '.ts', '.tsx'); -// TypeScript loader (via Babel to match polkadot/apps) -config.module.rules.push({ - test: /\.(js|ts|tsx)$/, - exclude: /(node_modules)/, - use: [ - { - loader: require.resolve('babel-loader'), - options: require('@polkadot/dev-react/config/babel') - }, - ], -}); -config.resolve.extensions.push('.js', '.ts', '.tsx'); + // TSConfig, uses the same file as packages + config.resolve.plugins = config.resolve.plugins || []; + config.resolve.plugins.push( + new TsconfigPathsPlugin({ + configFile: path.resolve(__dirname, '../tsconfig.json'), + }) + ); -// TSConfig, uses the same file as packages -config.resolve.plugins = config.resolve.plugins || []; -config.resolve.plugins.push( - new TsconfigPathsPlugin({ - configFile: path.resolve(__dirname, '../tsconfig.json'), - }) -); + // Stories parser + config.module.rules.push({ + test: /\.stories\.tsx?$/, + loaders: [require.resolve('@storybook/source-loader')], + enforce: 'pre', + }); -// Stories parser -config.module.rules.push({ - test: /\.stories\.tsx?$/, - loaders: [require.resolve('@storybook/source-loader')], - enforce: 'pre', -}); - -// CSS preprocessors -config.module.rules.push( - { - test: /\.s[ac]ss$/i, - use: [ - // Creates `style` nodes from JS strings - 'style-loader', - // Translates CSS into CommonJS - 'css-loader', - // Compiles Sass to CSS - 'sass-loader', - ], - }, - { - test: /\.less$/, - loaders: [ 'style-loader', 'css-loader', 'less-loader' ] - } -); - -return config; + return config; }; diff --git a/pioneer/package.json b/pioneer/package.json index b050147ce3..91a97d68d7 100644 --- a/pioneer/package.json +++ b/pioneer/package.json @@ -25,7 +25,6 @@ "test": "echo \"skipping tests\"", "vanitygen": "node packages/app-accounts/scripts/vanitygen.js", "start": "yarn clean && cd packages/apps && webpack --config webpack.config.js", - "generate-schemas": "json2ts -i packages/joy-types/src/schemas/role.schema.json -o packages/joy-types/src/schemas/role.schema.ts", "build-storybook": "build-storybook -c .storybook", "storybook": "start-storybook -s ./packages/apps/public -p 3001" }, @@ -40,7 +39,7 @@ "@types/chart.js": "^2.9.23", "@types/file-saver": "^2.0.1", "@types/i18next": "^13.0.0", - "@types/jest": "^26.0.7", + "@types/jest": "^26.0.10", "@types/react-beautiful-dnd": "^13.0.0", "@types/react-copy-to-clipboard": "^4.3.0", "@types/react-dom": "^16.9.8", @@ -74,11 +73,13 @@ "@storybook/addon-actions": "^5.2.5", "@storybook/addon-console": "^1.2.1", "@storybook/react": "^5.2.5", - "json-schema-to-typescript": "^7.1.0", "storybook-react-router": "^1.0.8", "typescript": "^3.9.7", "eslint-plugin-header": "^3.0.0", - "eslint-plugin-sort-destructure-keys": "^1.3.5" + "eslint-plugin-sort-destructure-keys": "^1.3.5", + "jest": "^26.4.1", + "ts-jest": "^26.2.0", + "tsconfig-paths-webpack-plugin": "^3.2.0" }, "dependencies": { "@types/lodash": "^4.14.138", diff --git a/pioneer/packages/apps-config/src/settings/endpoints.ts b/pioneer/packages/apps-config/src/settings/endpoints.ts index c7d662f519..88118e3f55 100644 --- a/pioneer/packages/apps-config/src/settings/endpoints.ts +++ b/pioneer/packages/apps-config/src/settings/endpoints.ts @@ -33,94 +33,94 @@ function createLive (t: TFunction): LinkOption[] { info: 'joystream', text: t('rpc.joystream', 'Joystream (Current Testnet, hosted by Jsgenesis)', { ns: 'apps-config' }), value: 'wss://rome-rpc-endpoint.joystream.org:9944' - }, - { - dnslink: 'polkadot', - info: 'polkadot', - text: t('rpc.polkadot.parity', 'Polkadot (Live, hosted by Parity)', { ns: 'apps-config' }), - value: 'wss://rpc.polkadot.io' - }, - { - dnslink: 'polkadot', - info: 'polkadot', - text: t('rpc.polkadot.w3f', 'Polkadot (Live, hosted by Web3 Foundation)', { ns: 'apps-config' }), - value: 'wss://cc1-1.polkadot.network' - }, - { - dnslink: 'kusama', - info: 'kusama', - text: t('rpc.kusama.parity', 'Kusama (Polkadot Canary, hosted by Parity)', { ns: 'apps-config' }), - value: 'wss://kusama-rpc.polkadot.io/' - }, - { - dnslink: 'kusama', - info: 'kusama', - text: t('rpc.kusama.w3f', 'Kusama (Polkadot Canary, hosted by Web3 Foundation)', { ns: 'apps-config' }), - value: 'wss://cc3-5.kusama.network/' - }, - { - dnslink: 'kusama', - info: 'kusama', - text: t('rpc.kusama.ava', 'Kusama (Polkadot Canary, user-run public nodes; see https://status.cloud.ava.do/)', { ns: 'apps-config' }), - value: 'wss://kusama.polkadot.cloud.ava.do/' - }, - { - dnslink: 'centrifuge', - info: 'centrifuge', - text: t('rpc.centrifuge', 'Centrifuge (Mainnet, hosted by Centrifuge)', { ns: 'apps-config' }), - value: 'wss://fullnode.centrifuge.io' - }, - { - dnslink: 'edgeware', - info: 'edgeware', - text: t('rpc.edgeware', 'Edgeware (Mainnet, hosted by Commonwealth Labs)', { ns: 'apps-config' }), - value: 'wss://mainnet1.edgewa.re' - }, - { - dnslink: 'kulupu', - info: 'substrate', - text: t('rpc.kulupu', 'Kulupu (Kulupu Mainnet, hosted by Kulupu)', { ns: 'apps-config' }), - value: 'wss://rpc.kulupu.network/ws' } + // { + // dnslink: 'polkadot', + // info: 'polkadot', + // text: t('rpc.polkadot.parity', 'Polkadot (Live, hosted by Parity)', { ns: 'apps-config' }), + // value: 'wss://rpc.polkadot.io' + // }, + // { + // dnslink: 'polkadot', + // info: 'polkadot', + // text: t('rpc.polkadot.w3f', 'Polkadot (Live, hosted by Web3 Foundation)', { ns: 'apps-config' }), + // value: 'wss://cc1-1.polkadot.network' + // }, + // { + // dnslink: 'kusama', + // info: 'kusama', + // text: t('rpc.kusama.parity', 'Kusama (Polkadot Canary, hosted by Parity)', { ns: 'apps-config' }), + // value: 'wss://kusama-rpc.polkadot.io/' + // }, + // { + // dnslink: 'kusama', + // info: 'kusama', + // text: t('rpc.kusama.w3f', 'Kusama (Polkadot Canary, hosted by Web3 Foundation)', { ns: 'apps-config' }), + // value: 'wss://cc3-5.kusama.network/' + // }, + // { + // dnslink: 'kusama', + // info: 'kusama', + // text: t('rpc.kusama.ava', 'Kusama (Polkadot Canary, user-run public nodes; see https://status.cloud.ava.do/)', { ns: 'apps-config' }), + // value: 'wss://kusama.polkadot.cloud.ava.do/' + // }, + // { + // dnslink: 'centrifuge', + // info: 'centrifuge', + // text: t('rpc.centrifuge', 'Centrifuge (Mainnet, hosted by Centrifuge)', { ns: 'apps-config' }), + // value: 'wss://fullnode.centrifuge.io' + // }, + // { + // dnslink: 'edgeware', + // info: 'edgeware', + // text: t('rpc.edgeware', 'Edgeware (Mainnet, hosted by Commonwealth Labs)', { ns: 'apps-config' }), + // value: 'wss://mainnet1.edgewa.re' + // }, + // { + // dnslink: 'kulupu', + // info: 'substrate', + // text: t('rpc.kulupu', 'Kulupu (Kulupu Mainnet, hosted by Kulupu)', { ns: 'apps-config' }), + // value: 'wss://rpc.kulupu.network/ws' + // } ]; } -function createTest (t: TFunction): LinkOption[] { - return [ - { - dnslink: 'westend', - info: 'westend', - text: t('rpc.westend', 'Westend (Polkadot Testnet, hosted by Parity)', { ns: 'apps-config' }), - value: 'wss://westend-rpc.polkadot.io' - }, - { - info: 'acala', - text: t('rpc.mandala', 'Mandala (Acala Testnet, hosted by Acala)', { ns: 'apps-config' }), - value: 'wss://node-6684611762228215808.jm.onfinality.io/ws' - }, - { - info: 'edgeware', - text: t('rpc.berlin', 'Berlin (Edgeware Testnet, hosted by Commonwealth Labs)', { ns: 'apps-config' }), - value: 'wss://berlin1.edgewa.re' - }, - { - info: 'substrate', - text: t('rpc.flamingfir', 'Flaming Fir (Substrate Testnet, hosted by Parity)', { ns: 'apps-config' }), - value: 'wss://substrate-rpc.parity.io/' - }, - { - info: 'nodle', - text: t('rpc.arcadia', 'Arcadia (Nodle Testnet, hosted by Nodle)', { ns: 'apps-config' }), - value: 'wss://arcadia1.nodleprotocol.io/' - }, - { - info: 'datahighway', - isDisabled: true, - text: t('rpc.datahighway.harbour', 'Harbour (DataHighway Testnet, hosted by MXC)', { ns: 'apps-config' }), - value: 'wss://testnet-harbour.datahighway.com' - } - ]; -} +// function createTest (t: TFunction): LinkOption[] { +// return [ +// { +// dnslink: 'westend', +// info: 'westend', +// text: t('rpc.westend', 'Westend (Polkadot Testnet, hosted by Parity)', { ns: 'apps-config' }), +// value: 'wss://westend-rpc.polkadot.io' +// }, +// { +// info: 'acala', +// text: t('rpc.mandala', 'Mandala (Acala Testnet, hosted by Acala)', { ns: 'apps-config' }), +// value: 'wss://node-6684611762228215808.jm.onfinality.io/ws' +// }, +// { +// info: 'edgeware', +// text: t('rpc.berlin', 'Berlin (Edgeware Testnet, hosted by Commonwealth Labs)', { ns: 'apps-config' }), +// value: 'wss://berlin1.edgewa.re' +// }, +// { +// info: 'substrate', +// text: t('rpc.flamingfir', 'Flaming Fir (Substrate Testnet, hosted by Parity)', { ns: 'apps-config' }), +// value: 'wss://substrate-rpc.parity.io/' +// }, +// { +// info: 'nodle', +// text: t('rpc.arcadia', 'Arcadia (Nodle Testnet, hosted by Nodle)', { ns: 'apps-config' }), +// value: 'wss://arcadia1.nodleprotocol.io/' +// }, +// { +// info: 'datahighway', +// isDisabled: true, +// text: t('rpc.datahighway.harbour', 'Harbour (DataHighway Testnet, hosted by MXC)', { ns: 'apps-config' }), +// value: 'wss://testnet-harbour.datahighway.com' +// } +// ]; +// } function createCustom (t: TFunction): LinkOption[] { const WS_URL = ( @@ -158,12 +158,12 @@ export default function create (t: TFunction): LinkOption[] { value: '' }, ...createLive(t), - { - isHeader: true, - text: t('rpc.header.test', 'Test networks', { ns: 'apps-config' }), - value: '' - }, - ...createTest(t), + // { + // isHeader: true, + // text: t('rpc.header.test', 'Test networks', { ns: 'apps-config' }), + // value: '' + // }, + // ...createTest(t), { isHeader: true, text: t('rpc.header.dev', 'Development', { ns: 'apps-config' }), diff --git a/pioneer/packages/apps-routing/src/index.ts b/pioneer/packages/apps-routing/src/index.ts index 47899c3931..3534b8d050 100644 --- a/pioneer/packages/apps-routing/src/index.ts +++ b/pioneer/packages/apps-routing/src/index.ts @@ -18,29 +18,47 @@ import storage from './storage'; import sudo from './sudo'; import toolbox from './toolbox'; import transfer from './transfer'; +import memo from './memo'; // Joy packages import members from './joy-members'; import { terms, privacyPolicy } from './joy-pages'; +import election from './joy-election'; +import proposals from './joy-proposals'; +import roles from './joy-roles'; +import media from './joy-media'; +import forum from './joy-forum'; export default function create (t: (key: string, text: string, options: { ns: string }) => T): Routes { return appSettings.uiMode === 'light' ? [ + media(t), members(t), + roles(t), + election(t), + proposals(t), + forum(t), staking(t), null, transfer(t), accounts(t), + memo(t), settings(t), // Those are hidden terms(t), privacyPolicy(t) ] : [ + media(t), members(t), + roles(t), + election(t), + proposals(t), + forum(t), staking(t), null, transfer(t), accounts(t), + memo(t), settings(t), null, explorer(t), diff --git a/pioneer/packages/apps-routing/src/joy-election.ts b/pioneer/packages/apps-routing/src/joy-election.ts new file mode 100644 index 0000000000..cbff554d99 --- /dev/null +++ b/pioneer/packages/apps-routing/src/joy-election.ts @@ -0,0 +1,17 @@ +import { Route } from './types'; + +import Election from '@polkadot/joy-election/index'; +import SidebarSubtitle from '@polkadot/joy-election/SidebarSubtitle'; + +export default function create (t: (key: string, text: string, options: { ns: string }) => T): Route { + return { + Component: Election, + display: { + needsApi: ['query.council.activeCouncil', 'query.councilElection.stage'] + }, + text: t('nav.election', 'Council', { ns: 'apps-routing' }), + icon: 'university', + name: 'council', + SubtitleComponent: SidebarSubtitle + }; +} diff --git a/pioneer/packages/apps-routing/src/joy-forum.ts b/pioneer/packages/apps-routing/src/joy-forum.ts new file mode 100644 index 0000000000..d7a293ca34 --- /dev/null +++ b/pioneer/packages/apps-routing/src/joy-forum.ts @@ -0,0 +1,15 @@ +import { Route } from './types'; + +import Forum from '@polkadot/joy-forum/index'; + +export default function create (t: (key: string, text: string, options: { ns: string }) => T): Route { + return { + Component: Forum, + display: { + needsApi: ['query.forum.threadById'] + }, + text: t('nav.forum', 'Forum', { ns: 'apps-routing' }), + icon: 'comment-dots', + name: 'forum' + }; +} diff --git a/pioneer/packages/apps-routing/src/joy-media.ts b/pioneer/packages/apps-routing/src/joy-media.ts new file mode 100644 index 0000000000..befff152ad --- /dev/null +++ b/pioneer/packages/apps-routing/src/joy-media.ts @@ -0,0 +1,15 @@ +import Media from '@polkadot/joy-media/index'; + +import { Route } from './types'; + +export default function create (t: (key: string, text: string, options: { ns: string }) => T): Route { + return { + Component: Media, + display: { + needsApi: ['query.storageWorkingGroup.workerById', 'query.dataObjectStorageRegistry.relationshipsByContentId'] + }, + text: t('nav.media', 'Media', { ns: 'apps-routing' }), + icon: 'play-circle', + name: 'media' + }; +} diff --git a/pioneer/packages/apps-routing/src/joy-proposals.ts b/pioneer/packages/apps-routing/src/joy-proposals.ts new file mode 100644 index 0000000000..4c76e21eb8 --- /dev/null +++ b/pioneer/packages/apps-routing/src/joy-proposals.ts @@ -0,0 +1,16 @@ +import { Route } from './types'; + +import Proposals from '@polkadot/joy-proposals/index'; + +export default function create (t: (key: string, text: string, options: { ns: string }) => T): Route { + return { + Component: Proposals, + display: { + needsApi: ['query.proposalsEngine.proposalCount'] + }, + text: t('nav.proposals', 'Proposals', { ns: 'apps-routing' }), + icon: 'tasks', + name: 'proposals' + // TODO: useCounter with active proposals count? (could be a nice addition) + }; +} diff --git a/pioneer/packages/old-apps/apps-routing/src/joy-roles.ts b/pioneer/packages/apps-routing/src/joy-roles.ts similarity index 50% rename from pioneer/packages/old-apps/apps-routing/src/joy-roles.ts rename to pioneer/packages/apps-routing/src/joy-roles.ts index 7131a2fce8..8664da1e52 100644 --- a/pioneer/packages/old-apps/apps-routing/src/joy-roles.ts +++ b/pioneer/packages/apps-routing/src/joy-roles.ts @@ -1,9 +1,9 @@ -import { Routes } from './types'; +import { Route } from './types'; import Roles from '@polkadot/joy-roles/index'; -export default ([ - { +export default function create (t: (key: string, text: string, options: { ns: string }) => T): Route { + return { Component: Roles, display: { needsApi: [ @@ -11,10 +11,8 @@ export default ([ 'query.storageWorkingGroup.mint' ] }, - i18n: { - defaultValue: 'Working groups' - }, + text: t('nav.roles', 'Working groups', { ns: 'apps-routing' }), icon: 'users', name: 'working-groups' - } -] as Routes); + }; +} diff --git a/pioneer/packages/apps-routing/src/memo.ts b/pioneer/packages/apps-routing/src/memo.ts new file mode 100644 index 0000000000..d1a7b9fee0 --- /dev/null +++ b/pioneer/packages/apps-routing/src/memo.ts @@ -0,0 +1,20 @@ +import { Route } from './types'; + +import { MemoModal } from '@polkadot/joy-utils/react/components/Memo'; + +export default function create (t: (key: string, text: string, options: { ns: string }) => T): Route { + return { + // Assert to get around the uncecessary requirement for RouteProps + Component: MemoModal as React.ComponentType, + Modal: MemoModal, + display: { + isHidden: false, + needsApi: [ + 'tx.memo.updateMemo' + ] + }, + icon: 'sticky-note', + name: 'memo', + text: t('nav.memo', 'My memo', { ns: 'apps-routing' }) + }; +} diff --git a/pioneer/packages/apps-routing/src/types.ts b/pioneer/packages/apps-routing/src/types.ts index 6dce432d8c..4a6695fef2 100644 --- a/pioneer/packages/apps-routing/src/types.ts +++ b/pioneer/packages/apps-routing/src/types.ts @@ -24,6 +24,8 @@ export interface Route { name: string; text: string; useCounter?: () => number | string | null; + // Joystream-specific + SubtitleComponent?: React.ComponentType; } export type Routes = (Route | null)[]; diff --git a/pioneer/packages/old-apps/apps/public/images/default-thumbnail.png b/pioneer/packages/apps/public/images/default-thumbnail.png similarity index 100% rename from pioneer/packages/old-apps/apps/public/images/default-thumbnail.png rename to pioneer/packages/apps/public/images/default-thumbnail.png diff --git a/pioneer/packages/apps/public/locales/en/index.json b/pioneer/packages/apps/public/locales/en/index.json index 962b58bcc3..eec63e3079 100644 --- a/pioneer/packages/apps/public/locales/en/index.json +++ b/pioneer/packages/apps/public/locales/en/index.json @@ -25,6 +25,7 @@ "joy-media.json", "joy-members.json", "joy-roles.json", + "joy-utils.json", "react-components.json", "react-params.json", "react-query.json", diff --git a/pioneer/packages/apps/public/locales/en/joy-settings.json b/pioneer/packages/apps/public/locales/en/joy-settings.json deleted file mode 100644 index 9e26dfeeb6..0000000000 --- a/pioneer/packages/apps/public/locales/en/joy-settings.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/pioneer/packages/apps/public/locales/en/joy-utils-old.json b/pioneer/packages/apps/public/locales/en/joy-utils-old.json deleted file mode 100644 index 9e26dfeeb6..0000000000 --- a/pioneer/packages/apps/public/locales/en/joy-utils-old.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/pioneer/packages/apps/public/locales/en/joy-utils.json b/pioneer/packages/apps/public/locales/en/joy-utils.json index 9e26dfeeb6..d094e35b91 100644 --- a/pioneer/packages/apps/public/locales/en/joy-utils.json +++ b/pioneer/packages/apps/public/locales/en/joy-utils.json @@ -1 +1,4 @@ -{} \ No newline at end of file +{ + "click to select or drag and drop the file here": "click to select or drag and drop the file here", + "{{name}} ({{size}} bytes)": "{{name}} ({{size}} bytes)" +} \ No newline at end of file diff --git a/pioneer/packages/apps/src/Content/NotFound.tsx b/pioneer/packages/apps/src/Content/NotFound.tsx index f2c58785c9..71c4a1fd95 100644 --- a/pioneer/packages/apps/src/Content/NotFound.tsx +++ b/pioneer/packages/apps/src/Content/NotFound.tsx @@ -7,7 +7,7 @@ import { Redirect } from 'react-router'; function NotFound (): React.ReactElement { return ( - + ); } diff --git a/pioneer/packages/apps/src/Content/index.tsx b/pioneer/packages/apps/src/Content/index.tsx index 63f0238535..a375b8b91c 100644 --- a/pioneer/packages/apps/src/Content/index.tsx +++ b/pioneer/packages/apps/src/Content/index.tsx @@ -16,6 +16,11 @@ import { useTranslation } from '../translate'; import NotFound from './NotFound'; import Status from './Status'; +// Joystream-specific +// We must use transport provider here instead of /apps/src/index +// to avoid "Cannot create Transport: The Substrate API is not ready yet." error +import { TransportProvider } from '@polkadot/joy-utils/react/context'; + interface Props { className?: string; } @@ -60,11 +65,25 @@ function Content ({ className }: Props): React.ReactElement { ? : ( - + { needsApi + // Add transport provider for routes that need the api + // (the above condition makes sure it's aleady initialized at this point) + ? ( + + + + ) + : ( + + ) } ) } @@ -78,7 +97,6 @@ function Content ({ className }: Props): React.ReactElement { } export default React.memo(styled(Content)` - background: rgba(250, 250, 250); padding: 0 1.5rem; position: relative; width: 100%; diff --git a/pioneer/packages/apps/src/SideBar/Item.tsx b/pioneer/packages/apps/src/SideBar/Item.tsx index abcd801144..629f9c9c19 100644 --- a/pioneer/packages/apps/src/SideBar/Item.tsx +++ b/pioneer/packages/apps/src/SideBar/Item.tsx @@ -79,12 +79,15 @@ function Item ({ isCollapsed, onClick, route }: Props): React.ReactElement - {text} + + {text} + { SubtitleComponent && } + {!!count && (