From 5a8878c9e31ac6ae219cd2e7227f1a79ebad5f18 Mon Sep 17 00:00:00 2001 From: Thunnini Date: Wed, 21 Dec 2022 23:10:18 +0900 Subject: [PATCH] Show invite link only to registered twitter user --- components/twitter-profile/index.tsx | 93 ++++++++++++++-------------- pages/verification/index.tsx | 10 +++ 2 files changed, 58 insertions(+), 45 deletions(-) diff --git a/components/twitter-profile/index.tsx b/components/twitter-profile/index.tsx index 0161fa5..00d14bf 100644 --- a/components/twitter-profile/index.tsx +++ b/components/twitter-profile/index.tsx @@ -8,16 +8,17 @@ import ICNSIcon from "../../public/images/svg/icns-logo.svg"; interface Props { isOwner?: boolean; + registeredTwitterName?: string; twitterProfileInformation?: TwitterAuthInfoResponse | null; } export const TwitterProfile: FunctionComponent = (props) => { - const { isOwner, twitterProfileInformation } = props; + const { isOwner, registeredTwitterName, twitterProfileInformation } = props; const [isCopied, setIsCopied] = useState(false); const onClickInviteLink = async () => { await navigator.clipboard.writeText( - `https://app.icns.xyz?referral=${twitterProfileInformation?.username}`, + `https://app.icns.xyz?referral=${registeredTwitterName}`, ); setIsCopied(true); @@ -29,49 +30,51 @@ export const TwitterProfile: FunctionComponent = (props) => { return ( - {isCopied ? ( - - copied - - - - - ) : ( - - copy invite link - - - - - - )} + {registeredTwitterName ? ( + isCopied ? ( + + copied + + + + + ) : ( + + copy invite link + + + + + + ) + ) : null}