Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
"pioneer/packages/apps*",
"pioneer/packages/page*",
"pioneer/packages/react*",
"pioneer/packages/joy-utils",
"pioneer/packages/joy-members",
"pioneer/packages/joy-pages",
"utils/api-examples"
],
"resolutions": {
Expand Down
3 changes: 0 additions & 3 deletions pioneer/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@
**/coverage/*
**/node_modules/*
packages/old-apps/*
packages/joy-members/*
packages/joy-election/*
packages/joy-forum/*
packages/joy-help/*
packages/joy-media/*
packages/joy-pages/*
packages/joy-proposals/*
packages/joy-roles/*
packages/joy-settings/*
packages/joy-utils/*
packages/joy-utils-old/*
.eslintrc.js
i18next-scanner.config.js
10 changes: 8 additions & 2 deletions pioneer/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,20 @@ module.exports = {
rules: {
...base.rules,
'@typescript-eslint/no-explicit-any': 'off',
'react/prop-types': 'off',
'new-cap': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/ban-ts-comment': 'error',
// why only required in VSCode!?!? is eslint plugin not working like eslint commandline?
// Or are we having to add this because of new versions of eslint-config-* ?
'no-console': 'off',
'header/header': 'off' // Temporary disable polkadot's rule
// Override some extended config rules:
'camelcase': 'off',
'header/header': 'off',
'sort-keys': 'off',
'react/jsx-sort-props': 'off',
'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
},
// isolate pioneer from monorepo eslint rules
root: true
Expand Down
4 changes: 3 additions & 1 deletion pioneer/packages/apps-config/src/api/spec/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import encointerNodeTeeproxy from './encointer-node-teeproxy';
import kulupu from './kulupu';
import nodeTemplate from './node-template';
import stablePoc from './stable-poc';
import joystreamNode from './joystream-node';

export default {
acala,
Expand All @@ -21,5 +22,6 @@ export default {
kulupu,
'node-template': nodeTemplate,
'stable-poc': stablePoc,
stable_poc: stablePoc
stable_poc: stablePoc,
'joystream-node': joystreamNode
};
3 changes: 3 additions & 0 deletions pioneer/packages/apps-config/src/api/spec/joystream-node.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { types } from '@joystream/types';

export default types;
5 changes: 5 additions & 0 deletions pioneer/packages/apps-config/src/settings/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ function createDev (t: TFunction): LinkOption[] {

function createLive (t: TFunction): LinkOption[] {
return [
{
info: 'joystream',
text: t<string>('rpc.joystream', 'Joystream (Current Testnet, hosted by Jsgenesis)', { ns: 'apps-config' }),
value: 'wss://rome-rpc-endpoint.joystream.org:9944'
},
{
dnslink: 'polkadot',
info: 'polkadot',
Expand Down
4 changes: 3 additions & 1 deletion pioneer/packages/apps-config/src/ui/logos/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import nodeNodle from './nodes/nodle.svg';
import nodePolkadot from './nodes/polkadot-circle.svg';
import nodePolkadotJs from './nodes/polkadot-js.svg';
import nodeSubstrate from './nodes/substrate-hexagon.svg';
import nodeJoystream from './nodes/joystream-node.svg';

// extensions
import extensionPolkadotJs from './extensions/polkadot-js.svg';
Expand Down Expand Up @@ -48,7 +49,8 @@ const nodeLogos: Record<string, any> = [
['Nodle Chain Node', nodeNodle],
['parity-polkadot', nodePolkadot],
['polkadot-js', nodePolkadotJs],
['substrate-node', nodeSubstrate]
['substrate-node', nodeSubstrate],
['joystream-node', nodeJoystream]
].reduce((logos, [node, logo]): Record<string, any> => ({
...logos,
[(node as string).toLowerCase().replace(/-/g, ' ')]: logo
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
62 changes: 21 additions & 41 deletions pioneer/packages/apps-routing/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,69 +9,49 @@ import appSettings from '@polkadot/ui-settings';
// When adding here, also ensure to add to Dummy.tsx

import accounts from './accounts';
import claims from './claims';
import contracts from './contracts';
import council from './council';
// import dashboard from './dashboard';
import democracy from './democracy';
import explorer from './explorer';
import extrinsics from './extrinsics';
import genericAsset from './generic-asset';
import js from './js';
import parachains from './parachains';
import poll from './poll';
import settings from './settings';
import society from './society';
import staking from './staking';
import storage from './storage';
import sudo from './sudo';
import techcomm from './techcomm';
import toolbox from './toolbox';
import transfer from './transfer';
import treasury from './treasury';
// Joy packages
import members from './joy-members';
import { terms, privacyPolicy } from './joy-pages';

export default function create (t: <T = string> (key: string, text: string, options: { ns: string }) => T): Routes {
return appSettings.uiMode === 'light'
? [
// dashboard,
explorer(t),
accounts(t),
claims(t),
poll(t),
transfer(t),
genericAsset(t),
null,
members(t),
staking(t),
democracy(t),
council(t),
// TODO Not sure about the inclusion of treasury, parachains & society here
null,
settings(t)
transfer(t),
accounts(t),
settings(t),
// Those are hidden
terms(t),
privacyPolicy(t)
]
: [
// dashboard(t),
explorer(t),
accounts(t),
claims(t),
poll(t),
transfer(t),
genericAsset(t),
null,
members(t),
staking(t),
democracy(t),
council(t),
treasury(t),
techcomm(t),
parachains(t),
society(t),
null,
contracts(t),
transfer(t),
accounts(t),
settings(t),
null,
explorer(t),
storage(t),
extrinsics(t),
js(t),
toolbox(t),
sudo(t),
null,
settings(t),
toolbox(t),
js(t)
// Those are hidden
terms(t),
privacyPolicy(t)
];
}
15 changes: 15 additions & 0 deletions pioneer/packages/apps-routing/src/joy-members.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Route } from './types';

import Members from '@polkadot/joy-members/index';

export default function create (t: <T = string> (key: string, text: string, options: { ns: string }) => T): Route {
return {
Component: Members,
display: {
needsApi: ['query.members.nextMemberId']
},
icon: 'users',
name: 'members',
text: t<string>('nav.membership', 'Membership', { ns: 'apps-routing' })
};
}
27 changes: 27 additions & 0 deletions pioneer/packages/apps-routing/src/joy-pages.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Route } from './types';

import { ToS, Privacy } from '@polkadot/joy-pages/index';

export function terms (t: <T = string> (key: string, text: string, options: { ns: string }) => T): Route {
return {
Component: ToS,
display: {
isHidden: true
},
text: t<string>('nav.terms', 'Terms of Service', { ns: 'apps-routing' }),
icon: 'file',
name: 'pages/tos'
};
}

export function privacyPolicy (t: <T = string> (key: string, text: string, options: { ns: string }) => T): Route {
return {
Component: Privacy,
display: {
isHidden: true
},
text: t<string>('nav.privacy', 'Privacy Policy', { ns: 'apps-routing' }),
icon: 'file',
name: 'pages/privacy'
};
}
Binary file modified pioneer/packages/apps/public/favicon.ico
Binary file not shown.
11 changes: 11 additions & 0 deletions pioneer/packages/apps/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@
<link rel="manifest" href="manifest.json">
<link rel="shortcut icon" href="favicon.ico">
<title><%= htmlWebpackPlugin.options.PAGE_TITLE %></title>
<% if (htmlWebpackPlugin.options.IS_PROD) { %>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-133429788-6"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'UA-133429788-6', { 'anonymize_ip': true });
</script>
<% } %>
<script type="text/javascript" src="/env-config.js"></script>
</head>
<body>
Expand Down
15 changes: 14 additions & 1 deletion pioneer/packages/apps/src/Apps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ import SideBar from './SideBar';
import WarmUp from './WarmUp';
import { WindowDimensionsCtx } from './WindowDimensions';

/* Joystream-specific */
import TopBar from './JoyTopBar/TopBar';

interface SidebarState {
isCollapsed: boolean;
isMenu: boolean;
Expand Down Expand Up @@ -96,7 +99,10 @@ function Apps ({ className = '' }: Props): React.ReactElement<Props> {
toggleMenu={_toggleMenu}
/>
<Signer>
<Content />
<div className='apps--Main'>
<TopBar />
<Content />
</div>
</Signer>
<ConnectingOverlay />
<div id={PORTAL_ID} />
Expand Down Expand Up @@ -222,4 +228,11 @@ export default React.memo(styled(Apps)`
opacity: 1;
}
}

.apps--Main {
flex-grow: 1;
min-height: 100vh;
overflow-x: hidden;
overflow-y: auto;
}
`);
2 changes: 1 addition & 1 deletion pioneer/packages/apps/src/Content/NotFound.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Redirect } from 'react-router';

function NotFound (): React.ReactElement {
return (
<Redirect to='/explorer' />
<Redirect to='/staking' />
);
}

Expand Down
8 changes: 2 additions & 6 deletions pioneer/packages/apps/src/Content/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,11 @@ function Content ({ className }: Props): React.ReactElement<Props> {
}

export default React.memo(styled(Content)`
background: #f5f4f3;
flex-grow: 1;
height: 100%;
min-height: 100vh;
overflow-x: hidden;
overflow-y: auto;
background: rgba(250, 250, 250);
padding: 0 1.5rem;
position: relative;
width: 100%;
height: 100%;

@media(max-width: 768px) {
padding: 0 0.5rem;
Expand Down
56 changes: 56 additions & 0 deletions pioneer/packages/apps/src/JoyTopBar/TopBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import React from 'react';
import { useMyMembership } from '@polkadot/joy-utils/react/hooks';
import { InputAddress } from '@polkadot/react-components';
import { Available } from '@polkadot/react-query';
import styled from 'styled-components';
import { useApi } from '@polkadot/react-hooks';

const StyledTopBar = styled.div`
padding: 0.75rem;
background-color: #3f3f3f;
border-bottom: 1px solid #d4d4d5;
text-align: right;
margin: 0;

&.NoMyAddress {
background-color: #ffeb83;
color: #000;
text-align: center;
}

.ui--InputAddress {
display: inline-block;
}
`;

function JoyTopBar () {
const {
allAccounts,
myAddress
} = useMyMembership();

const { isApiReady } = useApi();

if (!isApiReady) {
return null;
}

const balance = <span className='label'>Balance: </span>;
const labelExtra = myAddress
? <Available label={balance} params={myAddress} />
: 'No key selected';

return Object.keys(allAccounts || {}).length ? (
<StyledTopBar>
<InputAddress
defaultValue={myAddress}
help='My current key that signs transactions'
label='My key'
labelExtra={labelExtra}
type='account'
/>
</StyledTopBar>
) : null;
}

export default JoyTopBar;
2 changes: 1 addition & 1 deletion pioneer/packages/apps/src/SideBar/ChainInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function ChainInfo ({ className = '', onClick }: Props): React.ReactElement<Prop

return (
<div
className={`apps--SideBar-logo ${className} ui--highlight--border`}
className={`apps--SideBar-logo ${className}`}
onClick={onClick}
>
<div className='apps--SideBar-logo-inner'>
Expand Down
Loading