From 6943ad8a8a4e3ef64c08a02cb26e35a02beae4f4 Mon Sep 17 00:00:00 2001 From: Randolph <840094513@qq.com> Date: Tue, 12 Jul 2022 21:08:17 +0800 Subject: [PATCH 1/2] feat: change nextid page display --- .../InjectedComponents/ProfileTabContent.tsx | 9 +++++++-- .../src/plugins/Avatar/hooks/usePersonaNFTAvatar.ts | 2 +- .../src/plugins/NextID/components/NextIdPage.tsx | 12 ++++++++++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/packages/mask/src/components/InjectedComponents/ProfileTabContent.tsx b/packages/mask/src/components/InjectedComponents/ProfileTabContent.tsx index 361db94198cc..cfeabb623ffb 100644 --- a/packages/mask/src/components/InjectedComponents/ProfileTabContent.tsx +++ b/packages/mask/src/components/InjectedComponents/ProfileTabContent.tsx @@ -76,6 +76,10 @@ export function ProfileTabContent(props: ProfileTabContentProps) { ? currentConnectedPersona?.identifier?.publicKeyAsHex : currentPersonaBinding?.persona + const isCurrentConnectedPersonaBind = personaList.some( + (persona) => persona.persona === currentConnectedPersona?.identifier?.publicKeyAsHex.toLowerCase(), + ) + const { value: personaProof, retry: retryProof } = useAsyncRetry(async () => { if (!personaPublicKey) return return NextIDProof.queryExistedBindingByPersona(personaPublicKey) @@ -141,7 +145,8 @@ export function ProfileTabContent(props: ProfileTabContentProps) { const selectedTabId = selectedTab ?? first(tabs)?.id const componentTabId = - isTwitter(activatedSocialNetworkUI) && ((isOwn && addressList?.length === 0) || isWeb3ProfileDisable) + isTwitter(activatedSocialNetworkUI) && + ((isOwn && addressList?.length === 0) || isWeb3ProfileDisable || (isOwn && !isCurrentConnectedPersonaBind)) ? displayPlugins?.find((tab) => tab?.pluginID === PluginId.NextID)?.ID : selectedTabId @@ -189,7 +194,7 @@ export function ProfileTabContent(props: ProfileTabContentProps) { }) }, [identity.identifier?.userId]) - // console.log({ identity, socialAddressList, addressList, wallets }) + console.log({ identity, socialAddressList, addressList, wallets, currentConnectedPersona }) if (hidden) return null diff --git a/packages/mask/src/plugins/Avatar/hooks/usePersonaNFTAvatar.ts b/packages/mask/src/plugins/Avatar/hooks/usePersonaNFTAvatar.ts index fa34402cb68d..e6f10cf6cecb 100644 --- a/packages/mask/src/plugins/Avatar/hooks/usePersonaNFTAvatar.ts +++ b/packages/mask/src/plugins/Avatar/hooks/usePersonaNFTAvatar.ts @@ -10,7 +10,7 @@ import LRU from 'lru-cache' const cache = new LRU>({ max: 500, - maxAge: 60 * 1000, + ttl: 60 * 1000, }) type GetNFTAvatar = ( diff --git a/packages/mask/src/plugins/NextID/components/NextIdPage.tsx b/packages/mask/src/plugins/NextID/components/NextIdPage.tsx index 9ce8a11f2529..8714ed63374d 100644 --- a/packages/mask/src/plugins/NextID/components/NextIdPage.tsx +++ b/packages/mask/src/plugins/NextID/components/NextIdPage.tsx @@ -106,8 +106,12 @@ const useStyles = makeStyles()((theme) => ({ }, button: { borderRadius: '99px', - backgroundColor: theme.palette.maskColor.dark, + backgroundColor: '#07101b', color: '#fff', + ':hover': { + color: 'fff', + backgroundColor: '#07101b', + }, }, })) @@ -131,7 +135,11 @@ export function NextIdPage({ persona }: NextIdPageProps) { const personaActionButton = useMemo(() => { if (!personaConnectStatus.action) return null const button = personaConnectStatus.hasPersona ? t.connect_persona() : t.create_persona() - return + return ( + + ) }, [personaConnectStatus, t]) const { value: currentPersona, loading: loadingPersona } = useAsyncRetry(async () => { From e445a597cac0f947b10f81522d0323afcea79cb3 Mon Sep 17 00:00:00 2001 From: Randolph <840094513@qq.com> Date: Tue, 12 Jul 2022 21:14:54 +0800 Subject: [PATCH 2/2] feat: change web3 tabs display --- .../InjectedComponents/ProfileTabContent.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/mask/src/components/InjectedComponents/ProfileTabContent.tsx b/packages/mask/src/components/InjectedComponents/ProfileTabContent.tsx index cfeabb623ffb..6a230558e4b8 100644 --- a/packages/mask/src/components/InjectedComponents/ProfileTabContent.tsx +++ b/packages/mask/src/components/InjectedComponents/ProfileTabContent.tsx @@ -144,11 +144,12 @@ export function ProfileTabContent(props: ProfileTabContentProps) { })) const selectedTabId = selectedTab ?? first(tabs)?.id - const componentTabId = + const showNextID = isTwitter(activatedSocialNetworkUI) && ((isOwn && addressList?.length === 0) || isWeb3ProfileDisable || (isOwn && !isCurrentConnectedPersonaBind)) - ? displayPlugins?.find((tab) => tab?.pluginID === PluginId.NextID)?.ID - : selectedTabId + const componentTabId = showNextID + ? displayPlugins?.find((tab) => tab?.pluginID === PluginId.NextID)?.ID + : selectedTabId const handleOpenDialog = () => { CrossIsolationMessages.events.requestWeb3ProfileDialog.sendToAll({ @@ -194,8 +195,6 @@ export function ProfileTabContent(props: ProfileTabContentProps) { }) }, [identity.identifier?.userId]) - console.log({ identity, socialAddressList, addressList, wallets, currentConnectedPersona }) - if (hidden) return null if (!identity.identifier?.userId || loadingSocialAddressList || loadingPersonaList) @@ -214,7 +213,7 @@ export function ProfileTabContent(props: ProfileTabContentProps) { return (
- {tabs.length && ( + {tabs.length && !showNextID && ( tabs={tabs} selectedId={selectedTabId}