Skip to content

Commit

Permalink
Display sub identities (#2107)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacogr committed Jan 12, 2020
1 parent 762c4dc commit e8dd9ab
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 6 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"packages/*"
],
"resolutions": {
"@polkadot/api": "^0.100.0-beta.27",
"@polkadot/api-contract": "^0.100.0-beta.27",
"@polkadot/api": "^0.100.0-beta.28",
"@polkadot/api-contract": "^0.100.0-beta.28",
"@polkadot/keyring": "^1.8.1",
"@polkadot/types": "^0.100.0-beta.27",
"@polkadot/types": "^0.100.0-beta.28",
"@polkadot/util": "^1.8.1",
"@polkadot/util-crypto": "^1.8.1",
"babel-core": "^7.0.0-bridge.0",
Expand Down
16 changes: 16 additions & 0 deletions packages/app-accounts/src/modals/Identity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,15 @@ function Identity ({ address, className, onClose }: Props): React.ReactElement<P
const [hasLegal, setHasLegal] = useState(false);
// const [hasPgp, setHasPgp] = useState(false);
const [hasRiot, setHasRiot] = useState(false);
const [hasTwitter, setHasTwitter] = useState(false);
const [hasWeb, setHasWeb] = useState(false);
const [valDisplay, setValDisplay] = useState(getAddressMeta(address).name || '');
const [valEmail, setValEmail] = useState('');
// const [{ errImg, valImg }, setValImg] = useState<{ errImg: boolean; valImg: string }>({ errImg: true, valImg: '' });
const [valLegal, setValLegal] = useState('');
// const [{ errPgp, valPgp }, setValPgp] = useState<{ errPgp: boolean; valPgp: string }>({ errPgp: true, valPgp: '' });
const [valRiot, setValRiot] = useState('');
const [valTwitter, setValTwitter] = useState('');
const [valWeb, setValWeb] = useState('');

useEffect((): void => {
Expand All @@ -80,6 +82,7 @@ function Identity ({ address, className, onClose }: Props): React.ReactElement<P
setData(info.email, setHasEmail, setValEmail);
setData(info.legal, setHasLegal, setValLegal);
setData(info.riot, setHasRiot, setValRiot);
setData(info.twitter, setHasTwitter, setValTwitter);
setData(info.web, setHasWeb, setValWeb);
}
}, [identityOpt]);
Expand All @@ -90,6 +93,7 @@ function Identity ({ address, className, onClose }: Props): React.ReactElement<P
email: { [hasEmail ? 'raw' : 'none']: hasEmail ? valEmail : null },
legal: { [hasLegal ? 'raw' : 'none']: hasLegal ? valLegal : null },
riot: { [hasRiot ? 'raw' : 'none']: hasRiot ? valRiot : null },
twitter: { [hasTwitter ? 'raw' : 'none']: hasTwitter ? valTwitter : null },
web: { [hasWeb ? 'raw' : 'none']: hasWeb ? valWeb : null }
// image: { [hasImg ? 'sha256' : 'none']: hasImg ? valImg : null },
// pgpFingerprint: hasPgp ? valPgp : null
Expand Down Expand Up @@ -151,6 +155,18 @@ function Identity ({ address, className, onClose }: Props): React.ReactElement<P
value={hasWeb ? valWeb : '<none>'}
/>
</WrapToggle>
<WrapToggle
onChange={setHasTwitter}
value={hasTwitter}
>
<Input
help={t('The twitter name for this identity.')}
isDisabled={!hasTwitter}
label={t('twitter')}
onChange={setValTwitter}
value={hasTwitter ? valTwitter : '<none>'}
/>
</WrapToggle>
<WrapToggle
onChange={setHasRiot}
value={hasRiot}
Expand Down
2 changes: 1 addition & 1 deletion packages/app-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.7.7",
"@polkadot/api-contract": "^0.100.0-beta.27"
"@polkadot/api-contract": "^0.100.0-beta.28"
}
}
2 changes: 1 addition & 1 deletion packages/react-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"homepage": "https://github.com/polkadot-js/ui/tree/master/packages/ui-reactive#readme",
"dependencies": {
"@babel/runtime": "^7.7.6",
"@polkadot/api": "^0.100.0-beta.27",
"@polkadot/api": "^0.100.0-beta.28",
"@polkadot/extension-dapp": "^0.15.0-beta.0",
"edgeware-node-types": "^1.0.10",
"rxjs-compat": "^6.5.3"
Expand Down
15 changes: 14 additions & 1 deletion packages/react-components/src/AccountName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { Option } from '@polkadot/types';

import { useTranslation } from './translate';
import { getAddressName } from './util';
import AddressMini from './AddressMini';
import Badge from './Badge';
import Button from './Button';
import Dropdown from './Dropdown';
Expand Down Expand Up @@ -135,6 +136,12 @@ function AccountName ({ children, className, defaultName, label, onClick, overri
<td>{t('display')}</td>
<td>{identity.display}</td>
</tr>
{identity.parent && (
<tr>
<td>{t('parent')}</td>
<td><AddressMini value={identity.parent} /></td>
</tr>
)}
{identity.legal && (
<tr>
<td>{t('legal')}</td>
Expand All @@ -153,6 +160,12 @@ function AccountName ({ children, className, defaultName, label, onClick, overri
<td>{identity.web}</td>
</tr>
)}
{identity.twitter && (
<tr>
<td>{t('twitter')}</td>
<td>{identity.twitter}</td>
</tr>
)}
{identity.riot && (
<tr>
<td>{t('riot')}</td>
Expand All @@ -172,7 +185,7 @@ function AccountName ({ children, className, defaultName, label, onClick, overri
<div className='via-identity'>
<Badge
hover={hover}
info={<Icon name={isGood ? 'check' : 'minus'} />}
info={<Icon name={identity.parent ? 'caret square up outline' : (isGood ? 'check' : 'minus')} />}
isInline
isSmall
isTooltip
Expand Down

0 comments on commit e8dd9ab

Please sign in to comment.