From c254a432d083411a1be31c06494986a23b98a859 Mon Sep 17 00:00:00 2001 From: unclebill Date: Sun, 12 Jun 2022 16:32:36 +0800 Subject: [PATCH 1/3] fix(rss3): show donation/footprints for not just .rss3 address --- packages/plugins/RSS3/src/SNSAdaptor/TabCard.tsx | 6 ++---- packages/plugins/RSS3/src/SNSAdaptor/index.tsx | 6 +----- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/packages/plugins/RSS3/src/SNSAdaptor/TabCard.tsx b/packages/plugins/RSS3/src/SNSAdaptor/TabCard.tsx index f255d98b8fde..18f441d50e67 100644 --- a/packages/plugins/RSS3/src/SNSAdaptor/TabCard.tsx +++ b/packages/plugins/RSS3/src/SNSAdaptor/TabCard.tsx @@ -1,6 +1,6 @@ import { AddressViewer } from '@masknet/shared' import { EMPTY_LIST } from '@masknet/shared-base' -import { SocialAddressType, NetworkPluginID, SocialAddress } from '@masknet/web3-shared-base' +import { NetworkPluginID, SocialAddress } from '@masknet/web3-shared-base' import { Box, Typography } from '@mui/material' import { useI18N } from '../locales' import { useDonations, useFootprints } from './hooks' @@ -18,9 +18,7 @@ export interface TabCardProps { export function TabCard({ type, socialAddressList }: TabCardProps) { const t = useI18N() - const addressName = socialAddressList?.find( - (x) => x.type === SocialAddressType.RSS3 && x.networkSupporterPluginID === NetworkPluginID.PLUGIN_EVM, - ) + const addressName = socialAddressList?.find((x) => x.networkSupporterPluginID === NetworkPluginID.PLUGIN_EVM) const userAddress = addressName?.address || '' const { value: donations = EMPTY_LIST, loading: loadingDonations } = useDonations(userAddress) const { value: footprints = EMPTY_LIST, loading: loadingFootprints } = useFootprints(userAddress) diff --git a/packages/plugins/RSS3/src/SNSAdaptor/index.tsx b/packages/plugins/RSS3/src/SNSAdaptor/index.tsx index d91346304fe6..c02e39931a94 100644 --- a/packages/plugins/RSS3/src/SNSAdaptor/index.tsx +++ b/packages/plugins/RSS3/src/SNSAdaptor/index.tsx @@ -11,11 +11,7 @@ function sorter(a: SocialAddress, z: SocialAddress>) { - return ( - addressNames?.some( - (x) => x.type === SocialAddressType.RSS3 && x.networkSupporterPluginID === NetworkPluginID.PLUGIN_EVM, - ) ?? false - ) + return addressNames?.some((x) => x.networkSupporterPluginID === NetworkPluginID.PLUGIN_EVM) ?? false } const sns: Plugin.SNSAdaptor.Definition = { From 10a10f369af90dd19c00a645ccd92f463392fe24 Mon Sep 17 00:00:00 2001 From: unclebill Date: Sun, 12 Jun 2022 16:52:30 +0800 Subject: [PATCH 2/3] fixup! fix(rss3): show donation/footprints for not just .rss3 address --- packages/plugins/RSS3/src/SNSAdaptor/TabCard.tsx | 6 ++++-- packages/plugins/RSS3/src/SNSAdaptor/index.tsx | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/plugins/RSS3/src/SNSAdaptor/TabCard.tsx b/packages/plugins/RSS3/src/SNSAdaptor/TabCard.tsx index 18f441d50e67..648768ed55e4 100644 --- a/packages/plugins/RSS3/src/SNSAdaptor/TabCard.tsx +++ b/packages/plugins/RSS3/src/SNSAdaptor/TabCard.tsx @@ -1,6 +1,6 @@ import { AddressViewer } from '@masknet/shared' import { EMPTY_LIST } from '@masknet/shared-base' -import { NetworkPluginID, SocialAddress } from '@masknet/web3-shared-base' +import { NetworkPluginID, SocialAddress, SocialAddressType } from '@masknet/web3-shared-base' import { Box, Typography } from '@mui/material' import { useI18N } from '../locales' import { useDonations, useFootprints } from './hooks' @@ -18,7 +18,9 @@ export interface TabCardProps { export function TabCard({ type, socialAddressList }: TabCardProps) { const t = useI18N() - const addressName = socialAddressList?.find((x) => x.networkSupporterPluginID === NetworkPluginID.PLUGIN_EVM) + const addressName = socialAddressList?.find( + (x) => x.type === SocialAddressType.RSS3 && x.networkSupporterPluginID === NetworkPluginID.PLUGIN_EVM, + ) const userAddress = addressName?.address || '' const { value: donations = EMPTY_LIST, loading: loadingDonations } = useDonations(userAddress) const { value: footprints = EMPTY_LIST, loading: loadingFootprints } = useFootprints(userAddress) diff --git a/packages/plugins/RSS3/src/SNSAdaptor/index.tsx b/packages/plugins/RSS3/src/SNSAdaptor/index.tsx index c02e39931a94..d91346304fe6 100644 --- a/packages/plugins/RSS3/src/SNSAdaptor/index.tsx +++ b/packages/plugins/RSS3/src/SNSAdaptor/index.tsx @@ -11,7 +11,11 @@ function sorter(a: SocialAddress, z: SocialAddress>) { - return addressNames?.some((x) => x.networkSupporterPluginID === NetworkPluginID.PLUGIN_EVM) ?? false + return ( + addressNames?.some( + (x) => x.type === SocialAddressType.RSS3 && x.networkSupporterPluginID === NetworkPluginID.PLUGIN_EVM, + ) ?? false + ) } const sns: Plugin.SNSAdaptor.Definition = { From c78060403b6f8d71b9273c34378a0e69ea9c9923 Mon Sep 17 00:00:00 2001 From: unclebill Date: Sun, 12 Jun 2022 22:53:17 +0800 Subject: [PATCH 3/3] fix: useSocialAddressListAll --- packages/plugin-infra/src/web3/useSocialAddressListAll.ts | 2 +- packages/plugins/RSS3/src/SNSAdaptor/TabCard.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/plugin-infra/src/web3/useSocialAddressListAll.ts b/packages/plugin-infra/src/web3/useSocialAddressListAll.ts index bc12905b8b3b..bbe342eaf328 100644 --- a/packages/plugin-infra/src/web3/useSocialAddressListAll.ts +++ b/packages/plugin-infra/src/web3/useSocialAddressListAll.ts @@ -23,5 +23,5 @@ export function useSocialAddressListAll( ) const listOfAddress = allSettled.flatMap((x) => (x.status === 'fulfilled' ? x.value : [])) return sorter && listOfAddress.length ? listOfAddress.sort(sorter) : listOfAddress - }, [identity?.identifier?.userId, sorter, EVM_IdentityService?.lookup, SolanaIdentityService?.lookup]) + }, [identity, sorter, EVM_IdentityService?.lookup, SolanaIdentityService?.lookup]) } diff --git a/packages/plugins/RSS3/src/SNSAdaptor/TabCard.tsx b/packages/plugins/RSS3/src/SNSAdaptor/TabCard.tsx index 648768ed55e4..f255d98b8fde 100644 --- a/packages/plugins/RSS3/src/SNSAdaptor/TabCard.tsx +++ b/packages/plugins/RSS3/src/SNSAdaptor/TabCard.tsx @@ -1,6 +1,6 @@ import { AddressViewer } from '@masknet/shared' import { EMPTY_LIST } from '@masknet/shared-base' -import { NetworkPluginID, SocialAddress, SocialAddressType } from '@masknet/web3-shared-base' +import { SocialAddressType, NetworkPluginID, SocialAddress } from '@masknet/web3-shared-base' import { Box, Typography } from '@mui/material' import { useI18N } from '../locales' import { useDonations, useFootprints } from './hooks'