Skip to content

Commit

Permalink
Add operator (#3)
Browse files Browse the repository at this point in the history
* Change selection for council votes (polkadot-js#1865)

* [CI Skip]  0.37.0-beta.66

* Add staking favorites (top of list) (polkadot-js#1866)

* [CI Skip]  0.37.0-beta.67

* Small fav display tweaks (polkadot-js#1868)

* Add staking favorites (top of list)

* Small display  tweaks

* Checks

* [CI Skip]  0.37.0-beta.68

* Add fav & current as nominations (polkadot-js#1869)

* Add fav & current as nominations

* Toggle nominee at end

* Selection icons for council

* [CI Skip]  0.37.0-beta.69

* Add treasury balance (polkadot-js#1870)

* [CI Skip]  0.37.0-beta.70

* Blocks per session graph (hidden) (polkadot-js#1871)

* [CI Skip]  0.37.0-beta.71

* Functional InputNumber with fixed bugs (polkadot-js#1820)

* Functional InputNumber

* linting

* linting

* remove max button

* linting

* linting

* version

* version

* combine values

* fix

* Re-enable SI dropdown

* KSM  formats

* Formatting tweaks

* Mini fixes

* Adjust postfix opacity

* Linting

* More linting

* Remove unneeded list override

* Misc small adjustments

* Vertical alignment

* [CI Skip]  0.37.0-beta.72

* Enable validator overview (polkadot-js#1872)

* Enable validator overview

* CallDiv indicator for consts

* [CI Skip]  0.37.0-beta.73

* Add useFavorites hook (incl. react-hooks package) (polkadot-js#1873)

* Add useFavorites hook

* useFavorites to Nominate

* Fix filter: grayscale positioning

* [CI Skip]  0.37.0-beta.74

* Add elected stake (polkadot-js#1874)

* [CI Skip]  0.37.0-beta.75

* Bump deps (polkadot-js#1876)

* [CI Skip]  0.37.0-beta.76

skip-checks: true

* Extract getHistory query (re-use) (polkadot-js#1877)

* [CI Skip]  0.37.0-beta.77

skip-checks: true

* Adjust extrinsic selection display, UI alignment (polkadot-js#1878)

* [CI Skip]  0.37.0-beta.78

skip-checks: true

* Auto-populate Vote balance (polkadot-js#1879)

* Auto-populate Vote balance

* Commenting

* [CI Skip]  0.37.0-beta.79

skip-checks: true

* Fix InputBalance default display (polkadot-js#1880)

* [CI Skip]  0.37.0-beta.80

skip-checks: true

* Bump deps (polkadot-js#1881)

* Bump deps

* Massive numbers tweaks

* [CI Skip]  0.37.0-beta.81

skip-checks: true

* Staker breakdown graph (polkadot-js#1882)

* [CI Skip]  0.37.0-beta.82

skip-checks: true

* Bump API, display vested (polkadot-js#1883)

* Bump API, display vested

* Add isVesting to constants

* [CI Skip]  0.37.0-beta.83

skip-checks: true

* Fix validatorPrefs (don't pull defaults) (polkadot-js#1885)

* [CI Skip]  0.37.0-beta.84

skip-checks: true

* Add slashing graph (polkadot-js#1886)

* [CI Skip]  0.37.0-beta.85

skip-checks: true

* Align graph lengths (polkadot-js#1887)

* [CI Skip]  0.37.0-beta.86

skip-checks: true

* Small chart label adjustments (polkadot-js#1888)

* Staking chart opt.

* Small cleanups

* Push  through validatorId in rewards calc

* [CI Skip]  0.37.0-beta.87

skip-checks: true

* Add useApiContext (polkadot-js#1890)

* Add useApiContext

* Add missing withApiContext import

* useCacheKey, rename headers

* Adjustment on sessionRewards naming

* Renames based on defacto standards

* [CI Skip]  0.37.0-beta.88

skip-checks: true

* Add trackStream, impl. in staking overview (polkadot-js#1891)

* Add trackStream, impl. in staking overview

* Use trackStream in Address

* Fix linting

* Add reward displays

* [CI Skip]  0.37.0-beta.89

skip-checks: true

* Map non-account stashes (polkadot-js#1892)

* [CI Skip]  0.37.0-beta.90

skip-checks: true

* Bump api (polkadot-js#1895)

* [CI Skip]  0.37.0-beta.91

skip-checks: true

* Popup menu expansion for account/address (polkadot-js#1896)

* Popup menu expansion for account/address

* Add chain locking to settings

* Swap top tag location

* [CI Skip]  0.37.0-beta.92

skip-checks: true

* Add currency indicator to staking charts (polkadot-js#1897)

* [CI Skip]  0.37.0-beta.93

skip-checks: true

* useAccounts hook (polkadot-js#1898)

* useAccounts hook

* Drop some withRouter

* Add setImmediate to trackStream

* Combine unsubscribe into subscribe

* Use before define

* Ass trackPromise

* Cleanup mapping for params

* Addressbook display

* [CI Skip]  0.37.0-beta.94

skip-checks: true

* Allow basic chart display w/ non-archive (polkadot-js#1899)

* [CI Skip]  0.37.0-beta.95

skip-checks: true

* add routing

* add app-operator apps

* s/useApiContext/useApi/ (polkadot-js#1900)

* [CI Skip]  0.37.0-beta.96

skip-checks: true

* add operator

* WIP: change operator

* Disable stash operations (when not own) (polkadot-js#1901)

* [CI Skip]  0.37.0-beta.97

skip-checks: true

* Cleanup reward graphs (polkadot-js#1904)

* Cleanup reward graphs

* Cleanup import

* [CI Skip]  0.37.0-beta.98

skip-checks: true

* Small query cleanups (historic) (polkadot-js#1905)

* Small query cleanups (historic)

* Rewards average counter update

* [CI Skip]  0.37.0-beta.99

skip-checks: true

* Show rotate keys (as available) (polkadot-js#1906)

* [CI Skip]  0.37.0-beta.100

skip-checks: true

* Bump API (polkadot-js#1907)

* Tracker updates

* Bump API

* Fix linting

* track* comments

* [CI Skip]  0.37.0-beta.101

skip-checks: true

* Fix old v1 queryStorage results (polkadot-js#1909)

* [CI Skip]  0.37.0-beta.102

skip-checks: true

* Subscribe to runtimeVersion in UI display (polkadot-js#1910)

* [CI Skip]  0.37.0-beta.103

skip-checks: true

* Bump API (polkadot-js#1911)

* Bump API

* Session keys cleanup

* [CI Skip]  0.37.0-beta.104

skip-checks: true

* Allow zero values for rewards (polkadot-js#1913)

* [CI Skip]  0.37.0-beta.105

skip-checks: true

* Adjust staking (polkadot-js#1914)

* Adjust staking

* Bump deps

* [CI Skip]  0.37.0-beta.106

skip-checks: true

* Bump API (available calcs) (polkadot-js#1915)

* [CI Skip]  0.37.0-beta.107

skip-checks: true

* Fix Vec<u8> issue (polkadot-js#1916)

* fix vec<u8>

* api version

* console

* lint

* [CI Skip]  0.37.0-beta.108

skip-checks: true

* fix yarn upgrade

* add change operator

* fix SturctParam
  • Loading branch information
satellitex committed Nov 20, 2019
1 parent 32f935d commit d987787
Show file tree
Hide file tree
Showing 169 changed files with 4,090 additions and 1,759 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ In addition the following libraries are also included in the repo. These are to

Contributions are welcome!

To start off, this repo (along with others in the [@polkadot](https://github.com/polkadot-js/) family) uses yarn workspaces to organise the code. As such, after cloning dependencies _should_ be installed via `yarn`, not via npm, the latter will result in broken dependencies.
To start off, this repo (along with others in the [@polkadot](https://github.com/polkadot-js/) family) uses yarn workspaces to organize the code. As such, after cloning dependencies _should_ be installed via `yarn`, not via npm, the latter will result in broken dependencies.

To get started -

Expand All @@ -55,7 +55,7 @@ To get started -

## I want to code around

There is a base template availble [app-123code](packages/app-123code/) that acts as a simple starting point for adding additional apps to the UI. Alternatively if you just want some place where you can write some code, it does the trick.
There is a base template available [app-123code](packages/app-123code/) that acts as a simple starting point for adding additional apps to the UI. Alternatively if you just want some place where you can write some code, it does the trick.

While it is hidden from the sidebar, it is accessible via [http://127.0.0.1:3000/#/123code](http://127.0.0.1:3000/#/123code)

Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"packages": [
"packages/*"
],
"version": "0.37.0-beta.72"
"version": "0.37.0-beta.108"
}
30 changes: 19 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.37.0-beta.72",
"version": "0.37.0-beta.108",
"private": true,
"engines": {
"node": ">=10.13.0",
Expand All @@ -10,12 +10,12 @@
"packages/*"
],
"resolutions": {
"@polkadot/api": "^0.97.0-beta.2",
"@polkadot/api-contract": "^0.97.0-beta.2",
"@polkadot/keyring": "^1.7.0-beta.6",
"@polkadot/types": "^0.97.0-beta.2",
"@polkadot/util": "^1.7.0-beta.6",
"@polkadot/util-crypto": "^1.7.0-beta.6",
"@polkadot/api": "^0.97.0-beta.16",
"@polkadot/api-contract": "^0.97.0-beta.16",
"@polkadot/keyring": "^1.7.0-beta.7",
"@polkadot/types": "^0.97.0-beta.16",
"@polkadot/util": "^1.7.0-beta.7",
"@polkadot/util-crypto": "^1.7.0-beta.7",
"babel-core": "^7.0.0-bridge.0",
"typescript": "^3.7.2"
},
Expand All @@ -34,10 +34,10 @@
"start": "cd packages/apps && webpack --config webpack.config.js"
},
"devDependencies": {
"@babel/core": "^7.7.0",
"@babel/runtime": "^7.7.1",
"@polkadot/dev-react": "^0.32.0-beta.13",
"@polkadot/ts": "^0.1.84",
"@babel/core": "^7.7.2",
"@babel/runtime": "^7.7.2",
"@polkadot/dev-react": "^0.32.0-beta.14",
"@polkadot/ts": "^0.1.85",
"autoprefixer": "^9.7.1",
"empty": "^0.10.1",
"html-loader": "^0.5.5",
Expand All @@ -53,5 +53,13 @@
"postcss-simple-vars": "^5.0.0",
"precss": "^4.0.0",
"source-map-explorer": "^2.1.0"
},
"dependencies": {
"@polkadot/api": "^0.97.0-beta.2",
"@polkadot/api-contract": "^0.97.0-beta.2",
"@polkadot/keyring": "^1.7.0-beta.6",
"@polkadot/types": "^0.97.0-beta.16",
"@polkadot/util": "^1.7.0-beta.6",
"@polkadot/util-crypto": "^1.7.0-beta.6"
}
}
6 changes: 3 additions & 3 deletions packages/app-123code/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@polkadot/app-123code",
"version": "0.37.0-beta.72",
"version": "0.37.0-beta.108",
"description": "A basic app that shows the ropes on customisation",
"main": "index.js",
"scripts": {},
Expand All @@ -10,7 +10,7 @@
],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.7.1",
"@polkadot/react-components": "^0.37.0-beta.72"
"@babel/runtime": "^7.7.2",
"@polkadot/react-components": "^0.37.0-beta.108"
}
}
7 changes: 4 additions & 3 deletions packages/app-123code/src/SummaryBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import { AccountId } from '@polkadot/types/interfaces';
import { BareProps, I18nProps } from '@polkadot/react-components/types';

import BN from 'bn.js';
import React, { useContext } from 'react';
import { ApiContext, withCalls } from '@polkadot/react-api';
import React from 'react';
import { withCalls } from '@polkadot/react-api';
import { Bubble, IdentityIcon } from '@polkadot/react-components';
import { useApi } from '@polkadot/react-hooks';
import { formatBalance, formatNumber } from '@polkadot/util';

import translate from './translate';
Expand All @@ -22,7 +23,7 @@ interface Props extends BareProps, I18nProps {
}

function SummaryBar ({ balances_totalIssuance, chain_bestNumber, chain_bestNumberLag, staking_validators }: Props): React.ReactElement<Props> {
const { api, systemChain, systemName, systemVersion } = useContext(ApiContext);
const { api, systemChain, systemName, systemVersion } = useApi();

return (
<summary>
Expand Down
8 changes: 4 additions & 4 deletions packages/app-accounts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@polkadot/app-accounts",
"version": "0.37.0-beta.72",
"version": "0.37.0-beta.108",
"main": "index.js",
"repository": "https://github.com/polkadot-js/apps.git",
"author": "Jaco Greeff <jacogr@gmail.com>",
Expand All @@ -10,9 +10,9 @@
"contributors": [],
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.7.1",
"@polkadot/react-components": "^0.37.0-beta.72",
"@polkadot/react-qr": "^0.47.0-beta.5",
"@babel/runtime": "^7.7.2",
"@polkadot/react-components": "^0.37.0-beta.108",
"@polkadot/react-qr": "^0.47.0-beta.6",
"@types/file-saver": "^2.0.0",
"@types/yargs": "^13.0.2",
"babel-plugin-module-resolver": "^3.1.1",
Expand Down
123 changes: 55 additions & 68 deletions packages/app-accounts/src/Account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import { ActionStatus } from '@polkadot/react-components/Status/types';
import { I18nProps } from '@polkadot/react-components/types';

import React, { useState, useEffect } from 'react';
import { Popup } from 'semantic-ui-react';
import styled from 'styled-components';
import { AddressCard, AddressInfo, Button, ChainLock, Forget, Menu } from '@polkadot/react-components';
import { AddressCard, AddressInfo, Button, ChainLock, Forget, Menu, Popup } from '@polkadot/react-components';
import keyring from '@polkadot/ui-keyring';

import Backup from './modals/Backup';
Expand Down Expand Up @@ -47,8 +46,8 @@ function Account ({ address, className, t }: Props): React.ReactElement<Props> {
const _toggleDerive = (): void => setIsDeriveOpen(!isDeriveOpen);
const _toggleForget = (): void => setIsForgetOpen(!isForgetOpen);
const _togglePass = (): void => setIsPasswordOpen(!isPasswordOpen);
const _toggleTransfer = (): void => setIsTransferOpen(!isTransferOpen);
const _toggleSettingPopup = (): void => setIsSettingPopupOpen(!isSettingPopupOpen);
const _toggleTransfer = (): void => setIsTransferOpen(!isTransferOpen);
const _onForget = (): void => {
if (!address) {
return;
Expand Down Expand Up @@ -83,33 +82,6 @@ function Account ({ address, className, t }: Props): React.ReactElement<Props> {
buttons={
<div className='accounts--Account-buttons buttons'>
<div className='actions'>
{isEditable && !isDevelopment && (
<Button
isNegative
onClick={_toggleForget}
icon='trash'
size='small'
tooltip={t('Forget this account')}
/>
)}
{isEditable && !isExternal && !isDevelopment && (
<>
<Button
icon='cloud download'
isPrimary
onClick={_toggleBackup}
size='small'
tooltip={t('Create a backup file for this account')}
/>
<Button
icon='key'
isPrimary
onClick={_togglePass}
size='small'
tooltip={t("Change this account's password")}
/>
</>
)}
<Button
icon='paper plane'
isPrimary
Expand All @@ -118,42 +90,62 @@ function Account ({ address, className, t }: Props): React.ReactElement<Props> {
size='small'
tooltip={t('Send funds from this account')}
/>
{isEditable && !isExternal && (
<Popup
onClose={_toggleSettingPopup}
open={isSettingPopupOpen}
position='bottom left'
trigger={
<Button
icon='setting'
onClick={_toggleSettingPopup}
size='small'
/>
}
>
<Menu
vertical
text
<Popup
className='theme--default'
onClose={_toggleSettingPopup}
open={isSettingPopupOpen}
position='bottom right'
trigger={
<Button
icon='setting'
onClick={_toggleSettingPopup}
size='small'
/>
}
>
<Menu
vertical
text
onClick={_toggleSettingPopup}
>
<Menu.Item
disabled={!isEditable || isExternal}
onClick={_toggleDerive}
>
{t('Derive account from source')}
</Menu.Item>
<Menu.Item disabled>
{t('Change on-chain nickname')}
</Menu.Item>
<Menu.Item
disabled={!isEditable || isExternal || isDevelopment}
onClick={_toggleBackup}
>
{t('Create a backup file for this account')}
</Menu.Item>
<Menu.Item
disabled={!isEditable || isExternal || isDevelopment}
onClick={_togglePass}
>
{t("Change this account's password")}
</Menu.Item>
<Menu.Item
disabled={!isEditable || isDevelopment}
onClick={_toggleForget}
>
<Menu.Item onClick={_toggleDerive}>
{t('Derive account from source')}
</Menu.Item>
<Menu.Item disabled>
{t('Change on-chain nickname')}
</Menu.Item>
</Menu>
</Popup>
)}
{t('Forget this account')}
</Menu.Item>
<Menu.Divider />
<ChainLock
className='accounts--network-toggle'
genesisHash={genesisHash}
isDisabled={!isEditable || isExternal}
onChange={_onGenesisChange}
preventDefault
/>
</Menu>
</Popup>
</div>
{isEditable && !isExternal && (
<div className='others'>
<ChainLock
genesisHash={genesisHash}
onChange={_onGenesisChange}
/>
</div>
)}
</div>
}
className={className}
Expand Down Expand Up @@ -217,11 +209,6 @@ export default translate(
styled(Account)`
.accounts--Account-buttons {
text-align: right;
.others {
margin-right: 0.125rem;
margin-top: 0.25rem;
}
}
`
);
19 changes: 7 additions & 12 deletions packages/app-accounts/src/Overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
// of the Apache-2.0 license. See the LICENSE file for details.

import { I18nProps } from '@polkadot/react-components/types';
import { SubjectInfo } from '@polkadot/ui-keyring/observable/types';
import { ComponentProps } from './types';

import React, { useState } from 'react';
import keyring from '@polkadot/ui-keyring';
import accountObservable from '@polkadot/ui-keyring/observable/accounts';
import { getLedger, isLedger, withMulti, withObservable } from '@polkadot/react-api';
import { getLedger, isLedger } from '@polkadot/react-api';
import { useAccounts } from '@polkadot/react-hooks';
import { Button, CardGrid } from '@polkadot/react-components';

import CreateModal from './modals/Create';
Expand All @@ -20,7 +19,6 @@ import Banner from './Banner';
import translate from './translate';

interface Props extends ComponentProps, I18nProps {
accounts?: SubjectInfo[];
}

// query the ledger for the address, adding it to the keyring
Expand All @@ -36,11 +34,12 @@ async function queryLedger (): Promise<void> {
}
}

function Overview ({ accounts, onStatusChange, t }: Props): React.ReactElement<Props> {
function Overview ({ onStatusChange, t }: Props): React.ReactElement<Props> {
const { allAccounts, hasAccounts } = useAccounts();
const [isCreateOpen, setIsCreateOpen] = useState(false);
const [isImportOpen, setIsImportOpen] = useState(false);
const [isQrOpen, setIsQrOpen] = useState(false);
const emptyScreen = !(isCreateOpen || isImportOpen || isQrOpen) && accounts && (Object.keys(accounts).length === 0);
const emptyScreen = !(isCreateOpen || isImportOpen || isQrOpen) && !hasAccounts;

const _toggleCreate = (): void => setIsCreateOpen(!isCreateOpen);
const _toggleImport = (): void => setIsImportOpen(!isImportOpen);
Expand Down Expand Up @@ -105,7 +104,7 @@ function Overview ({ accounts, onStatusChange, t }: Props): React.ReactElement<P
onStatusChange={onStatusChange}
/>
)}
{accounts && Object.keys(accounts).map((address): React.ReactNode => (
{allAccounts.map((address): React.ReactNode => (
<Account
address={address}
key={address}
Expand All @@ -115,8 +114,4 @@ function Overview ({ accounts, onStatusChange, t }: Props): React.ReactElement<P
);
}

export default withMulti(
Overview,
translate,
withObservable(accountObservable.subject, { propName: 'accounts' })
);
export default translate(Overview);
Loading

0 comments on commit d987787

Please sign in to comment.