From 07953c704215bbf6b99620c688aed4f73dbd9626 Mon Sep 17 00:00:00 2001 From: Thibaut Sardan <33178835+Tbaut@users.noreply.github.com> Date: Tue, 11 Aug 2020 16:41:37 +0200 Subject: [PATCH] add button to clear identity (#3388) --- .../src/Accounts/modals/IdentityMain.tsx | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/page-accounts/src/Accounts/modals/IdentityMain.tsx b/packages/page-accounts/src/Accounts/modals/IdentityMain.tsx index d6d51f7025..a0357c4807 100644 --- a/packages/page-accounts/src/Accounts/modals/IdentityMain.tsx +++ b/packages/page-accounts/src/Accounts/modals/IdentityMain.tsx @@ -94,6 +94,7 @@ function IdentityMain ({ address, className = '', onClose }: Props): React.React const [valRiot, setValRiot] = useState(''); const [valTwitter, setValTwitter] = useState(''); const [valWeb, setValWeb] = useState(''); + const [gotPreviousIdentity, setGotPreviousIdentity] = useState(false); useEffect((): void => { if (identityOpt && identityOpt.isSome) { @@ -105,6 +106,16 @@ function IdentityMain ({ address, className = '', onClose }: Props): React.React setData(info.riot, setHasRiot, setValRiot); setData(info.twitter, setHasTwitter, setValTwitter); setData(info.web, setHasWeb, setValWeb); + + [info.display, info.email, info.legal, info.riot, info.twitter, info.web].some((info: Data) => { + if (info.isRaw) { + setGotPreviousIdentity(true); + + return true; + } else { + return false; + } + }); } }, [identityOpt]); @@ -230,6 +241,15 @@ function IdentityMain ({ address, className = '', onClose }: Props): React.React + ('Clear Identity')} + onStart={onClose} + params={[]} + tx='identity.clearIdentity' + />