From befba45da966fab171be244de339059ce8244d45 Mon Sep 17 00:00:00 2001 From: guanbinrui Date: Fri, 24 Dec 2021 10:18:55 +0800 Subject: [PATCH 1/7] fix: DAO tab --- .../src/plugins/Profile/SNSAdaptor/EnhancedProfile.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/mask/src/plugins/Profile/SNSAdaptor/EnhancedProfile.tsx b/packages/mask/src/plugins/Profile/SNSAdaptor/EnhancedProfile.tsx index 8af942239e14..67b42aa2c12e 100644 --- a/packages/mask/src/plugins/Profile/SNSAdaptor/EnhancedProfile.tsx +++ b/packages/mask/src/plugins/Profile/SNSAdaptor/EnhancedProfile.tsx @@ -41,13 +41,11 @@ export function EnhancedProfilePage(props: EnhancedProfilePageProps) { const { t } = useI18N() const classes = useStylesExtends(useStyles(), props) - //#region identity const identity = useCurrentVisitingIdentity() const { value: addressNames, loading: loadingAddressNames } = useAddressNames(identity) - //#endregion + const { value: daoPayload, loading: loadingDAO } = useDao(identity.identifier) const [hidden, setHidden] = useState(true) - const { value: daoPayload } = useDao(identity.identifier) const [currentTag, setCurrentTag] = useState(PageTags.NFTTag) useLocationChange(() => { @@ -112,7 +110,7 @@ export function EnhancedProfilePage(props: EnhancedProfilePageProps) { if (hidden) return null - if (loadingAddressNames) + if (loadingAddressNames || loadingDAO) return (
) - if (!addressName) + if (!addressName && !daoPayload) return (
Date: Thu, 23 Dec 2021 00:34:03 +0800 Subject: [PATCH 2/7] fix: rss3 links --- packages/mask/src/plugins/Profile/SNSAdaptor/DonationsPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mask/src/plugins/Profile/SNSAdaptor/DonationsPage.tsx b/packages/mask/src/plugins/Profile/SNSAdaptor/DonationsPage.tsx index 2393ada10c2e..a0f1c057f706 100644 --- a/packages/mask/src/plugins/Profile/SNSAdaptor/DonationsPage.tsx +++ b/packages/mask/src/plugins/Profile/SNSAdaptor/DonationsPage.tsx @@ -14,7 +14,7 @@ const getDonationLink = (address: string, donation: GeneralAssetWithTags) => { platform, identity, id, - type, + type: type.replaceAll('-', '.'), }) } From 0eb6343680d2e8b1d53910508dbbbdb1394390e3 Mon Sep 17 00:00:00 2001 From: guanbinrui Date: Fri, 24 Dec 2021 10:43:51 +0800 Subject: [PATCH 3/7] fix: the wallet discovery rules --- packages/mask/shared-ui/locales/en-US.json | 10 +++++----- packages/mask/shared-ui/locales/qya-AA.json | 2 +- packages/mask/shared-ui/locales/zh-CN.json | 10 +++++----- .../src/plugins/Profile/SNSAdaptor/EnhancedProfile.tsx | 8 +++++--- .../Profile/SNSAdaptor/components/AddressViewer.tsx | 2 +- packages/mask/src/plugins/Wallet/services/domain.ts | 2 +- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/packages/mask/shared-ui/locales/en-US.json b/packages/mask/shared-ui/locales/en-US.json index 01c040ad091b..ecbe018b8887 100644 --- a/packages/mask/shared-ui/locales/en-US.json +++ b/packages/mask/shared-ui/locales/en-US.json @@ -1004,11 +1004,11 @@ "nft_button_add_collectible": "Add Collectible", "nft_avatar": "NFT Avatar", "plugin_profile_no_wallets": "Connect your wallet here.
This section will be shown to your encrypted friends.
The display content includes digital art, donations, badges
and other public information on chain.", - "plugin_profile_binding_rules_title": "The NFT gallary will show NFTs as below rules:", - "plugin_profile_binding_rule1": "Twitter nickname is ENS.", - "plugin_profile_binding_rule2": "Twitter bio contains ENS(e.g. vitalik.eth) or valid address.", - "plugin_profile_binding_rule3": "Twitter ID + {{suffix}} is ENS.", - "plugin_profile_binding_rule4": "Address used to sign the avatar.", + "plugin_profile_binding_rules_title": "The wallet address discovery rules:", + "plugin_profile_binding_rule1": "The nickname is ENS or RNS.", + "plugin_profile_binding_rule2": "The bio contains ENS, RNS or a valid address.", + "plugin_profile_binding_rule3": "The ID + suffix is ENS or RNS.", + "plugin_profile_binding_rule4": "The address used to sign the PFP NFTs.", "plugin_profile_current_display_of": "Current display of {{type}}: ", "plugin_profile_loading": "Loading...", "plugin_profile_error_no_address": "Failed to find any valid address.", diff --git a/packages/mask/shared-ui/locales/qya-AA.json b/packages/mask/shared-ui/locales/qya-AA.json index 513d60779375..ab9103f0495c 100644 --- a/packages/mask/shared-ui/locales/qya-AA.json +++ b/packages/mask/shared-ui/locales/qya-AA.json @@ -1006,7 +1006,7 @@ "plugin_profile_binding_rules_title": "crwdns10417:0crwdne10417:0", "plugin_profile_binding_rule1": "crwdns10419:0crwdne10419:0", "plugin_profile_binding_rule2": "crwdns10421:0crwdne10421:0", - "plugin_profile_binding_rule3": "crwdns10423:0{{suffix}}crwdne10423:0", + "plugin_profile_binding_rule3": "crwdns10423:0crwdne10423:0", "plugin_profile_binding_rule4": "crwdns10425:0crwdne10425:0", "plugin_profile_current_display_of": "crwdns10427:0{{type}}crwdne10427:0", "plugin_profile_loading": "crwdns10669:0crwdne10669:0", diff --git a/packages/mask/shared-ui/locales/zh-CN.json b/packages/mask/shared-ui/locales/zh-CN.json index 5966413499b0..8fabcca5564a 100644 --- a/packages/mask/shared-ui/locales/zh-CN.json +++ b/packages/mask/shared-ui/locales/zh-CN.json @@ -886,11 +886,11 @@ "nft_button_add_collectible": "添加收藏品", "nft_avatar": "NFT 头像", "plugin_profile_no_wallets": "在此连接您的钱包。
此部分将显示给您的加密朋友。
显示内容包括数字艺术、捐赠、徽章
和其他链上的公开信息。", - "plugin_profile_binding_rules_title": "Web3 按如下规则展示NFTs:", - "plugin_profile_binding_rule1": "您的Twitter 昵称为ENS。", - "plugin_profile_binding_rule2": "您的Twitter bio 包含 ENS(例如,vitalik.eth) 或有效地址。", - "plugin_profile_binding_rule3": "您的Twitter ID + {{suffix}} 是ENS。", - "plugin_profile_binding_rule4": "用于签署NFT 头像的地址。", + "plugin_profile_binding_rules_title": "Web3 按如下规则发现钱包地址:", + "plugin_profile_binding_rule1": "您的昵称为 ENS 或者 RNS。", + "plugin_profile_binding_rule2": "您的个人介绍中包含 ENS、RNS 或有效地址。", + "plugin_profile_binding_rule3": "您的 ID + 词缀是 ENS 或者 RNS。", + "plugin_profile_binding_rule4": "用于签署 NFT 头像的地址。", "plugin_profile_current_display_of": "当前显示 {{type}}: ", "plugin_vcent_last_offer_at": "最新的OFFER为" } diff --git a/packages/mask/src/plugins/Profile/SNSAdaptor/EnhancedProfile.tsx b/packages/mask/src/plugins/Profile/SNSAdaptor/EnhancedProfile.tsx index 67b42aa2c12e..067ec2b5a70a 100644 --- a/packages/mask/src/plugins/Profile/SNSAdaptor/EnhancedProfile.tsx +++ b/packages/mask/src/plugins/Profile/SNSAdaptor/EnhancedProfile.tsx @@ -142,9 +142,11 @@ export function EnhancedProfilePage(props: EnhancedProfilePageProps) {
-
- -
+ {addressName ? ( +
+ +
+ ) : null}
{content}
) diff --git a/packages/mask/src/plugins/Profile/SNSAdaptor/components/AddressViewer.tsx b/packages/mask/src/plugins/Profile/SNSAdaptor/components/AddressViewer.tsx index 80988f60870d..0d86a466c530 100644 --- a/packages/mask/src/plugins/Profile/SNSAdaptor/components/AddressViewer.tsx +++ b/packages/mask/src/plugins/Profile/SNSAdaptor/components/AddressViewer.tsx @@ -56,7 +56,7 @@ export function AddressViewer({ addressName }: AddressViewerProps) { const rulesTipMap = [ t('plugin_profile_binding_rule1'), t('plugin_profile_binding_rule2'), - t('plugin_profile_binding_rule3', { suffix: `".eth"` }), + t('plugin_profile_binding_rule3'), t('plugin_profile_binding_rule4'), ] diff --git a/packages/mask/src/plugins/Wallet/services/domain.ts b/packages/mask/src/plugins/Wallet/services/domain.ts index 3c6263f2e59a..430be1df9732 100644 --- a/packages/mask/src/plugins/Wallet/services/domain.ts +++ b/packages/mask/src/plugins/Wallet/services/domain.ts @@ -116,7 +116,7 @@ export async function getAddressNames(identity: { isValidAddress(addressRSS3) ? { type: AddressNameType.RSS3, - label: `${RSS3Id}.rss`, + label: `${RSS3Id}.rss3`, resolvedAddress: addressRSS3, } : null, From b3acf1e6d9321963be83c99a2b856908c9ab0cbe Mon Sep 17 00:00:00 2001 From: guanbinrui Date: Fri, 24 Dec 2021 11:40:46 +0800 Subject: [PATCH 4/7] fix: hide nfts tab if non-address found --- .../src/plugins/Profile/SNSAdaptor/PageTag.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/mask/src/plugins/Profile/SNSAdaptor/PageTag.tsx b/packages/mask/src/plugins/Profile/SNSAdaptor/PageTag.tsx index dcf77987e852..80a901dacd97 100644 --- a/packages/mask/src/plugins/Profile/SNSAdaptor/PageTag.tsx +++ b/packages/mask/src/plugins/Profile/SNSAdaptor/PageTag.tsx @@ -68,13 +68,15 @@ export function PageTag(props: PageTagProps) { size="medium"> {t('wallets')} - + {address ? ( + + ) : null} {hasDonations ? (
) - if (!addressName && !daoPayload) + if (!addressNFTs && !addressRSS3 && !daoPayload) return (
- +
{addressName ? (
diff --git a/packages/mask/src/plugins/Profile/SNSAdaptor/FootprintPage.tsx b/packages/mask/src/plugins/Profile/SNSAdaptor/FootprintPage.tsx index 21cf9d77e585..d72029074428 100644 --- a/packages/mask/src/plugins/Profile/SNSAdaptor/FootprintPage.tsx +++ b/packages/mask/src/plugins/Profile/SNSAdaptor/FootprintPage.tsx @@ -1,10 +1,10 @@ import urlcat from 'urlcat' import { makeStyles } from '@masknet/theme' -import { CircularProgress, Link } from '@mui/material' -import type { GeneralAssetWithTags } from '../types' +import { Link } from '@mui/material' +import type { GeneralAsset, GeneralAssetWithTags } from '../types' import { RSS3_DEFAULT_IMAGE } from '../constants' import { FootprintCard } from './components' -import { useFootprints, useRss3Profile } from './hooks' +import { useRss3Profile } from './hooks' const useStyles = makeStyles()((theme) => ({ address: { @@ -30,24 +30,15 @@ const getFootprintLink = (address: string, footprint: GeneralAssetWithTags) => { export interface FootprintPageProps { address: string + footprints?: GeneralAsset[] } export function FootprintPage(props: FootprintPageProps) { - const { address } = props + const { address, footprints = [] } = props const { classes } = useStyles() const { value: profile } = useRss3Profile(address) const username = profile?.name - const { footprints, loading } = useFootprints(address) - - if (loading) { - return ( -
- -
- ) - } - return (
{footprints.map((footprint) => ( diff --git a/packages/mask/src/plugins/Profile/SNSAdaptor/NFTPage.tsx b/packages/mask/src/plugins/Profile/SNSAdaptor/NFTPage.tsx index 03bf9848f2ae..8f5f64b7d9d1 100644 --- a/packages/mask/src/plugins/Profile/SNSAdaptor/NFTPage.tsx +++ b/packages/mask/src/plugins/Profile/SNSAdaptor/NFTPage.tsx @@ -1,7 +1,5 @@ import { getMaskColor, makeStyles, useStylesExtends } from '@masknet/theme' -import { Box, Typography } from '@mui/material' import { CollectionList } from '../../../extension/options-page/DashboardComponents/CollectibleList' -import { useI18N } from '../../../utils' const useStyles = makeStyles()((theme) => ({ root: { @@ -22,18 +20,8 @@ export interface NFTPageProps extends withClasses<'text' | 'button'> { export function NFTPage(props: NFTPageProps) { const { address } = props - const { t } = useI18N() const classes = useStylesExtends(useStyles(), props) - if (!address) - return ( -
- - {t('dashboard_no_collectible_found')} - -
- ) - return (
diff --git a/packages/mask/src/plugins/Profile/SNSAdaptor/PageTag.tsx b/packages/mask/src/plugins/Profile/SNSAdaptor/PageTag.tsx index 80a901dacd97..2cdfa68795c2 100644 --- a/packages/mask/src/plugins/Profile/SNSAdaptor/PageTag.tsx +++ b/packages/mask/src/plugins/Profile/SNSAdaptor/PageTag.tsx @@ -2,8 +2,9 @@ import classNames from 'classnames' import { makeStyles } from '@masknet/theme' import { Button } from '@mui/material' import { useI18N } from '../../../utils' -import { PageTags } from '../types' -import { useDonations, useFootprints, Dao_Payload } from './hooks' +import { GeneralAsset, PageTags } from '../types' +import type { AddressName } from '@masknet/web3-shared-evm' +import type { Dao_Payload } from './hooks' const useStyles = makeStyles()((theme) => ({ root: { @@ -43,21 +44,21 @@ const useStyles = makeStyles()((theme) => ({ })) export interface PageTagProps { - tag: PageTags - address: string - daoPayload: Dao_Payload | undefined + tag?: PageTags + daoPayload?: Dao_Payload + donations?: GeneralAsset[] + footprints?: GeneralAsset[] + addressNFTs?: AddressName + addressRSS3?: AddressName onChange: (tag: PageTags) => void } export function PageTag(props: PageTagProps) { - const { classes } = useStyles() - const { onChange, tag, address, daoPayload } = props + const { tag, daoPayload, donations, footprints, addressNFTs, addressRSS3, onChange } = props const { t } = useI18N() + const { classes } = useStyles() - const { donations } = useDonations(address) - const { footprints } = useFootprints(address) - const hasDonations = donations.length > 0 - const hasFootprints = footprints.length > 0 + if (!tag) return null return (
@@ -68,7 +69,7 @@ export function PageTag(props: PageTagProps) { size="medium"> {t('wallets')} - {address ? ( + {addressNFTs ? (