diff --git a/packages/react-params/src/Param/IdentityInfo.tsx b/packages/react-params/src/Param/IdentityInfo.tsx deleted file mode 100644 index 145a4cff99..0000000000 --- a/packages/react-params/src/Param/IdentityInfo.tsx +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright 2017-2020 @polkadot/react-components authors & contributors -// This software may be modified and distributed under the terms -// of the Apache-2.0 license. See the LICENSE file for details. - -import { Props } from '../types'; - -import React, { useEffect, useState } from 'react'; -import styled from 'styled-components'; -import { Input, Toggle } from '@polkadot/react-components'; -import { isHex } from '@polkadot/util'; - -import Bare from './Bare'; -import Struct from './Struct'; - -import { useTranslation } from '../translate'; - -interface WrapProps { - children: React.ReactNode; - onChange: (isChecked: boolean) => void; - value: boolean; -} - -function WrapToggle ({ children, onChange, value }: WrapProps): React.ReactElement { - const { t } = useTranslation(); - - return ( -
- {children} - -
- ); -} - -function IdentityInfo (props: Props): React.ReactElement { - const { className, isDisabled, onChange, style } = props; - - const { t } = useTranslation(); - const [hasDisplay, setHasDisplay] = useState(true); - const [hasEmail, setHasEmail] = useState(false); - const [hasImg, setHasImg] = useState(false); - const [hasLegal, setHasLegal] = useState(false); - const [hasPgp, setHasPgp] = useState(false); - const [hasRiot, setHasRiot] = useState(false); - const [hasWeb, setHasWeb] = useState(false); - const [valDisplay, setValDisplay] = useState(''); - 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 [valWeb, setValWeb] = useState(''); - - useEffect((): void => { - onChange && onChange({ - value: { - display: { [hasDisplay ? 'raw' : 'none']: hasDisplay ? valDisplay : null }, - email: { [hasEmail ? 'raw' : 'none']: hasEmail ? valEmail : null }, - image: { [hasImg ? 'sha256' : 'none']: hasImg ? valImg : null }, - legal: { [hasLegal ? 'raw' : 'none']: hasLegal ? valLegal : null }, - riot: { [hasRiot ? 'raw' : 'none']: hasRiot ? valRiot : null }, - web: { [hasWeb ? 'raw' : 'none']: hasWeb ? valWeb : null }, - pgpFingerprint: hasPgp ? valPgp : null - }, - isValid: !((hasImg && errImg) || (hasPgp && errPgp)) - }); - }, [errImg, errPgp, hasDisplay, hasEmail, hasImg, hasLegal, hasPgp, hasRiot, hasWeb, valDisplay, valEmail, valImg, valLegal, valPgp, valRiot, valWeb]); - - if (isDisabled) { - return ( - - ); - } - - const _onChangeImg = (valImg: string): void => setValImg({ valImg, errImg: !isHex(valImg, 256) }); - const _onChangePgp = (valPgp: string): void => setValPgp({ valPgp, errPgp: !isHex(valPgp, 160) }); - - return ( - - - '} - /> - - - '} - /> - - - '} - /> - - - '} - /> - - - '} - /> - - - '} - /> - - - '} - /> - - - ); -} - -export default styled(IdentityInfo)` - .toggle-Wrap { - position: relative; - - .toggle-Toggle { - position: absolute; - right: 3.5rem; - top: 0.5rem; - } - } -`; diff --git a/packages/react-params/src/Param/findComponent.ts b/packages/react-params/src/Param/findComponent.ts index 8f6d91445e..d7bf19620e 100644 --- a/packages/react-params/src/Param/findComponent.ts +++ b/packages/react-params/src/Param/findComponent.ts @@ -19,7 +19,6 @@ import DispatchError from './DispatchError'; import Enum from './Enum'; import Hash256 from './Hash256'; import Hash512 from './Hash512'; -import IdentityInfo from './IdentityInfo'; import KeyValue from './KeyValue'; import KeyValueArray from './KeyValueArray'; import Moment from './Moment'; @@ -52,7 +51,6 @@ const components: ComponentMap = ([ { c: Enum, t: ['Enum'] }, { c: Hash256, t: ['BlockHash', 'CodeHash', 'Hash', 'H256', 'SeedOf'] }, { c: Hash512, t: ['H512', 'Signature'] }, - { c: IdentityInfo, t: ['IdentityInfo'] }, { c: KeyValue, t: ['KeyValue'] }, { c: KeyValueArray, t: ['Vec'] }, { c: Moment, t: ['Moment', 'MomentOf'] },