From 0d188010f76295a8ace3bd7e4bf3cd8c9d5ce8f5 Mon Sep 17 00:00:00 2001 From: guanbinrui Date: Wed, 27 Jul 2022 00:29:59 +0800 Subject: [PATCH] Revert "feat: web3 profile feed (#6806)" This reverts commit d9344576d9cea4893e381a15b2926bcb08ca2968. --- .i18n-codegen.json | 11 - cspell.json | 1 - .../Personas/components/PersonaLine/index.tsx | 6 +- packages/icons/brands/EtherScan.svg | 1 - packages/icons/brands/PolygonScan.svg | 1 - packages/icons/general/ArrowDrop.svg | 2 +- packages/icons/general/Connect.svg | 16 -- packages/icons/general/DoubleArrowUp.svg | 1 - packages/icons/general/Edit2.svg | 5 +- packages/icons/general/Identity.svg | 7 - .../icons/general/NextIdPersonaVerified.svg | 3 +- packages/icons/general/RSS3.svg | 6 - packages/icons/general/Selected.light.svg | 2 +- packages/icons/general/Selected.tsx | 27 -- packages/icons/plugins/WalletUnderTabs.svg | 4 - packages/mask/shared-ui/locales/en-US.json | 1 - .../InjectedComponents/ProfileTabContent.tsx | 262 ++++------------- .../CollectibleList/CollectibleCard.tsx | 10 +- .../CollectibleList/index.tsx | 66 ++++- .../Personas/components/PersonaHeader/UI.tsx | 11 +- .../pages/Wallet/SwitchWallet/WalletItem.tsx | 4 +- .../Wallet/components/WalletHeader/UI.tsx | 2 - .../Wallet/components/WalletInfo/index.tsx | 3 +- .../Collectible/SNSAdaptor/NFTPage.tsx | 88 +++++- .../plugins/Collectible/SNSAdaptor/index.tsx | 3 + .../plugins/NextID/components/NextIdPage.tsx | 70 ++--- .../src/plugins/NextID/locales/en-US.json | 5 +- .../plugins/Pets/SNSAdaptor/PetSetDialog.tsx | 4 +- .../SNSAdaptor/trending/PriceChanged.tsx | 4 +- .../SNSAdaptor/trending/TrendingViewDeck.tsx | 2 +- .../PluginProviderRender.tsx | 2 +- .../SNSAdaptor/TransactionSnackbar/index.tsx | 2 +- .../plugins/Web3Feed/SNSAdaptor/FeedCard.tsx | 223 --------------- .../Web3Feed/SNSAdaptor/ReversedAddress.tsx | 26 -- .../plugins/Web3Feed/SNSAdaptor/StatusBox.tsx | 39 --- .../Web3Feed/SNSAdaptor/Web3FeedPage.tsx | 50 ---- .../src/plugins/Web3Feed/SNSAdaptor/index.tsx | 23 -- .../mask/src/plugins/Web3Feed/Worker/index.ts | 8 - packages/mask/src/plugins/Web3Feed/base.ts | 26 -- .../mask/src/plugins/Web3Feed/constants.ts | 10 - packages/mask/src/plugins/Web3Feed/index.ts | 16 -- .../src/plugins/Web3Feed/locales/en-US.json | 8 - .../src/plugins/Web3Feed/locales/index.ts | 6 - .../src/plugins/Web3Feed/locales/ja-JP.json | 1 - .../src/plugins/Web3Feed/locales/ko-KR.json | 1 - .../src/plugins/Web3Feed/locales/languages.ts | 34 --- .../src/plugins/Web3Feed/locales/zh-CN.json | 1 - .../src/plugins/Web3Feed/locales/zh-TW.json | 1 - packages/mask/src/tsconfig.json | 7 - packages/plugin-infra/src/types.ts | 5 +- .../src/SNSAdaptor/components/Common.tsx | 2 +- .../SNSAdaptor/components/SecurityPanel.tsx | 3 +- .../plugins/RSS3/src/SNSAdaptor/TabCard.tsx | 134 +++++++-- .../SNSAdaptor/components/DonationCard.tsx | 119 ++++---- .../SNSAdaptor/components/FootprintCard.tsx | 93 +++---- .../src/SNSAdaptor/components/StatusBox.tsx | 5 +- .../SNSAdaptor/hooks/useCollectionFilter.ts | 14 +- .../RSS3/src/SNSAdaptor/hooks/useDonations.ts | 10 +- .../src/SNSAdaptor/hooks/useFootprints.ts | 9 +- .../plugins/RSS3/src/SNSAdaptor/index.tsx | 26 +- .../src/SNSAdaptor/pages/DonationsPage.tsx | 67 +++-- .../src/SNSAdaptor/pages/FootprintPage.tsx | 80 +++--- packages/plugins/RSS3/src/locales/en-US.json | 6 +- .../SNSAdaptor/components/CollectionList.tsx | 6 +- .../SNSAdaptor/components/ImageManagement.tsx | 2 +- .../SNSAdaptor/components/WalletAssets.tsx | 87 +----- .../Web3Profile/src/SNSAdaptor/index.tsx | 4 +- .../Web3Profile/src/SNSAdaptor/types.ts | 2 - .../Web3Profile/src/SNSAdaptor/utils.ts | 2 - .../Web3Profile/src/locales/en-US.json | 3 +- .../src/UI/components/AssetPlayer/index.tsx | 7 +- .../CollectionDetailCard/assets/etherscan.png | Bin 4088 -> 0 bytes .../components/CollectionDetailCard/index.tsx | 263 ------------------ .../UI/components/ConcealableTabs/index.tsx | 212 ++++++++++++++ .../src/UI/components/NFTCard/index.tsx | 18 +- .../NFTCardStyledAssetPlayer/index.tsx | 13 - .../UI/components/ReversedAddress/index.tsx | 26 +- .../TokenSecurity/components/RiskCard.tsx | 2 - packages/shared/src/UI/components/index.ts | 2 +- packages/shared/src/locales/en-US.json | 11 - packages/web3-providers/src/rss3/constants.ts | 9 - packages/web3-providers/src/rss3/index.ts | 15 +- packages/web3-providers/src/types/RSS3.ts | 58 ---- 83 files changed, 823 insertions(+), 1604 deletions(-) delete mode 100644 packages/icons/brands/EtherScan.svg delete mode 100644 packages/icons/brands/PolygonScan.svg delete mode 100644 packages/icons/general/Connect.svg delete mode 100644 packages/icons/general/DoubleArrowUp.svg delete mode 100644 packages/icons/general/Identity.svg delete mode 100644 packages/icons/general/RSS3.svg delete mode 100644 packages/icons/general/Selected.tsx delete mode 100644 packages/mask/src/plugins/Web3Feed/SNSAdaptor/FeedCard.tsx delete mode 100644 packages/mask/src/plugins/Web3Feed/SNSAdaptor/ReversedAddress.tsx delete mode 100644 packages/mask/src/plugins/Web3Feed/SNSAdaptor/StatusBox.tsx delete mode 100644 packages/mask/src/plugins/Web3Feed/SNSAdaptor/Web3FeedPage.tsx delete mode 100644 packages/mask/src/plugins/Web3Feed/SNSAdaptor/index.tsx delete mode 100644 packages/mask/src/plugins/Web3Feed/Worker/index.ts delete mode 100644 packages/mask/src/plugins/Web3Feed/base.ts delete mode 100644 packages/mask/src/plugins/Web3Feed/constants.ts delete mode 100644 packages/mask/src/plugins/Web3Feed/index.ts delete mode 100644 packages/mask/src/plugins/Web3Feed/locales/en-US.json delete mode 100644 packages/mask/src/plugins/Web3Feed/locales/index.ts delete mode 100644 packages/mask/src/plugins/Web3Feed/locales/ja-JP.json delete mode 100644 packages/mask/src/plugins/Web3Feed/locales/ko-KR.json delete mode 100644 packages/mask/src/plugins/Web3Feed/locales/languages.ts delete mode 100644 packages/mask/src/plugins/Web3Feed/locales/zh-CN.json delete mode 100644 packages/mask/src/plugins/Web3Feed/locales/zh-TW.json delete mode 100644 packages/shared/src/UI/components/CollectionDetailCard/assets/etherscan.png delete mode 100644 packages/shared/src/UI/components/CollectionDetailCard/index.tsx create mode 100644 packages/shared/src/UI/components/ConcealableTabs/index.tsx diff --git a/.i18n-codegen.json b/.i18n-codegen.json index e3882327b8bb..d97c47ff540f 100644 --- a/.i18n-codegen.json +++ b/.i18n-codegen.json @@ -359,17 +359,6 @@ "trans": "Translate", "sourceMap": "inline" } - }, - { - "input": "./packages/mask/src/plugins/Web3Feed/locales/en-US.json", - "output": "./packages/mask/src/plugins/Web3Feed/locales/i18n_generated", - "parser": { "type": "i18next", "contextSeparator": "$", "pluralSeparator": "_" }, - "generator": { - "type": "i18next/react-hooks", - "hooks": "useI18N", - "namespace": "com.maskbook.web3-feed", - "trans": "Translate" - } } ] } diff --git a/cspell.json b/cspell.json index d2dd760ab577..2efeb3f8b3a7 100644 --- a/cspell.json +++ b/cspell.json @@ -160,7 +160,6 @@ "perma", "pids", "plusplus", - "polygonscan", "pooltogether", "popc", "popper", diff --git a/packages/dashboard/src/pages/Personas/components/PersonaLine/index.tsx b/packages/dashboard/src/pages/Personas/components/PersonaLine/index.tsx index d75e63af3baa..3a5f9819252c 100644 --- a/packages/dashboard/src/pages/Personas/components/PersonaLine/index.tsx +++ b/packages/dashboard/src/pages/Personas/components/PersonaLine/index.tsx @@ -13,7 +13,7 @@ import { } from '@masknet/shared-base' import { LoadingAnimation, SOCIAL_MEDIA_ICON_MAPPING } from '@masknet/shared' import { PersonaContext } from '../../hooks/usePersonaContext' -import { NextIdPersonaWarning, NextIdPersonaVerified } from '@masknet/icons' +import { NextIdPersonaWarningIcon, NextIdPersonaVerifiedIcon } from '@masknet/icons' const useStyles = makeStyles()((theme) => ({ icon: { @@ -143,9 +143,9 @@ export const ConnectedPersonaLine = memo( {proof.loading ? ( ) : isProved?.is_valid ? ( - + ) : ( - + )} )} diff --git a/packages/icons/brands/EtherScan.svg b/packages/icons/brands/EtherScan.svg deleted file mode 100644 index 0537689e1b9f..000000000000 --- a/packages/icons/brands/EtherScan.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/packages/icons/brands/PolygonScan.svg b/packages/icons/brands/PolygonScan.svg deleted file mode 100644 index b2b865eca1c4..000000000000 --- a/packages/icons/brands/PolygonScan.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/packages/icons/general/ArrowDrop.svg b/packages/icons/general/ArrowDrop.svg index 5bf9d7999b78..3a70b8204d6d 100644 --- a/packages/icons/general/ArrowDrop.svg +++ b/packages/icons/general/ArrowDrop.svg @@ -2,7 +2,7 @@ diff --git a/packages/icons/general/Connect.svg b/packages/icons/general/Connect.svg deleted file mode 100644 index eb4616e6121f..000000000000 --- a/packages/icons/general/Connect.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - diff --git a/packages/icons/general/DoubleArrowUp.svg b/packages/icons/general/DoubleArrowUp.svg deleted file mode 100644 index 00d9920f1671..000000000000 --- a/packages/icons/general/DoubleArrowUp.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/packages/icons/general/Edit2.svg b/packages/icons/general/Edit2.svg index ab2ebb5fe72d..360e0bab4476 100644 --- a/packages/icons/general/Edit2.svg +++ b/packages/icons/general/Edit2.svg @@ -1,5 +1,6 @@ - + - + + \ No newline at end of file diff --git a/packages/icons/general/Identity.svg b/packages/icons/general/Identity.svg deleted file mode 100644 index 0f76a7100010..000000000000 --- a/packages/icons/general/Identity.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/packages/icons/general/NextIdPersonaVerified.svg b/packages/icons/general/NextIdPersonaVerified.svg index 5b712d60bbc5..c354730ed815 100644 --- a/packages/icons/general/NextIdPersonaVerified.svg +++ b/packages/icons/general/NextIdPersonaVerified.svg @@ -2,7 +2,7 @@ + \ No newline at end of file diff --git a/packages/icons/general/RSS3.svg b/packages/icons/general/RSS3.svg deleted file mode 100644 index 0a526f9f859c..000000000000 --- a/packages/icons/general/RSS3.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/packages/icons/general/Selected.light.svg b/packages/icons/general/Selected.light.svg index 784b42115f8e..7830ae3984b8 100644 --- a/packages/icons/general/Selected.light.svg +++ b/packages/icons/general/Selected.light.svg @@ -1,7 +1,7 @@ - + - - - - , - - - - - , - undefined, - '0 0 16 16', -) diff --git a/packages/icons/plugins/WalletUnderTabs.svg b/packages/icons/plugins/WalletUnderTabs.svg index adfe652e2ebe..01949d149918 100644 --- a/packages/icons/plugins/WalletUnderTabs.svg +++ b/packages/icons/plugins/WalletUnderTabs.svg @@ -1,25 +1,21 @@ ({ root: {}, - container: { - background: - 'linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.8) 100%), linear-gradient(90deg, rgba(28, 104, 243, 0.2) 0%, rgba(69, 163, 251, 0.2) 100%), #FFFFFF;', - padding: '16px 16px 0 16px', - }, - title: { - display: 'flex', - justifyContent: 'space-between', - alignItems: 'center', - marginBottom: '16px', - }, - walletItem: { - display: 'flex', - alignItems: 'center', - fontSize: 18, - fontWeight: 700, - }, - menuItem: { - display: 'flex', - alignItems: 'center', - flexGrow: 1, - justifyContent: 'space-between', - }, - addressItem: { - display: 'flex', - alignItems: 'center', - }, - link: { - cursor: 'pointer', - marginTop: 2, - zIndex: 1, - '&:hover': { - textDecoration: 'none', - }, - }, - linkIcon: { - color: theme.palette.maskColor.second, - fontSize: '20px', - margin: '4px 2px 0 2px', - }, content: { position: 'relative', + padding: theme.spacing(2, 1), }, - walletButton: { - padding: 0, - fontSize: '18px', - minWidth: 0, - background: 'transparent', - '&:hover': { - background: 'none', - }, - }, - settingItem: { - display: 'flex', - alignItems: 'center', - }, - tabs: { - display: 'flex', - position: 'relative', + settingIcon: { + cursor: 'pointer', + color: theme.palette.maskColor.main, + margin: '0 6px', }, })) @@ -103,12 +51,11 @@ export interface ProfileTabContentProps extends withClasses<'text' | 'button' | export function ProfileTabContent(props: ProfileTabContentProps) { const classes = useStylesExtends(useStyles(), props) - const t = useSharedI18N() + const { t } = useI18N() const translate = usePluginI18NField() const [hidden, setHidden] = useState(true) - const [selectedAddress, setSelectedAddress] = useState | undefined>() - const [anchorEl, setAnchorEl] = useState(null) + const [selectedTab, setSelectedTab] = useState() const currentIdentity = useLastRecognizedIdentity() const identity = useCurrentVisitingIdentity() @@ -153,7 +100,6 @@ export function ProfileTabContent(props: ProfileTabContentProps) { const addressList = useMemo(() => { if (!wallets?.length || (!isOwn && socialAddressList?.length)) { - setSelectedAddress(first(socialAddressList)) return socialAddressList } const addresses = wallets.map((proof) => { @@ -164,9 +110,7 @@ export function ProfileTabContent(props: ProfileTabContentProps) { address: proof?.identity, } }) - const addressList = [...addresses, ...socialAddressList] - setSelectedAddress(first(addressList)) - return addressList + return [...socialAddressList, ...addresses] }, [socialAddressList, wallets?.map((x) => x.identity).join(), isOwn]) const activatedPlugins = useActivatedPluginsSNSAdaptor('any') @@ -175,8 +119,8 @@ export function ProfileTabContent(props: ProfileTabContentProps) { const displayPlugins = useMemo(() => { return availablePlugins .flatMap((x) => x.ProfileTabs?.map((y) => ({ ...y, pluginID: x.ID })) ?? EMPTY_LIST) - .filter((z) => z.Utils?.shouldDisplay?.(identity, selectedAddress) ?? true) - }, [identity, availablePlugins.map((x) => x.ID).join(), selectedAddress]) + .filter((z) => z.Utils?.shouldDisplay?.(identity, addressList) ?? true) + }, [identity, availablePlugins.map((x) => x.ID).join(), addressList.map((x) => x.address).join()]) const tabs = displayPlugins .sort((a, z) => { @@ -204,31 +148,44 @@ export function ProfileTabContent(props: ProfileTabContentProps) { label: typeof x.label === 'string' ? x.label : translate(x.pluginID, x.label), })) - const [currentTab, onChange] = useTabs(first(tabs)?.id ?? PluginId.NextID, ...tabs.map((tab) => tab.id)) - + const selectedTabId = selectedTab ?? first(tabs)?.id const showNextID = isTwitter(activatedSocialNetworkUI) && - ((isOwn && addressList?.length === 0) || - isWeb3ProfileDisable || - (isOwn && !isCurrentConnectedPersonaBind) || - (isOwn && !wallets?.length) || - !addressList?.length) + ((isOwn && addressList?.length === 0) || isWeb3ProfileDisable || (isOwn && !isCurrentConnectedPersonaBind)) const componentTabId = showNextID ? displayPlugins?.find((tab) => tab?.pluginID === PluginId.NextID)?.ID - : currentTab + : selectedTabId + const handleOpenDialog = () => { + CrossIsolationMessages.events.requestWeb3ProfileDialog.sendToAll({ + open: true, + }) + } const component = useMemo(() => { const Component = getTabContent(componentTabId) + const Utils = displayPlugins.find((x) => x.ID === selectedTabId)?.Utils - return - }, [componentTabId, personaPublicKey, selectedAddress]) + return ( + Utils?.filter?.(x) ?? true).sort(Utils?.sorter)} + /> + ) + }, [ + componentTabId, + personaPublicKey, + displayPlugins.map((x) => x.ID).join(), + personaList.join(), + addressList.map((x) => x.address).join(), + ]) useLocationChange(() => { - onChange(undefined, first(tabs)?.id) + setSelectedTab(undefined) }) useUpdateEffect(() => { - onChange(undefined, first(tabs)?.id) + setSelectedTab(undefined) }, [identity.identifier?.userId]) useEffect(() => { @@ -242,22 +199,10 @@ export function ProfileTabContent(props: ProfileTabContentProps) { setHidden(!data.show) }) }, [identity.identifier?.userId]) - const onClose = () => setAnchorEl(null) - const onOpen = (event: React.MouseEvent) => setAnchorEl(event.currentTarget) - const onSelect = (option: SocialAddress) => { - setSelectedAddress(option) - onClose() - } - const handleOpenDialog = () => { - CrossIsolationMessages.events.requestWeb3ProfileDialog.sendToAll({ - open: true, - }) - } if (hidden) return null - // loadingSocialAddress - if (!identity.identifier?.userId || loadingPersonaList) + if (!identity.identifier?.userId || loadingSocialAddressList || loadingPersonaList) return (
{tabs.length > 0 && !showNextID && ( -
-
-
- - setAnchorEl(null)}> - {uniqBy(addressList ?? [], (x) => x.address.toLowerCase()).map((x) => { - return ( - onSelect(x)}> -
-
- {x?.type === SocialAddressType.KV || - x?.type === SocialAddressType.ADDRESS ? ( - - ) : ( - - {x.label} - - )} - - - - {x?.type === SocialAddressType.KV && ( - - )} -
- {isSameAddress(selectedAddress?.address, x.address) && ( - - )} -
-
- ) - })} -
-
-
- - {t.powered_by()} - - - {t.mask_network()} - - -
-
-
- - - {tabs.map((tab) => ( - - ))} - - -
-
+ + tabs={tabs} + selectedId={selectedTabId} + onChange={setSelectedTab} + tail={isOwn && } + /> )}
{component}
diff --git a/packages/mask/src/extension/options-page/DashboardComponents/CollectibleList/CollectibleCard.tsx b/packages/mask/src/extension/options-page/DashboardComponents/CollectibleList/CollectibleCard.tsx index 382a5e0a80c5..acaf58fd4f7d 100644 --- a/packages/mask/src/extension/options-page/DashboardComponents/CollectibleList/CollectibleCard.tsx +++ b/packages/mask/src/extension/options-page/DashboardComponents/CollectibleList/CollectibleCard.tsx @@ -4,14 +4,13 @@ import { NFTCardStyledAssetPlayer } from '@masknet/shared' import { ActionsBarNFT } from '../ActionsBarNFT' import type { NonFungibleToken, SourceType, Wallet } from '@masknet/web3-shared-base' import type { Web3Helper } from '@masknet/plugin-infra/src/entry-web3' -import { resolveOpenSeaLink } from '@masknet/web3-shared-evm' const useStyles = makeStyles()((theme) => ({ root: { display: 'flex', alignItems: 'center', justifyContent: 'center', - borderRadius: '8px 8px 0 0', + borderRadius: 4, position: 'absolute', zIndex: 1, backgroundColor: theme.palette.mode === 'light' ? '#F7F9FA' : '#2F3336', @@ -68,11 +67,7 @@ export function CollectibleCard(props: CollectibleCardProps) { const { classes } = useStyles() return ( - +
{readonly || !wallet ? null : ( @@ -88,7 +83,6 @@ export function CollectibleCard(props: CollectibleCardProps) { loadingFailImage: classes.loadingFailImage, wrapper: classes.wrapper, }} - showNetwork /> diff --git a/packages/mask/src/extension/options-page/DashboardComponents/CollectibleList/index.tsx b/packages/mask/src/extension/options-page/DashboardComponents/CollectibleList/index.tsx index 8ae81d75b63b..93e23394b872 100644 --- a/packages/mask/src/extension/options-page/DashboardComponents/CollectibleList/index.tsx +++ b/packages/mask/src/extension/options-page/DashboardComponents/CollectibleList/index.tsx @@ -6,12 +6,14 @@ import { NonFungibleAsset, NonFungibleTokenCollection, SocialAddress, + SocialAddressType, SourceType, Wallet, } from '@masknet/web3-shared-base' import { Box, Button, Stack, styled, Typography } from '@mui/material' import { LoadingBase, makeStyles, useStylesExtends } from '@masknet/theme' -import { ElementAnchor, RetryHint } from '@masknet/shared' +import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown' +import { ElementAnchor, RetryHint, ReversedAddress } from '@masknet/shared' import { EMPTY_LIST } from '@masknet/shared-base' import type { IdentityResolved } from '@masknet/plugin-infra' import { useNonFungibleAssets, useTrustedNonFungibleTokens, Web3Helper } from '@masknet/plugin-infra/web3' @@ -72,7 +74,6 @@ const useStyles = makeStyles()((theme) => ({ description: { background: theme.palette.mode === 'light' ? '#F7F9FA' : '#2F3336', alignSelf: 'stretch', - borderRadius: '0 0 8px 8px', }, name: { whiteSpace: 'nowrap', @@ -221,10 +222,12 @@ export function CollectibleList(props: CollectibleListProps) { export function CollectionList({ addressName, + onSelectAddress, persona, visitingProfile, }: { addressName: SocialAddress + onSelectAddress: (event: React.MouseEvent) => void persona?: string visitingProfile?: IdentityResolved }) { @@ -288,15 +291,55 @@ export function CollectionList({ if ((done && !allCollectibles.length) || !account) return ( - - - {t('no_nft_at_current_address')} - - + <> + {addressName && ( + + + + + + )} + + + {t('dashboard_no_collectible_found')} + + + ) return ( - + + + + + + + @@ -361,12 +404,7 @@ export function CollectionList({ key={i} alignItems="center" justifyContent="center" - sx={{ - marginTop: '8px', - marginBottom: '12px', - minWidth: 30, - maxHeight: 24, - }}> + sx={{ marginTop: '8px', marginBottom: '12px', minWidth: 30, maxHeight: 24 }}> ({ @@ -75,7 +75,11 @@ export const PersonaHeaderUI = memo(
- {avatar ? : } + {avatar ? ( + + ) : ( + + )}
{formatPersonaName(nickname)} @@ -83,9 +87,8 @@ export const PersonaHeaderUI = memo(
-
diff --git a/packages/mask/src/extension/popups/pages/Wallet/SwitchWallet/WalletItem.tsx b/packages/mask/src/extension/popups/pages/Wallet/SwitchWallet/WalletItem.tsx index 9784bc9aa164..0d55714551cc 100644 --- a/packages/mask/src/extension/popups/pages/Wallet/SwitchWallet/WalletItem.tsx +++ b/packages/mask/src/extension/popups/pages/Wallet/SwitchWallet/WalletItem.tsx @@ -105,9 +105,7 @@ export const WalletItem = memo(({ wallet, onClick, isSelected } ({Others.formatDomainName(domain)}) ) : null} - {isHovering ? ( - - ) : null} + {isHovering ? : null} diff --git a/packages/mask/src/extension/popups/pages/Wallet/components/WalletHeader/UI.tsx b/packages/mask/src/extension/popups/pages/Wallet/components/WalletHeader/UI.tsx index 354cf9d41865..10983f7de484 100644 --- a/packages/mask/src/extension/popups/pages/Wallet/components/WalletHeader/UI.tsx +++ b/packages/mask/src/extension/popups/pages/Wallet/components/WalletHeader/UI.tsx @@ -115,7 +115,6 @@ export const WalletHeaderUI = memo( {!disabled ? ( ) : null} @@ -146,7 +145,6 @@ export const WalletHeaderUI = memo( {!disabled ? ( ) : null} diff --git a/packages/mask/src/extension/popups/pages/Wallet/components/WalletInfo/index.tsx b/packages/mask/src/extension/popups/pages/Wallet/components/WalletInfo/index.tsx index 0a44d9942b3b..856f829b5747 100644 --- a/packages/mask/src/extension/popups/pages/Wallet/components/WalletInfo/index.tsx +++ b/packages/mask/src/extension/popups/pages/Wallet/components/WalletInfo/index.tsx @@ -109,8 +109,7 @@ export const WalletInfoUI = memo(
- {name}{' '} - + {name} {domain && formatDomainName ? ( {formatDomainName(domain)} diff --git a/packages/mask/src/plugins/Collectible/SNSAdaptor/NFTPage.tsx b/packages/mask/src/plugins/Collectible/SNSAdaptor/NFTPage.tsx index 5082937311d0..905141d5f620 100644 --- a/packages/mask/src/plugins/Collectible/SNSAdaptor/NFTPage.tsx +++ b/packages/mask/src/plugins/Collectible/SNSAdaptor/NFTPage.tsx @@ -1,17 +1,95 @@ -import type { SocialAddress, NetworkPluginID, SocialIdentity } from '@masknet/web3-shared-base' +import { useState } from 'react' +import { first, uniqBy } from 'lodash-unified' +import { ReversedAddress } from '@masknet/shared' +import { getMaskColor, makeStyles, ShadowRootMenu } from '@masknet/theme' +import { MenuItem } from '@mui/material' +import { SocialAddress, NetworkPluginID, SocialIdentity, SocialAddressType } from '@masknet/web3-shared-base' import { CollectionList } from '../../../extension/options-page/DashboardComponents/CollectibleList' +import { EMPTY_LIST } from '@masknet/shared-base' import { useCurrentVisitingProfile } from '../hooks/useContext' +const useStyles = makeStyles()((theme) => ({ + root: { + position: 'relative', + }, + text: { + paddingTop: 36, + paddingBottom: 36, + '& > p': { + color: getMaskColor(theme).textPrimary, + }, + }, + note: { + padding: `0 ${theme.spacing(1)}`, + textAlign: 'right', + }, + icon: { + color: getMaskColor(theme).textPrimary, + }, + iconContainer: { + display: 'inherit', + }, + tipList: { + listStyleType: 'decimal', + paddingLeft: 16, + }, + button: { + border: `1px solid ${theme.palette.text.primary} !important`, + color: `${theme.palette.text.primary} !important`, + borderRadius: 9999, + background: 'transparent', + '&:hover': { + background: 'rgba(15, 20, 25, 0.1)', + }, + }, +})) + export interface NFTPageProps { persona?: string identity?: SocialIdentity - socialAddress?: SocialAddress + socialAddressList?: Array> } -export function NFTPage({ socialAddress, persona }: NFTPageProps) { +export function NFTPage({ socialAddressList, persona }: NFTPageProps) { + const { classes } = useStyles() + const [anchorEl, setAnchorEl] = useState(null) + + const [selectedAddress, setSelectedAddress] = useState(first(socialAddressList)) + const onOpen = (event: React.MouseEvent) => setAnchorEl(event.currentTarget) + const onClose = () => setAnchorEl(null) + const onSelect = (option: SocialAddress) => { + setSelectedAddress(option) + onClose() + } const currentVisitingProfile = useCurrentVisitingProfile() - if (!socialAddress) return null + if (!selectedAddress) return null - return + return ( +
+ + {uniqBy(socialAddressList ?? EMPTY_LIST, (x) => x.address.toLowerCase()).map((x) => { + return ( + onSelect(x)}> + {x.type === SocialAddressType.ADDRESS || x.type === SocialAddressType.KV ? ( + + ) : ( + x.label + )} + + ) + })} + + +
+ ) } diff --git a/packages/mask/src/plugins/Collectible/SNSAdaptor/index.tsx b/packages/mask/src/plugins/Collectible/SNSAdaptor/index.tsx index c18e6f378c91..e2bcc6c39153 100644 --- a/packages/mask/src/plugins/Collectible/SNSAdaptor/index.tsx +++ b/packages/mask/src/plugins/Collectible/SNSAdaptor/index.tsx @@ -40,6 +40,9 @@ const sns: Plugin.SNSAdaptor.Definition = { TabContent: NFTPage, }, Utils: { + shouldDisplay: (identity, socialAddressList) => { + return !!socialAddressList?.length + }, sorter: (a, z) => { if (a.type === SocialAddressType.ENS) return -1 if (z.type === SocialAddressType.ENS) return 1 diff --git a/packages/mask/src/plugins/NextID/components/NextIdPage.tsx b/packages/mask/src/plugins/NextID/components/NextIdPage.tsx index 3ea099eda404..6b6e3fa39bca 100644 --- a/packages/mask/src/plugins/NextID/components/NextIdPage.tsx +++ b/packages/mask/src/plugins/NextID/components/NextIdPage.tsx @@ -1,4 +1,4 @@ -import { Plugin, WalletUnderTabs, Web3Profile, Connect, Identity, LinkOut } from '@masknet/icons' +import { NewLinkOutIcon, PluginIcon, Verified, WalletUnderTabsIcon, Web3ProfileIcon } from '@masknet/icons' import { PluginId, useIsMinimalMode } from '@masknet/plugin-infra/content-script' import { useChainId } from '@masknet/plugin-infra/web3' import { NextIDPlatform, PopupRoutes, EMPTY_LIST } from '@masknet/shared-base' @@ -59,12 +59,9 @@ const useStyles = makeStyles()((theme) => ({ }, container: { background: - 'linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.8) 100%), linear-gradient(90deg, rgba(28, 104, 243, 0.2) 0%, rgba(45, 41, 253, 0.2) 100%), #FFFFFF;', - padding: '14px 14px 16px 14px ', - height: '166px', - display: 'flex', - flexDirection: 'column', - justifyContent: 'space-between', + 'linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.8) 100%), linear-gradient(90deg, rgba(28, 104, 243, 0.2) 0%, rgba(249, 55, 55, 0.2) 100%), #FFFFFF;', + borderRadius: '16px', + padding: '14px', }, verifyIntro: { fontSize: '14px', @@ -88,18 +85,22 @@ const useStyles = makeStyles()((theme) => ({ backgroundColor: theme.palette.background.default, height: '196px', }, + walletIcon: { + fontSize: 18, + marginRight: 8, + }, web3Icon: { marginRight: 6, marginTop: 2, }, item1: { color: '#767f8d', - fontSize: '14px', + fontSize: '14', fontWeight: 400, }, item2: { color: '#07101B', - fontSize: '14px', + fontSize: '14', fontWeight: 500, marginLeft: '2px', }, @@ -107,19 +108,11 @@ const useStyles = makeStyles()((theme) => ({ borderRadius: '99px', backgroundColor: '#07101b', color: '#fff', - marginTop: 'auto', ':hover': { color: 'fff', backgroundColor: '#07101b', }, }, - content: { - display: 'flex', - justifyContent: 'center', - alignItems: 'center', - fontSize: '14px', - fontWeight: 400, - }, })) interface NextIdPageProps { @@ -129,8 +122,6 @@ interface NextIdPageProps { export function NextIdPage({ persona }: NextIdPageProps) { const t = useI18N() const { classes } = useStyles() - - const [description, setDescription] = useState('') const currentProfileIdentifier = useLastRecognizedIdentity() const visitingPersonaIdentifier = useCurrentVisitingIdentity() const personaConnectStatus = usePersonaConnectStatus() @@ -144,16 +135,8 @@ export function NextIdPage({ persona }: NextIdPageProps) { const personaActionButton = useMemo(() => { if (!personaConnectStatus.action) return null const button = personaConnectStatus.hasPersona ? t.connect_persona() : t.create_persona() - setDescription(personaConnectStatus.hasPersona ? '' : t.create_persona_intro()) - const icon = personaConnectStatus.hasPersona ? ( - - ) : ( - - ) - return ( ) @@ -204,15 +187,11 @@ export function NextIdPage({ persona }: NextIdPageProps) { }) } - const getButton = useMemo(() => { - if (!isOwn) { - setDescription(t.others_lack_wallet()) - return - } + const getButton = () => { if (isWeb3ProfileDisable) { return ( ) @@ -220,22 +199,21 @@ export function NextIdPage({ persona }: NextIdPageProps) { if (personaActionButton && isOwn) { return personaActionButton } - if (!isAccountVerified && isOwn) { + if (!isAccountVerified) { return ( ) } - setDescription(t.add_wallet_intro()) return ( ) - }, [isWeb3ProfileDisable, personaActionButton, isOwn, isAccountVerified, t]) + } if (loadingBindings || loadingPersona || loadingVerifyInfo) { return ( @@ -256,7 +234,7 @@ export function NextIdPage({ persona }: NextIdPageProps) {
- + {t.web3_profile()} @@ -272,14 +250,18 @@ export function NextIdPage({ persona }: NextIdPageProps) { href="https://mask.io/" width="22px" height="22px" - style={{ alignSelf: 'center', marginLeft: '4px' }}> - + style={{ alignSelf: 'center' }}> +
- {description} - - {getButton} +
+
+
+
+
+ + {getButton()} {openBindDialog && currentPersona && isOwn && ( diff --git a/packages/mask/src/plugins/NextID/locales/en-US.json b/packages/mask/src/plugins/NextID/locales/en-US.json index 07af9078bb34..4e20f01487e9 100644 --- a/packages/mask/src/plugins/NextID/locales/en-US.json +++ b/packages/mask/src/plugins/NextID/locales/en-US.json @@ -54,8 +54,5 @@ "send_specific_tip_successfully": "Sent {{amount}} {{name}} tip successfully.", "search": "Search", "web3_profile": "Web3 Profile", - "mask_network": "Mask Network", - "create_persona_intro": "Please create your persona to use Web3 Profile.", - "add_wallet_intro": "In the Web3 tab, you can show your wallet addresses for NFT collections, donation records, and other on-chain feeds to friends who have also installed the Mask extension.", - "others_lack_wallet": "The user has not set this." + "mask_network": "Mask Network" } diff --git a/packages/mask/src/plugins/Pets/SNSAdaptor/PetSetDialog.tsx b/packages/mask/src/plugins/Pets/SNSAdaptor/PetSetDialog.tsx index 87f3d8761487..0fc502401116 100644 --- a/packages/mask/src/plugins/Pets/SNSAdaptor/PetSetDialog.tsx +++ b/packages/mask/src/plugins/Pets/SNSAdaptor/PetSetDialog.tsx @@ -29,7 +29,7 @@ import { petShowSettings } from '../settings' import { ChainBoundary } from '../../../web3/UI/ChainBoundary' import { useWeb3Connection } from '@masknet/plugin-infra/web3' import { saveCustomEssayToRSS } from '../Services/rss3' -import { Rss3 } from '@masknet/icons' +import { RSS3Icon } from '../assets/rss3' import ActionButton from '../../../extension/options-page/DashboardComponents/ActionButton' const useStyles = makeStyles()((theme) => ({ @@ -376,7 +376,7 @@ export function PetSetDialog({ configNFTs, onClose }: PetSetDialogProps) { RSS3 - + diff --git a/packages/mask/src/plugins/Trader/SNSAdaptor/trending/PriceChanged.tsx b/packages/mask/src/plugins/Trader/SNSAdaptor/trending/PriceChanged.tsx index 1a9e14d18d14..9e710730e5c2 100644 --- a/packages/mask/src/plugins/Trader/SNSAdaptor/trending/PriceChanged.tsx +++ b/packages/mask/src/plugins/Trader/SNSAdaptor/trending/PriceChanged.tsx @@ -31,8 +31,8 @@ export function PriceChanged(props: PriceChangedProps) { if (props.amount === 0) return null return ( - {props.amount > 0 ? : null} - {props.amount < 0 ? : null} + {props.amount > 0 ? : null} + {props.amount < 0 ? : null} 0 ? colors?.success : colors?.danger}> {props.amount.toFixed(2)}% diff --git a/packages/mask/src/plugins/Trader/SNSAdaptor/trending/TrendingViewDeck.tsx b/packages/mask/src/plugins/Trader/SNSAdaptor/trending/TrendingViewDeck.tsx index 37c6c94a375f..4d13767a1e7e 100644 --- a/packages/mask/src/plugins/Trader/SNSAdaptor/trending/TrendingViewDeck.tsx +++ b/packages/mask/src/plugins/Trader/SNSAdaptor/trending/TrendingViewDeck.tsx @@ -248,7 +248,7 @@ export function TrendingViewDeck(props: TrendingViewDeckProps) { sx={{ padding: 0 }} size="small" onClick={() => setCoinMenuOpen((v) => !v)}> - + )} - {selected && } + {selected && }
{Others?.chainResolver.chainName(network.chainId)} diff --git a/packages/mask/src/plugins/Wallet/SNSAdaptor/TransactionSnackbar/index.tsx b/packages/mask/src/plugins/Wallet/SNSAdaptor/TransactionSnackbar/index.tsx index 9fcdec0f5963..22cbf7e66bba 100644 --- a/packages/mask/src/plugins/Wallet/SNSAdaptor/TransactionSnackbar/index.tsx +++ b/packages/mask/src/plugins/Wallet/SNSAdaptor/TransactionSnackbar/index.tsx @@ -111,7 +111,7 @@ export function TransactionSnackbar({ pluginID }: Tra {progress.status === TransactionStatusType.SUCCEED ? computed.successfulDescription ?? computed.description : computed.description}{' '} - + ), }, diff --git a/packages/mask/src/plugins/Web3Feed/SNSAdaptor/FeedCard.tsx b/packages/mask/src/plugins/Web3Feed/SNSAdaptor/FeedCard.tsx deleted file mode 100644 index 1f3891b4f273..000000000000 --- a/packages/mask/src/plugins/Web3Feed/SNSAdaptor/FeedCard.tsx +++ /dev/null @@ -1,223 +0,0 @@ -import { NFTCardStyledAssetPlayer, TokenIcon } from '@masknet/shared' -import { makeStyles } from '@masknet/theme' -import { Alchemy_EVM, RSS3BaseAPI } from '@masknet/web3-providers' -import { NetworkPluginID } from '@masknet/web3-shared-base' -import { resolveIPFSLinkFromURL, ZERO_ADDRESS } from '@masknet/web3-shared-evm' -import { Box, Typography, Card } from '@mui/material' -import differenceInCalendarDays from 'date-fns/differenceInDays' -import differenceInCalendarHours from 'date-fns/differenceInHours' -import { useMemo } from 'react' -import { ChainID } from '../constants' -import { ReversedAddress } from './ReversedAddress' -import { useI18N } from '../locales' -import { useAsyncRetry } from 'react-use' - -const useStyles = makeStyles()((theme) => ({ - wrapper: { - display: 'flex', - justifyContent: 'space-between', - marginBottom: 16, - cursor: 'pointer', - }, - img: { - width: '64px !important', - height: '64px !important', - borderRadius: '8px', - objectFit: 'cover', - }, - collection: { - borderLeft: `4px solid ${theme.palette.maskColor.line}`, - paddingLeft: 12, - marginTop: 12, - marginLeft: 8, - }, - time: { - color: theme.palette.maskColor.third, - marginLeft: 10, - }, - summary: { - textOverflow: 'ellipsis', - '-webkit-line-clamp': '1', - maxWidth: '400px', - overflow: 'hidden', - display: '-webkit-box', - '-webkit-box-orient': 'vertical', - }, - defaultImage: { - background: theme.palette.maskColor.modalTitleBg, - display: 'flex', - justifyContent: 'center', - alignItems: 'center', - borderRadius: 12, - }, - loadingFailImage: { - minHeight: '0 !important', - maxWidth: 'none', - width: 64, - height: 64, - }, -})) - -export interface FeedCardProps { - feed: RSS3BaseAPI.Web3Feed - address?: string - onSelect: (feed: RSS3BaseAPI.Web3Feed) => void -} - -export function FeedCard({ feed, address, onSelect }: FeedCardProps) { - const { classes } = useStyles() - const t = useI18N() - - const { value: NFTMetadata } = useAsyncRetry(async () => { - if ((feed.title && feed.summary) || !feed.metadata?.collection_address) return - - const res = await Alchemy_EVM.getAsset(feed.metadata?.collection_address, feed.metadata?.token_id ?? '', { - chainId: ChainID[feed.metadata?.network ?? 'ethereum'], - }) - return res - }, [feed.metadata?.collection_address]) - - const action = useMemo(() => { - if (!feed) return - if (feed.tags?.includes('NFT')) { - if (feed.metadata?.from?.toLowerCase() === address) { - return ( - - sent a NFT to - - ) - } - if (feed.metadata?.from === ZERO_ADDRESS) { - return 'minted a NFT' - } - if (feed.metadata?.to?.toLowerCase() === address) { - return ( - - acquire a NFT from - - ) - } - } - if (feed.tags?.includes('Token') || feed.tags?.includes('ETH')) { - if (feed.metadata?.from?.toLowerCase() === address) { - return ( - - sent to - - ) - } - if (feed.metadata?.to?.toLowerCase() === address) { - return ( - - received from - - ) - } - } - if (feed.tags?.includes('Gitcoin')) { - if (feed.metadata?.from?.toLowerCase() === address) { - return 'donated' - } - if (feed.metadata?.to?.toLowerCase() === address) { - return 'received donation from' - } - } - if (feed.metadata?.from?.toLowerCase() === address) { - return 'received' - } - return 'sent' - }, [address, feed]) - - const logo = useMemo(() => { - if (feed.tags?.includes('NFT')) { - return ( - - attachment?.type === 'preview')?.address || - '', - )} - tokenId={feed.metadata?.token_id} - classes={{ - loadingFailImage: classes.loadingFailImage, - wrapper: classes.img, - iframe: classes.img, - }} - /> - - ) - } - if (feed.tags.includes('Token') || feed.tags.includes('ETH')) { - return ( - - ) - } - if (feed.tags.includes('Gitcoin')) { - return ( - attachment?.type === 'logo')?.address} - /> - ) - } - return null - }, [feed]) - - const time = useMemo(() => { - const days = differenceInCalendarDays(new Date(), new Date(feed.date_updated)) - const hours = differenceInCalendarHours(new Date(), new Date(feed.date_updated)) - return [ - days > 0 ? `${days} ${t.day({ count: days })} ` : '', - hours > 0 ? `${hours} ${t.day({ count: hours })} ` : '', - t.ago(), - ].join('') - }, [feed.date_updated, t]) - return ( - - onSelect({ - ...feed, - title: - feed.title || - NFTMetadata?.metadata?.name || - NFTMetadata?.collection?.name || - NFTMetadata?.contract?.name || - `#${feed.metadata?.token_id}`, - summary: feed.summary || NFTMetadata?.metadata?.description || NFTMetadata?.collection?.description, - imageURL: resolveIPFSLinkFromURL( - NFTMetadata?.metadata?.imageURL || - feed.attachments?.find((attachment) => attachment?.type === 'preview')?.address || - feed.attachments?.find((attachment) => attachment?.type === 'logo')?.address || - '', - ), - traits: NFTMetadata?.traits, - }) - }> -
- {action} {time} - - - {feed.title || - NFTMetadata?.metadata?.name || - NFTMetadata?.collection?.name || - NFTMetadata?.contract?.name || - ''} - - - {feed.summary || NFTMetadata?.metadata?.description || NFTMetadata?.collection?.description} || - `#${feed.metadata?.token_id}` - - -
- {logo} -
- ) -} diff --git a/packages/mask/src/plugins/Web3Feed/SNSAdaptor/ReversedAddress.tsx b/packages/mask/src/plugins/Web3Feed/SNSAdaptor/ReversedAddress.tsx deleted file mode 100644 index c292af15c4ad..000000000000 --- a/packages/mask/src/plugins/Web3Feed/SNSAdaptor/ReversedAddress.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { memo } from 'react' -import type { NetworkPluginID } from '@masknet/web3-shared-base' -import { useReverseAddress, useWeb3State } from '@masknet/plugin-infra/web3' -import { ZERO_ADDRESS } from '@masknet/web3-shared-evm' - -interface ReverseAddressProps { - address?: string - pluginId?: NetworkPluginID - domainSize?: number - size?: number - fontSize?: string - fontWeight?: number -} - -export const ReversedAddress = memo( - ({ address = ZERO_ADDRESS, pluginId, domainSize, size = 5, fontSize = '14px', fontWeight = 400 }) => { - const { value: domain } = useReverseAddress(pluginId, address) - const { Others } = useWeb3State(pluginId) - if (address === ZERO_ADDRESS) return null - - if (!domain || !Others?.formatDomainName) - return {Others?.formatAddress?.(address, size) ?? address} - - return {Others.formatDomainName(domain, domainSize)} - }, -) diff --git a/packages/mask/src/plugins/Web3Feed/SNSAdaptor/StatusBox.tsx b/packages/mask/src/plugins/Web3Feed/SNSAdaptor/StatusBox.tsx deleted file mode 100644 index f7c27973fcb3..000000000000 --- a/packages/mask/src/plugins/Web3Feed/SNSAdaptor/StatusBox.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { makeStyles } from '@masknet/theme' -import { Box, CircularProgress, Typography } from '@mui/material' -import type { FC } from 'react' -import { useI18N } from '../locales' - -interface Props { - loading?: boolean - empty?: boolean -} - -const useStyles = makeStyles()((theme) => ({ - statusBox: { - display: 'flex', - alignItems: 'center', - justifyContent: 'center', - marginTop: theme.spacing(6), - }, -})) - -export const StatusBox: FC = ({ loading, empty }) => { - const { classes } = useStyles() - const t = useI18N() - if (loading) { - return ( - - - - ) - } - - if (empty) { - return ( - - {t.no_data()} - - ) - } - return null -} diff --git a/packages/mask/src/plugins/Web3Feed/SNSAdaptor/Web3FeedPage.tsx b/packages/mask/src/plugins/Web3Feed/SNSAdaptor/Web3FeedPage.tsx deleted file mode 100644 index 31ff671c3cbd..000000000000 --- a/packages/mask/src/plugins/Web3Feed/SNSAdaptor/Web3FeedPage.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import { CollectionDetailCard } from '@masknet/shared' -import { RSS3, RSS3BaseAPI } from '@masknet/web3-providers' -import type { NetworkPluginID, SocialAddress } from '@masknet/web3-shared-base' -import { useState } from 'react' -import { useAsyncRetry } from 'react-use' -import { FeedCard } from './FeedCard' -import { StatusBox } from './StatusBox' - -export interface Web3FeedPageProps { - persona?: string - socialAddress?: SocialAddress -} - -export function Web3FeedPage({ socialAddress, persona }: Web3FeedPageProps) { - const [selectedFeed, setSelectedFeed] = useState() - const { value: feed, loading } = useAsyncRetry(async () => { - if (!socialAddress?.address) return - return RSS3.getWeb3Feed(socialAddress?.address) - }, [socialAddress]) - - if (!socialAddress) return null - if (loading || !feed?.list?.length) { - return - } - - return ( -
- {feed?.list?.map((info) => { - return ( - setSelectedFeed(feed)} - feed={info} - address={socialAddress?.address} - /> - ) - })} - setSelectedFeed(undefined)} - img={selectedFeed?.imageURL} - title={selectedFeed?.title} - relatedURLs={selectedFeed?.related_urls} - description={selectedFeed?.summary} - metadata={selectedFeed?.metadata} - traits={selectedFeed?.traits} - /> -
- ) -} diff --git a/packages/mask/src/plugins/Web3Feed/SNSAdaptor/index.tsx b/packages/mask/src/plugins/Web3Feed/SNSAdaptor/index.tsx deleted file mode 100644 index e97baea9383f..000000000000 --- a/packages/mask/src/plugins/Web3Feed/SNSAdaptor/index.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import type { Plugin } from '@masknet/plugin-infra/content-script' -import { base } from '../base' -import { PLUGIN_ID } from '../constants' -import { Web3FeedPage } from './Web3FeedPage' - -const sns: Plugin.SNSAdaptor.Definition = { - ...base, - init(signal, context) {}, - ProfileTabs: [ - { - ID: `${PLUGIN_ID}_web3Feed`, - label: 'Web3Feed', - priority: 4, - UI: { - TabContent: ({ socialAddress, persona }) => { - return - }, - }, - }, - ], -} - -export default sns diff --git a/packages/mask/src/plugins/Web3Feed/Worker/index.ts b/packages/mask/src/plugins/Web3Feed/Worker/index.ts deleted file mode 100644 index 2da0563bd149..000000000000 --- a/packages/mask/src/plugins/Web3Feed/Worker/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { Plugin } from '@masknet/plugin-infra' -import { base } from '../base' - -const worker: Plugin.Worker.Definition = { - ...base, - init(signal) {}, -} -export default worker diff --git a/packages/mask/src/plugins/Web3Feed/base.ts b/packages/mask/src/plugins/Web3Feed/base.ts deleted file mode 100644 index 6fdbd9edc841..000000000000 --- a/packages/mask/src/plugins/Web3Feed/base.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PLUGIN_ID } from './constants' -import { languages } from './locales/languages' -import { Plugin, CurrentSNSNetwork } from '@masknet/plugin-infra' - -export const base: Plugin.Shared.Definition = { - ID: PLUGIN_ID, - name: { fallback: 'Web3Feed' }, - description: { - fallback: 'web3 user collection feed', - }, - publisher: { name: { fallback: 'Mask Network' }, link: 'https://mask.io/' }, - enableRequirement: { - architecture: { app: true, web: true }, - networks: { - type: 'opt-in', - networks: { - [CurrentSNSNetwork.Twitter]: true, - [CurrentSNSNetwork.Facebook]: false, - [CurrentSNSNetwork.Instagram]: false, - }, - }, - target: 'stable', - }, - - i18n: languages, -} diff --git a/packages/mask/src/plugins/Web3Feed/constants.ts b/packages/mask/src/plugins/Web3Feed/constants.ts deleted file mode 100644 index 4b7cb0aac151..000000000000 --- a/packages/mask/src/plugins/Web3Feed/constants.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { PluginId } from '@masknet/plugin-infra' -import { ChainId } from '@masknet/web3-shared-evm' -export const PLUGIN_ID = PluginId.Web3Feed -export const PLUGIN_NAME = 'Web3 Feed' -export const PLUGIN_DESCRIPTION = 'web3 user collection feed' -export const ChainID = { - ethereum: ChainId.Mainnet, - polygon: ChainId.Matic, - bnb: ChainId.BSC, -} diff --git a/packages/mask/src/plugins/Web3Feed/index.ts b/packages/mask/src/plugins/Web3Feed/index.ts deleted file mode 100644 index eb51ba0afe25..000000000000 --- a/packages/mask/src/plugins/Web3Feed/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { registerPlugin } from '@masknet/plugin-infra' -import { base } from './base' - -registerPlugin({ - ...base, - SNSAdaptor: { - load: () => import('./SNSAdaptor'), - hotModuleReload: (hot) => - import.meta.webpackHot && import.meta.webpackHot.accept('./SNSAdaptor', () => hot(import('./SNSAdaptor'))), - }, - Worker: { - load: () => import('./Worker'), - hotModuleReload: (hot) => - import.meta.webpackHot && import.meta.webpackHot.accept('./Worker', () => hot(import('./Worker'))), - }, -}) diff --git a/packages/mask/src/plugins/Web3Feed/locales/en-US.json b/packages/mask/src/plugins/Web3Feed/locales/en-US.json deleted file mode 100644 index 213a84e43bb3..000000000000 --- a/packages/mask/src/plugins/Web3Feed/locales/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "day_one": "days", - "day_other": "days", - "hour_one": "hour", - "hour_other": "hours", - "ago": "ago", - "no_data": "No feed at the current address" -} diff --git a/packages/mask/src/plugins/Web3Feed/locales/index.ts b/packages/mask/src/plugins/Web3Feed/locales/index.ts deleted file mode 100644 index d6ead60252e4..000000000000 --- a/packages/mask/src/plugins/Web3Feed/locales/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file is auto generated. DO NOT EDIT -// Run `npx gulp sync-languages` to regenerate. -// Default fallback language in a family of languages are chosen by the alphabet order -// To overwrite this, please overwrite packages/scripts/src/locale-kit-next/index.ts - -export * from './i18n_generated' diff --git a/packages/mask/src/plugins/Web3Feed/locales/ja-JP.json b/packages/mask/src/plugins/Web3Feed/locales/ja-JP.json deleted file mode 100644 index 0967ef424bce..000000000000 --- a/packages/mask/src/plugins/Web3Feed/locales/ja-JP.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/packages/mask/src/plugins/Web3Feed/locales/ko-KR.json b/packages/mask/src/plugins/Web3Feed/locales/ko-KR.json deleted file mode 100644 index 0967ef424bce..000000000000 --- a/packages/mask/src/plugins/Web3Feed/locales/ko-KR.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/packages/mask/src/plugins/Web3Feed/locales/languages.ts b/packages/mask/src/plugins/Web3Feed/locales/languages.ts deleted file mode 100644 index 143dc822172a..000000000000 --- a/packages/mask/src/plugins/Web3Feed/locales/languages.ts +++ /dev/null @@ -1,34 +0,0 @@ -// This file is auto generated. DO NOT EDIT -// Run `npx gulp sync-languages` to regenerate. -// Default fallback language in a family of languages are chosen by the alphabet order -// To overwrite this, please overwrite packages/scripts/src/locale-kit-next/index.ts -import en_US from './en-US.json' -import ja_JP from './ja-JP.json' -import ko_KR from './ko-KR.json' -import qya_AA from './qya-AA.json' -import zh_CN from './zh-CN.json' -import zh_TW from './zh-TW.json' -export const languages = { - en: en_US, - ja: ja_JP, - ko: ko_KR, - qy: qya_AA, - 'zh-CN': zh_CN, - zh: zh_TW, -} -// @ts-ignore -if (import.meta.webpackHot) { - // @ts-ignore - import.meta.webpackHot.accept( - ['./en-US.json', './ja-JP.json', './ko-KR.json', './qya-AA.json', './zh-CN.json', './zh-TW.json'], - () => - globalThis.dispatchEvent?.( - new CustomEvent('MASK_I18N_HMR', { - detail: [ - 'org.findtruman', - { en: en_US, ja: ja_JP, ko: ko_KR, qy: qya_AA, 'zh-CN': zh_CN, zh: zh_TW }, - ], - }), - ), - ) -} diff --git a/packages/mask/src/plugins/Web3Feed/locales/zh-CN.json b/packages/mask/src/plugins/Web3Feed/locales/zh-CN.json deleted file mode 100644 index 0967ef424bce..000000000000 --- a/packages/mask/src/plugins/Web3Feed/locales/zh-CN.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/packages/mask/src/plugins/Web3Feed/locales/zh-TW.json b/packages/mask/src/plugins/Web3Feed/locales/zh-TW.json deleted file mode 100644 index 0967ef424bce..000000000000 --- a/packages/mask/src/plugins/Web3Feed/locales/zh-TW.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/packages/mask/src/tsconfig.json b/packages/mask/src/tsconfig.json index 40eacb07444b..fd9627fe22ca 100644 --- a/packages/mask/src/tsconfig.json +++ b/packages/mask/src/tsconfig.json @@ -31,13 +31,6 @@ { "path": "../../plugins/Wallet" }, { "path": "../../plugins/DAO" }, { "path": "../../plugins/FileService" }, - { "path": "../../plugins/RSS3" }, - { "path": "../../plugins/Web3Profile" }, - { "path": "../../plugins/example" }, - { "path": "../../plugins/Debugger" }, - { "path": "../../plugins/CyberConnect" }, - { "path": "../../plugins/CrossChainBridge" }, - { "path": "../../plugins/GoPlusSecurity" }, { "path": "../../plugins/EVM" }, { "path": "../../plugins/Flow" }, { "path": "../../plugins/Solana" }, diff --git a/packages/plugin-infra/src/types.ts b/packages/plugin-infra/src/types.ts index c8387a3f3bdf..de1241da56ee 100644 --- a/packages/plugin-infra/src/types.ts +++ b/packages/plugin-infra/src/types.ts @@ -593,14 +593,14 @@ export namespace Plugin.SNSAdaptor { TabContent: InjectUI<{ identity?: SocialIdentity persona?: string - socialAddress?: SocialAddress + socialAddressList?: Array> }> } Utils?: { /** * If it returns false, this tab will not be displayed. */ - shouldDisplay?(identity?: SocialIdentity, addressName?: SocialAddress): boolean + shouldDisplay?(identity?: SocialIdentity, addressNames?: Array>): boolean /** * Filter social address. */ @@ -960,7 +960,6 @@ export enum PluginId { Referral = 'com.maskbook.referral', Web3Profile = 'io.mask.web3-profile', ScamSniffer = 'io.scamsniffer.mask-plugin', - Web3Feed = 'io.mask.web3-feed', // @masknet/scripts: insert-here } /** diff --git a/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/Common.tsx b/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/Common.tsx index c9263481a078..403cd516e158 100644 --- a/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/Common.tsx +++ b/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/Common.tsx @@ -15,7 +15,7 @@ export enum SecurityMessageLevel { Safe = 'Safe', } -export const Center = memo(({ children }: { children: ReactNode }) => ( +export const Center = memo(({ children }) => ( {children} diff --git a/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/SecurityPanel.tsx b/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/SecurityPanel.tsx index 7b0b595440be..12a067f6c7d9 100644 --- a/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/SecurityPanel.tsx +++ b/packages/plugins/GoPlusSecurity/src/SNSAdaptor/components/SecurityPanel.tsx @@ -13,7 +13,6 @@ import type { TokenAPI } from '@masknet/web3-providers' import { DefaultTokenIcon, LinkOutIcon } from '@masknet/icons' import type { ChainId, SchemaType } from '@masknet/web3-shared-evm' import { formatCurrency, FungibleToken } from '@masknet/web3-shared-base' -import type { SecurityMessage } from '../rules' interface TokenCardProps { tokenSecurity: TokenSecurity @@ -210,7 +209,7 @@ export const SecurityPanel = memo(({ tokenSecurity, tokenInfo, t {makeMessageList.map((x, i) => ( - + ))} {(!makeMessageList.length || securityMessageLevel === SecurityMessageLevel.Safe) && ( ({ + button: { + border: `1px solid ${theme.palette.text.primary} !important`, + color: `${theme.palette.text.primary} !important`, + borderRadius: 4, + background: 'transparent', + '&:hover': { + background: 'rgba(15, 20, 25, 0.1)', + }, + }, +})) export enum TabCardType { Donation = 1, @@ -16,17 +34,30 @@ export enum TabCardType { export interface TabCardProps { persona?: string type: TabCardType - socialAddress?: SocialAddress + socialAddressList?: Array> } -export function TabCard({ type, socialAddress, persona }: TabCardProps) { +export function TabCard({ type, socialAddressList, persona }: TabCardProps) { + const t = useI18N() + const { classes } = useStyles() + + const [selectedAddress, setSelectedAddress] = useState(first(socialAddressList)) + const { value: donations = EMPTY_LIST, loading: loadingDonations } = useDonations( - formatEthereumAddress(socialAddress?.address ?? ZERO_ADDRESS), + formatEthereumAddress(selectedAddress?.address ?? ZERO_ADDRESS), ) const { value: footprints = EMPTY_LIST, loading: loadingFootprints } = useFootprints( - formatEthereumAddress(socialAddress?.address ?? ZERO_ADDRESS), + formatEthereumAddress(selectedAddress?.address ?? ZERO_ADDRESS), ) const currentVisitingProfile = useCurrentVisitingProfile() + const [anchorEl, setAnchorEl] = useState(null) + + const onOpen = (event: React.MouseEvent) => setAnchorEl(event.currentTarget) + const onClose = () => setAnchorEl(null) + const onSelect = (option: SocialAddress) => { + setSelectedAddress(option) + onClose() + } const { value: kvValue } = useKV(persona) const unHiddenDonations = useCollectionFilter( @@ -34,31 +65,92 @@ export function TabCard({ type, socialAddress, persona }: TabCardProps) { donations, CollectionType.Donations, currentVisitingProfile, - socialAddress, + selectedAddress, ) const unHiddenFootprints = useCollectionFilter( (kvValue as KVType)?.proofs, footprints, CollectionType.Footprints, currentVisitingProfile, - socialAddress, + selectedAddress, ) - if (!socialAddress) return null + if (!selectedAddress) return null const isDonation = type === TabCardType.Donation - return isDonation ? ( - - ) : ( - + const summary = + isDonation && !loadingDonations ? ( + + {t.total_grants({ + count: donations.length.toString(), + })} + + ) : null + + return ( + <> + +
+
{summary}
+
+ + setAnchorEl(null)}> + {uniqBy(socialAddressList ?? [], (x) => x.address.toLowerCase()).map((x) => { + return ( + onSelect(x)}> + {x?.type === SocialAddressType.KV || x?.type === SocialAddressType.ADDRESS ? ( + + ) : ( + x.label + )} + + ) + })} + +
+
+ {isDonation ? ( + + ) : ( + + )} + ) } diff --git a/packages/plugins/RSS3/src/SNSAdaptor/components/DonationCard.tsx b/packages/plugins/RSS3/src/SNSAdaptor/components/DonationCard.tsx index 6c25db404fec..b012d9304989 100644 --- a/packages/plugins/RSS3/src/SNSAdaptor/components/DonationCard.tsx +++ b/packages/plugins/RSS3/src/SNSAdaptor/components/DonationCard.tsx @@ -1,18 +1,17 @@ -import { useReverseAddress, useWeb3State } from '@masknet/plugin-infra/web3' -import { makeStyles } from '@masknet/theme' -import type { RSS3BaseAPI } from '@masknet/web3-providers' -import type { NetworkPluginID, SocialAddress } from '@masknet/web3-shared-base' +import { makeStyles, MaskColorVar } from '@masknet/theme' import { Typography } from '@mui/material' import classnames from 'classnames' -import formatDateTime from 'date-fns/format' -import type { HTMLProps } from 'react' -import { RSS3_DEFAULT_IMAGE } from '../../constants' +import { HTMLProps, Fragment } from 'react' import { useI18N } from '../../locales' export interface DonationCardProps extends HTMLProps { - donation: RSS3BaseAPI.Donation - address: SocialAddress - onSelect: () => void + imageUrl: string + name: string + contribCount: number + contribDetails: Array<{ + token: string + amount: string + }> } const useStyles = makeStyles()((theme) => ({ @@ -20,81 +19,85 @@ const useStyles = makeStyles()((theme) => ({ borderRadius: 8, display: 'flex', flexDirection: 'row', + backgroundColor: MaskColorVar.twitterBg, + padding: theme.spacing(1), flexGrow: 1, alignItems: 'stretch', - padding: 3, - cursor: 'pointer', }, cover: { flexShrink: 1, - height: 126, - width: 126, + height: 90, + width: 90, borderRadius: 8, objectFit: 'cover', }, - date: { - color: theme.palette.maskColor.main, - fontSize: 14, - fontWeight: 400, + title: { + color: theme.palette.text.primary, + fontSize: 16, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', }, info: { - marginTop: 15, - marginLeft: '12px', + flexGrow: 1, + marginLeft: theme.spacing(1), fontSize: 16, + display: 'flex', + overflow: 'hidden', + flexDirection: 'column', + justifyContent: 'space-around', + fontFamily: '-apple-system,system-ui,sans-serif', }, infoRow: { - marginBottom: 8, + whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', }, - activity: { - fontSize: 14, - fontWeight: 400, - fontColor: theme.palette.maskColor.main, + infoLabel: { + color: theme.palette.text.primary, }, - fontColor: { - color: theme.palette.maskColor.primary, + infoValue: { + color: theme.palette.text.secondary, }, })) -export const DonationCard = ({ donation, address, onSelect, className, ...rest }: DonationCardProps) => { +export const DonationCard = ({ + imageUrl, + name, + contribCount, + contribDetails, + className, + ...rest +}: DonationCardProps) => { const { classes } = useStyles() const t = useI18N() - const { value: domain } = useReverseAddress(address.networkSupporterPluginID, address.address) - const { Others } = useWeb3State(address.networkSupporterPluginID) - const reversedAddress = - !domain || !Others?.formatDomainName - ? Others?.formatAddress?.(address.address, 5) ?? address.address - : Others.formatDomainName(domain) - - const date = donation.detail?.txs?.[0] - ? formatDateTime(new Date(Number(donation.detail?.txs?.[0]?.timeStamp) * 1000), 'MMM dd, yyyy') - : '--' return ( -
- {donation.detail?.grant?.title -
-
- - {date} - -
-
- - {reversedAddress} {t.contributed()}{' '} - {donation.detail?.txs?.[0]?.formatedAmount} - {donation.detail?.txs?.[0]?.symbol} {t.to()}{' '} - {donation.detail?.grant?.title} +
+ {name} +
+
+ + {name} -
-
+ +
+ {contribCount} + {t.contribution({ count: contribCount })} +
+
+ {contribDetails.map((contrib, i) => ( + + {contrib.amount} + {contrib.token} + + ))} +
+
) } diff --git a/packages/plugins/RSS3/src/SNSAdaptor/components/FootprintCard.tsx b/packages/plugins/RSS3/src/SNSAdaptor/components/FootprintCard.tsx index 29cbc20d8e4b..98a6f16245fc 100644 --- a/packages/plugins/RSS3/src/SNSAdaptor/components/FootprintCard.tsx +++ b/packages/plugins/RSS3/src/SNSAdaptor/components/FootprintCard.tsx @@ -1,68 +1,65 @@ import { Typography } from '@mui/material' +import EventRoundedIcon from '@mui/icons-material/EventRounded' +import LocationOnRoundedIcon from '@mui/icons-material/LocationOnRounded' import fromUnixTime from 'date-fns/fromUnixTime' -import formatDateTime from 'date-fns/format' -import { makeStyles } from '@masknet/theme' +import { ImageHolder } from './ImageHolder' import { useI18N } from '../../locales' -import { RSS3_DEFAULT_IMAGE } from '../../constants' -import type { RSS3BaseAPI } from '@masknet/web3-providers' - -const useStyles = makeStyles()((theme) => ({ - card: { - display: 'flex', - padding: 3, - marginBottom: 16, - cursor: 'pointer', - }, - cover: { - flexShrink: 1, - height: 126, - width: 126, - borderRadius: 8, - objectFit: 'cover', - }, - content: { - marginLeft: 12, - marginTop: 15, - }, - infoRow: { - marginBottom: 8, - fontSize: 14, - fontWeight: 400, - fontColor: theme.palette.maskColor.main, - }, -})) const formatDate = (ts: string): string => { return fromUnixTime(Number.parseInt(ts, 16)).toLocaleDateString('en-US') } export interface FootprintProps { + imageUrl: string + startDate: string | undefined + endDate: string | undefined + city: string | undefined + country: string | undefined username: string - footprint: RSS3BaseAPI.Footprint - onSelect: () => void + activity: string } -export const FootprintCard = ({ footprint, onSelect }: FootprintProps) => { +export const FootprintCard = ({ imageUrl, startDate, endDate, city, country, activity }: FootprintProps) => { const t = useI18N() - const { classes } = useStyles() + // Calc display date + let displayDate: string + if (startDate && endDate) { + displayDate = formatDate(startDate) + if (endDate !== startDate) { + displayDate += ` ~ ${formatDate(endDate)}` + } + } else { + displayDate = t.no_activity_time() + } - const date = footprint.detail?.end_date - ? formatDateTime(new Date(footprint.detail?.end_date), 'MMM dd, yyyy') - : t.no_activity_time() - const location = footprint.detail.city || footprint.detail.country || 'Metaverse' + // Calc location + const location = city || country || 'Metaverse' return ( -
+
- {t.inactive_project()} +
-
- {date} - @ {location} - {footprint.detail?.name || ''} +
+
+ + + {displayDate} + +
+
+ + + {location} + +
+
+ + {t.attended()} + + + {activity} + +
) diff --git a/packages/plugins/RSS3/src/SNSAdaptor/components/StatusBox.tsx b/packages/plugins/RSS3/src/SNSAdaptor/components/StatusBox.tsx index 799221f4975a..ddf44b0daf33 100644 --- a/packages/plugins/RSS3/src/SNSAdaptor/components/StatusBox.tsx +++ b/packages/plugins/RSS3/src/SNSAdaptor/components/StatusBox.tsx @@ -6,7 +6,6 @@ import { useI18N } from '../../locales' interface Props { loading?: boolean empty?: boolean - collection?: string } const useStyles = makeStyles()((theme) => ({ @@ -18,7 +17,7 @@ const useStyles = makeStyles()((theme) => ({ }, })) -export const StatusBox: FC = ({ loading, empty, collection = 'Donation' }) => { +export const StatusBox: FC = ({ loading, empty }) => { const { classes } = useStyles() const t = useI18N() if (loading) { @@ -32,7 +31,7 @@ export const StatusBox: FC = ({ loading, empty, collection = 'Donation' } if (empty) { return ( - {t.no_data({ collection })} + {t.no_data()} ) } diff --git a/packages/plugins/RSS3/src/SNSAdaptor/hooks/useCollectionFilter.ts b/packages/plugins/RSS3/src/SNSAdaptor/hooks/useCollectionFilter.ts index acd02b370fba..e47b9be71ea2 100644 --- a/packages/plugins/RSS3/src/SNSAdaptor/hooks/useCollectionFilter.ts +++ b/packages/plugins/RSS3/src/SNSAdaptor/hooks/useCollectionFilter.ts @@ -1,13 +1,12 @@ import { IdentityResolved, PluginId } from '@masknet/plugin-infra' import { NextIDPlatform } from '@masknet/shared-base' -import type { RSS3BaseAPI } from '@masknet/web3-providers' import type { NetworkPluginID, SocialAddress } from '@masknet/web3-shared-base' import { useMemo } from 'react' -import { CollectionType, Proof } from '../../types' +import type { CollectionType, GeneralAsset, Proof } from '../../types' export const useCollectionFilter = ( hiddenInfo: Proof[], - collections: RSS3BaseAPI.Donation[] | RSS3BaseAPI.Footprint[], + collections: GeneralAsset[], type: CollectionType, currentVisitingProfile?: IdentityResolved, address?: SocialAddress, @@ -22,13 +21,6 @@ export const useCollectionFilter = ( ) const hiddenList = proof?.content?.[PluginId.Web3Profile]?.unListedCollections?.[address?.address?.toLowerCase()]?.[type] ?? [] - if (type === CollectionType.Donations) { - return (collections as RSS3BaseAPI.Donation[])?.filter( - (collection: { id: string }) => hiddenList?.findIndex((url) => url === collection?.id) === -1, - ) - } - return (collections as RSS3BaseAPI.Footprint[])?.filter( - (collection: { id: string }) => hiddenList?.findIndex((url) => url === collection?.id) === -1, - ) + return collections?.filter((collection) => hiddenList?.findIndex((url) => url === collection?.id) === -1) }, [address, currentVisitingProfile?.identifier?.userId, type, hiddenInfo?.length, collections?.length]) } diff --git a/packages/plugins/RSS3/src/SNSAdaptor/hooks/useDonations.ts b/packages/plugins/RSS3/src/SNSAdaptor/hooks/useDonations.ts index 196afd5738e7..8f94c6bc52ba 100644 --- a/packages/plugins/RSS3/src/SNSAdaptor/hooks/useDonations.ts +++ b/packages/plugins/RSS3/src/SNSAdaptor/hooks/useDonations.ts @@ -1,10 +1,12 @@ import { useAsync } from 'react-use' import type { AsyncState } from 'react-use/lib/useAsync' -import { RSS3, RSS3BaseAPI } from '@masknet/web3-providers' +import { EMPTY_LIST } from '@masknet/shared-base' +import { PluginProfileRPC } from '../../messages' +import type { GeneralAsset } from '../../types' -export function useDonations(address: string): AsyncState { +export function useDonations(address: string): AsyncState { return useAsync(async () => { - const response = await RSS3.getDonations(address) - return response + const response = await PluginProfileRPC.getDonations(address) + return response.status ? response.assets : EMPTY_LIST }, [address]) } diff --git a/packages/plugins/RSS3/src/SNSAdaptor/hooks/useFootprints.ts b/packages/plugins/RSS3/src/SNSAdaptor/hooks/useFootprints.ts index ed0776223d0c..587db827ed99 100644 --- a/packages/plugins/RSS3/src/SNSAdaptor/hooks/useFootprints.ts +++ b/packages/plugins/RSS3/src/SNSAdaptor/hooks/useFootprints.ts @@ -1,10 +1,11 @@ -import { RSS3, RSS3BaseAPI } from '@masknet/web3-providers' import { useAsync } from 'react-use' import type { AsyncState } from 'react-use/lib/useAsync' +import { PluginProfileRPC } from '../../messages' +import type { GeneralAsset } from '../../types' -export function useFootprints(address: string): AsyncState { +export function useFootprints(address: string): AsyncState { return useAsync(async () => { - const response = await RSS3.getFootprints(address) - return response ?? [] + const response = await PluginProfileRPC.getFootprints(address) + return response.status ? response.assets : [] }, [address]) } diff --git a/packages/plugins/RSS3/src/SNSAdaptor/index.tsx b/packages/plugins/RSS3/src/SNSAdaptor/index.tsx index bb5b20b125d6..1d3e40b7a429 100644 --- a/packages/plugins/RSS3/src/SNSAdaptor/index.tsx +++ b/packages/plugins/RSS3/src/SNSAdaptor/index.tsx @@ -1,12 +1,18 @@ import type { Plugin } from '@masknet/plugin-infra' -import { NetworkPluginID, SocialAddress, SocialIdentity } from '@masknet/web3-shared-base' +import { NetworkPluginID, SocialAddress, SocialAddressType, SocialIdentity } from '@masknet/web3-shared-base' import { base } from '../base' import { PLUGIN_ID } from '../constants' import { setupContext } from './context' import { TabCard, TabCardType } from './TabCard' -function shouldDisplay(identity?: SocialIdentity, addressName?: SocialAddress) { - return addressName?.networkSupporterPluginID === NetworkPluginID.PLUGIN_EVM +function sorter(a: SocialAddress, z: SocialAddress) { + if (a.type === SocialAddressType.RSS3) return -1 + if (z.type === SocialAddressType.RSS3) return 1 + return 0 +} + +function shouldDisplay(identity?: SocialIdentity, addressNames?: Array>) { + return !!addressNames?.some((x) => x.networkSupporterPluginID === NetworkPluginID.PLUGIN_EVM) } const sns: Plugin.SNSAdaptor.Definition = { @@ -20,11 +26,14 @@ const sns: Plugin.SNSAdaptor.Definition = { label: 'Donations', priority: 1, UI: { - TabContent: ({ socialAddress, persona }) => { - return + TabContent: ({ socialAddressList = [], persona }) => { + return ( + + ) }, }, Utils: { + sorter, shouldDisplay, }, }, @@ -33,11 +42,14 @@ const sns: Plugin.SNSAdaptor.Definition = { label: 'Footprints', priority: 2, UI: { - TabContent: ({ socialAddress, persona }) => { - return + TabContent: ({ socialAddressList = [], persona }) => { + return ( + + ) }, }, Utils: { + sorter, shouldDisplay, }, }, diff --git a/packages/plugins/RSS3/src/SNSAdaptor/pages/DonationsPage.tsx b/packages/plugins/RSS3/src/SNSAdaptor/pages/DonationsPage.tsx index a3c233511887..4ac47ed9d81e 100644 --- a/packages/plugins/RSS3/src/SNSAdaptor/pages/DonationsPage.tsx +++ b/packages/plugins/RSS3/src/SNSAdaptor/pages/DonationsPage.tsx @@ -1,12 +1,21 @@ -import { CollectionDetailCard } from '@masknet/shared' import { makeStyles } from '@masknet/theme' -import type { RSS3BaseAPI } from '@masknet/web3-providers' -import type { NetworkPluginID, SocialAddress } from '@masknet/web3-shared-base' -import { Box, List, ListItem } from '@mui/material' -import { useState } from 'react' +import { List, ListItem } from '@mui/material' +import urlcat from 'urlcat' +import { RSS3_DEFAULT_IMAGE } from '../../constants' import { useI18N } from '../../locales' +import type { GeneralAsset, GeneralAssetWithTags } from '../../types' import { DonationCard, StatusBox } from '../components' +const getDonationLink = (label: string, donation: GeneralAssetWithTags) => { + const { platform, identity, id, type } = donation + return urlcat(`https://${label}.bio/singlegitcoin/:platform/:identity/:id/:type`, { + platform, + identity, + id, + type: type.replaceAll('-', '.'), + }) +} + const useStyles = makeStyles()((theme) => ({ statusBox: { display: 'flex', @@ -16,7 +25,7 @@ const useStyles = makeStyles()((theme) => ({ }, list: { display: 'grid', - gridTemplateColumns: 'repeat(1, 1fr)', + gridTemplateColumns: 'repeat(2, 1fr)', gridGap: theme.spacing(2), }, listItem: { @@ -39,43 +48,31 @@ const useStyles = makeStyles()((theme) => ({ })) export interface DonationPageProps { - donations?: RSS3BaseAPI.Donation[] + donations?: GeneralAsset[] loading?: boolean - address: SocialAddress + addressLabel: string } -export function DonationPage({ donations = [], loading, address }: DonationPageProps) { +export function DonationPage({ donations = [], loading, addressLabel }: DonationPageProps) { const { classes } = useStyles() const t = useI18N() - const [selectedDonation, setSelectedDonation] = useState() - if (loading || !donations.length) { - return + return } return ( - - - {donations.map((donation) => ( - - setSelectedDonation(donation)} - className={classes.donationCard} - donation={donation} - address={address} - /> - - ))} - - setSelectedDonation(undefined)} - img={selectedDonation?.detail?.grant?.logo} - title={selectedDonation?.detail?.grant?.title} - referenceUrl={selectedDonation?.detail?.grant?.reference_url} - description={selectedDonation?.detail?.grant?.description} - contributions={selectedDonation?.detail?.txs} - /> - + + {donations.map((donation) => ( + + + + ))} + ) } diff --git a/packages/plugins/RSS3/src/SNSAdaptor/pages/FootprintPage.tsx b/packages/plugins/RSS3/src/SNSAdaptor/pages/FootprintPage.tsx index 4fafdb2009ee..a3c70b2b3b0d 100644 --- a/packages/plugins/RSS3/src/SNSAdaptor/pages/FootprintPage.tsx +++ b/packages/plugins/RSS3/src/SNSAdaptor/pages/FootprintPage.tsx @@ -1,49 +1,61 @@ -import { CollectionDetailCard } from '@masknet/shared' -import type { RSS3BaseAPI } from '@masknet/web3-providers' -import type { NetworkPluginID, SocialAddress } from '@masknet/web3-shared-base' -import { Box } from '@mui/material' -import { useState } from 'react' +import { makeStyles } from '@masknet/theme' +import urlcat from 'urlcat' +import { RSS3_DEFAULT_IMAGE } from '../../constants' +import type { GeneralAsset, GeneralAssetWithTags } from '../../types' import { FootprintCard, StatusBox } from '../components' import { useRss3Profile } from '../hooks' +const useStyles = makeStyles()((theme) => ({ + address: { + color: theme.palette.primary.main, + }, + link: { + '&:hover': { + textDecoration: 'none', + }, + }, +})) + +const getFootprintLink = (label: string, footprint: GeneralAssetWithTags) => { + const { platform, identity, id, type } = footprint + return urlcat(`https://${label}.bio/singlefootprint/:platform/:identity/:id/:type`, { + platform, + identity, + id, + type: type.replaceAll('-', '.'), + }) +} + export interface FootprintPageProps { - footprints?: RSS3BaseAPI.Footprint[] + footprints?: GeneralAsset[] loading?: boolean - address: SocialAddress + addressLabel: string + address?: string } -export function FootprintPage({ footprints = [], address, loading }: FootprintPageProps) { - const { value: profile } = useRss3Profile(address.address || '') +export function FootprintPage({ footprints = [], address, loading, addressLabel }: FootprintPageProps) { + const { classes } = useStyles() + const { value: profile } = useRss3Profile(address || '') const username = profile?.name - const [selectedFootprint, setSelectedFootprint] = useState() - if (loading || !footprints.length) { - return + return } return ( - -
- {footprints.map((footprint) => ( - setSelectedFootprint(footprint)} - username={username ?? ''} - footprint={footprint} - /> - ))} -
- setSelectedFootprint(undefined)} - img={selectedFootprint?.detail?.image_url} - title={selectedFootprint?.detail?.name} - referenceUrl={selectedFootprint?.detail?.event_url} - description={selectedFootprint?.detail?.description} - date={selectedFootprint?.detail?.end_date} - location={selectedFootprint?.detail?.city || selectedFootprint?.detail?.country || 'Metaverse'} - /> -
+
+ {footprints.map((footprint) => ( + + ))} +
) } diff --git a/packages/plugins/RSS3/src/locales/en-US.json b/packages/plugins/RSS3/src/locales/en-US.json index 38525dd9adba..757d0d9437f0 100644 --- a/packages/plugins/RSS3/src/locales/en-US.json +++ b/packages/plugins/RSS3/src/locales/en-US.json @@ -2,10 +2,8 @@ "inactive_project": "Inactive Project", "no_activity_time": "No activity time", "attended": "attended", - "no_data": "No {{collection}} at the current address", + "no_data": "No data", "total_grants": "Total {{count}} Grants", "contribution": "Contribution", - "contribution_other": "Contributions", - "contributed": "contributed", - "to": "to" + "contribution_other": "Contributions" } diff --git a/packages/plugins/Web3Profile/src/SNSAdaptor/components/CollectionList.tsx b/packages/plugins/Web3Profile/src/SNSAdaptor/components/CollectionList.tsx index a8bf874f0925..0c174f22ff1c 100644 --- a/packages/plugins/Web3Profile/src/SNSAdaptor/components/CollectionList.tsx +++ b/packages/plugins/Web3Profile/src/SNSAdaptor/components/CollectionList.tsx @@ -11,10 +11,9 @@ interface CollectionListProps extends withClasses void size?: number - showNetwork?: boolean } export function CollectionList(props: CollectionListProps) { - const { collections, onList, size = 64, showNetwork = false } = props + const { collections, onList, size = 64 } = props const classes = useStylesExtends(useStyles(), props) return ( @@ -25,14 +24,13 @@ export function CollectionList(props: CollectionListProps) { className={classes.collectionWrap} onClick={() => onList?.(collection.key)}> ({ flexDirection: 'column', '::-webkit-scrollbar': { backgroundColor: 'transparent', - width: 5, + width: 20, }, '::-webkit-scrollbar-thumb': { borderRadius: '20px', diff --git a/packages/plugins/Web3Profile/src/SNSAdaptor/components/WalletAssets.tsx b/packages/plugins/Web3Profile/src/SNSAdaptor/components/WalletAssets.tsx index 95e4c84481a8..8d40f343fb80 100644 --- a/packages/plugins/Web3Profile/src/SNSAdaptor/components/WalletAssets.tsx +++ b/packages/plugins/Web3Profile/src/SNSAdaptor/components/WalletAssets.tsx @@ -1,5 +1,5 @@ import { Card, Typography, Link, Box } from '@mui/material' -import { Edit2Icon, LinkOutIcon, DoubleArrowUp } from '@masknet/icons' +import { Edit2Icon, LinkOutIcon } from '@masknet/icons' import { makeStyles, useStylesExtends } from '@masknet/theme' import { useI18N } from '../../locales' import { ImageIcon } from './ImageIcon' @@ -9,7 +9,6 @@ import { ChainId, explorerResolver, NETWORK_DESCRIPTORS } from '@masknet/web3-sh import { NetworkPluginID } from '@masknet/web3-shared-base' import { Empty } from './Empty' import { CollectionList } from './CollectionList' -import { useMemo, useState } from 'react' const useStyles = makeStyles()((theme) => { return { @@ -33,14 +32,10 @@ const useStyles = makeStyles()((theme) => { display: 'flex', // overflow: 'hidden', padding: 0, - width: 126, - height: 126, + flexDirection: 'column', borderRadius: 12, userSelect: 'none', lineHeight: 0, - '&:nth-last-child(-n+4)': { - marginBottom: 0, - }, }, link: { cursor: 'pointer', @@ -67,38 +62,17 @@ const useStyles = makeStyles()((theme) => { }, list: { gridRowGap: 16, - gridColumnGap: 20, + gridColumnGap: 14, display: 'grid', justifyItems: 'center', gridTemplateColumns: 'repeat(4, 1fr)', + paddingBottom: '20px', }, listBox: { display: 'flex', flexWrap: 'wrap', - minHeight: 298, - justifyContent: 'center', - }, - loadIcon: { - width: 82, - height: 32, - borderRadius: 99, - display: 'flex', - justifyContent: 'center', - alignItems: 'center', - backgroundColor: theme.palette.maskColor.thirdMain, - fontSize: 12, - fontWeight: 700, - marginTop: 4, - cursor: 'pointer', - }, - arrowUp: { - cursor: 'pointer', - color: theme.palette.maskColor.second, - marginRight: 10, - }, - rightIcons: { - display: 'flex', - alignItems: 'center', + height: 298, + overflow: 'hidden', }, } }) @@ -110,49 +84,15 @@ export interface WalletAssetsCardProps extends withClasses { collectionList?: CollectionTypes[] } -const enum LOAD_STATUS { - 'Unnecessary' = 1, - 'Necessary' = 2, - 'Finish' = 3, -} - export function WalletAssetsCard(props: WalletAssetsCardProps) { const { address, onSetting, collectionList } = props const t = useI18N() const classes = useStylesExtends(useStyles(), props) const chainId = ChainId.Mainnet - - const [loadStatus, setLoadStatus] = useState( - collectionList && collectionList?.filter((collection) => !collection?.hidden)?.length > 8 - ? LOAD_STATUS.Necessary - : LOAD_STATUS.Unnecessary, - ) - const { Others } = useWeb3State(address?.platform ?? NetworkPluginID.PLUGIN_EVM) const iconURL = NETWORK_DESCRIPTORS.find((network) => network?.chainId === ChainId.Mainnet)?.icon - const collections = useMemo(() => { - const filterCollections = collectionList?.filter((collection) => !collection?.hidden) - if (!filterCollections || filterCollections?.length === 0) { - return [] - } - if (filterCollections?.length > 8 && loadStatus !== LOAD_STATUS.Finish) { - return filterCollections?.slice(0, 8) - } - return filterCollections - }, [loadStatus, collectionList]) - - const loadIcon = useMemo(() => { - if (loadStatus === LOAD_STATUS.Necessary) - return ( - setLoadStatus(LOAD_STATUS.Finish)} className={classes.loadIcon}> - {t.load_more()} - - ) - return null - }, [loadStatus, setLoadStatus]) - const { value: domain } = useReverseAddress(NetworkPluginID.PLUGIN_EVM, address?.address) return ( @@ -171,16 +111,7 @@ export function WalletAssetsCard(props: WalletAssetsCardProps) {
-
- {loadStatus === LOAD_STATUS.Finish && ( - setLoadStatus(LOAD_STATUS.Necessary)} - /> - )} - -
+
{collectionList && collectionList?.filter((collection) => !collection?.hidden)?.length > 0 ? ( @@ -188,10 +119,8 @@ export function WalletAssetsCard(props: WalletAssetsCardProps) { !collection?.hidden)?.slice(0, 8)} /> - {loadIcon} ) : ( diff --git a/packages/plugins/Web3Profile/src/SNSAdaptor/index.tsx b/packages/plugins/Web3Profile/src/SNSAdaptor/index.tsx index 7b05193c71ee..fe8a8c066cd3 100644 --- a/packages/plugins/Web3Profile/src/SNSAdaptor/index.tsx +++ b/packages/plugins/Web3Profile/src/SNSAdaptor/index.tsx @@ -1,6 +1,6 @@ import type { Plugin } from '@masknet/plugin-infra' import { ApplicationEntry } from '@masknet/shared' -import { Web3Profile } from '@masknet/icons' +import { Web3ProfileIcon } from '@masknet/icons' import { base } from '../base' import { Web3ProfileDialog } from './components/Web3ProfileDialog' import { setupContext } from './context' @@ -18,7 +18,7 @@ const sns: Plugin.SNSAdaptor.Definition = { }, ApplicationEntries: [ (() => { - const icon = + const icon = const name = { i18nKey: '__plugin_name', fallback: 'Web3 Profile' } const recommendFeature = { description: , diff --git a/packages/plugins/Web3Profile/src/SNSAdaptor/types.ts b/packages/plugins/Web3Profile/src/SNSAdaptor/types.ts index 7df32ca76cba..80c6e4464e92 100644 --- a/packages/plugins/Web3Profile/src/SNSAdaptor/types.ts +++ b/packages/plugins/Web3Profile/src/SNSAdaptor/types.ts @@ -1,6 +1,5 @@ import type { BindingProof, NextIDPlatform, ProfileInformation } from '@masknet/shared-base' import type { NetworkPluginID } from '@masknet/web3-shared-base' -import type { ChainId } from '@masknet/web3-shared-evm' export interface GeneralAsset { platform: string @@ -54,7 +53,6 @@ export interface CollectionTypes { iconURL?: string hidden?: boolean name?: string - chainId?: ChainId } export interface Collection { diff --git a/packages/plugins/Web3Profile/src/SNSAdaptor/utils.ts b/packages/plugins/Web3Profile/src/SNSAdaptor/utils.ts index e2111d02ca17..d5d6b05aac12 100644 --- a/packages/plugins/Web3Profile/src/SNSAdaptor/utils.ts +++ b/packages/plugins/Web3Profile/src/SNSAdaptor/utils.ts @@ -192,7 +192,6 @@ export const getNFTList = async (walletList: WalletTypes[]) => { tokenId: asset.tokenId, iconURL: asset?.metadata?.imageURL, name: asset?.metadata?.name, - chainId: ChainId.Mainnet, })), } } else { @@ -219,7 +218,6 @@ export const getNFTList_Polygon = async (walletList: WalletTypes[]) => { tokenId: asset.tokenId, iconURL: asset?.metadata?.imageURL, name: asset?.metadata?.name, - chainId: ChainId.Matic, })), } } else { diff --git a/packages/plugins/Web3Profile/src/locales/en-US.json b/packages/plugins/Web3Profile/src/locales/en-US.json index ed19267b6d46..f2adcfa8b843 100644 --- a/packages/plugins/Web3Profile/src/locales/en-US.json +++ b/packages/plugins/Web3Profile/src/locales/en-US.json @@ -53,6 +53,5 @@ "wallet_setting_hint": "Toggle the button to manage wallet display settings.", "no_authenticated_wallet": "That hasn't been authenticated yet.", "no_items_found": "No Items found.", - "account_empty": "Please verify this persona to set your Web3 profile.", - "load_more": "load more" + "account_empty": "Please verify this persona to set your Web3 profile." } diff --git a/packages/shared/src/UI/components/AssetPlayer/index.tsx b/packages/shared/src/UI/components/AssetPlayer/index.tsx index 25b952719be6..8b28e14476a1 100644 --- a/packages/shared/src/UI/components/AssetPlayer/index.tsx +++ b/packages/shared/src/UI/components/AssetPlayer/index.tsx @@ -38,7 +38,6 @@ interface AssetPlayerProps fallbackResourceLoader?: JSX.Element setERC721TokenName?: (name: string) => void setSourceType?: (type: string) => void - showNetwork?: boolean } const useStyles = makeStyles()({ hidden: { @@ -56,7 +55,7 @@ enum AssetPlayerState { export const AssetPlayer = memo((props) => { const ref = useRef(null) - const { url, type, options, iconProps, isFixedIframeSize = true, showNetwork = false } = props + const { url, type, options, iconProps, isFixedIframeSize = true } = props const classes = useStylesExtends(useStyles(), props) const [hidden, setHidden] = useState(Boolean(props.renderTimeout)) const { RPC_URLS } = getRPCConstants(props.erc721Token?.chainId) @@ -189,7 +188,7 @@ export const AssetPlayer = memo((props) => { ) return ( - + <> ((props) => { : props.loadingIcon ?? } {IframeResizerMemo} - + ) }) diff --git a/packages/shared/src/UI/components/CollectionDetailCard/assets/etherscan.png b/packages/shared/src/UI/components/CollectionDetailCard/assets/etherscan.png deleted file mode 100644 index 7561d51c5f7fd55a8429b4e3128563e4d9ed6792..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4088 zcmV8yUV-;UsYfN3kOs#g<)!MuA3bLPKv=U0ut2_n!IVRW;Rn0S!36?|WZ$b=~Fs z?z#7zbI-kxaQvWPFeswYC<8D6;ISl@Keg)Y_deV*s;<6qRCCH6oUt?KYHj*5b1$t~ z5&=>OO+<0aQinVqYj<&xe`~)pdVe(eii;~2&6!x0&gfhpA{dNNG+L%Rm7-8#kEe1l z7?jayR0DvLgj<*W$G1M+`T4Yl#`x7uiR3WbHYM6Hj4@zlfK4Y-2oMp35Rj7Kvs6P# zY4OIseM(;+_w8XX-Fy3WJ8g&C^?58fCc>dmNQA>-05Hr&K zNOsyW0Aq|Hh7^G!9|oM+_rRf;0)Rx%lSQ^oDTEM8KsPrhOy%zCna}+CkLwrQ{^%klNfQyf zG8WcYm&i?D=;!_w#T5olb*LC?ulMsJ`W{$G-l?hm~*DHzqGNI&Bk?!YL*TxK>RFA&pMkd-oq6 zxA3m#-dekM?bo8wGTqhm?(m1K+cCEqcVdamXfloif;#cy9|sr?lT>H@ zeV=vZFa7K)BGMgM?{=d=}clG zON$f#a`SaV7hHdJRVWmqTo~G-z3}$!Bn6r6JHL3!aX3K4`ec)J2?Oc0jc1nMhM7|@ z@373o@fTy%@NXix@If$hb|_phKvI%vh^Kn}SLA=6P*P0azI}VkOcp?PDo3OG%31eL zO*A``**K>ps30Pw(>Bf;&>vGLT>`BQ97jWI)9P^?jnN}6z>o{iL31(i1bpq?OwaVo$yA0v-ul@cN{Tn4(K1#5%#7=Qbm7LzJ(sg_kd2djuv0>Fa|(U? zl;Fy-!{PC$ENO-m0=4yVeDLvh0D#x(@jygyv)h7k={}@Y|>F#eg&Wby)80cQ<0`oj-$S?rGCOL~v|}tn$BZnGWDF z!OYa0OieMy0jOuYBO+unHtxCYyBKh0KV)nN+L%_4<7iwtb~t8E9gBD@0V#UcIS3Mz z&ZKchzmk9Q`7Efi#s79*I%5xIHlP9%0)@gDhS#Iezi%m+8A=L>Hb%-}4Py)joY^0y z=QRu=Ni@frF=FVz5y@m`fZDgOdJMBDBGv{}xOH}IO#6IXTcgAPwANi(RUrhlKI(j2 z0WuP7+o96}KAtl1k`e%;RC78#+Kt=_%LxIle{>vIGp&p(5iBLMY1!5tcQ0JwL<*Ku z2-MZb@WjKnn*M!DWG3T`Qrgi&+>tLV*dQV_G&Z5+v|Q3iLVsv>qqZ9V|=X(BTGrXZ*!@_R%{49Er+^sK3x! z`wD3&=VJbG^k5if*tXpg)8?LBpnv%#L*cP3*Xo``y8W0JnR=el_XHZHalX1}0 zl*B{#FT|~ju5DRfBD-#x8EaO*fp|QQ;^JbXq!cNwP2fcM!4r*!#wPSC_TyJi-i-;D zkAOA?f&_@*E(_sX&6_vD@Atd)K!=r(R0Si>0-O$V3twFbArQJ}9sp#0ervKDH*UoH z@4W}V-|rqe3qgX!ULi?*LPP);9$J1Ckn^p^aEoWik=?X$Bg)@dnXpAT+AY*iy4NI*7$+eFDk?rgdHFjnWU~;=48PB}Ui2#U{}o23I!gVW3dp0}Ib|a# z5E0hB`xm^oZXJ9+Up`qDLXhJ)iQcF6`%t`p@y{!TlApMIJG*sq;vobAa4+TO(xb3|@cjRa8_|z}H%{0AM^G50p}yCrp{JM^KoICFC0<6u?~{CZ9+& zC)22{i{av-1M%<=7iFhv=jC%#xVE+yFRogJ%F0R<6&1Nj*EU6!Qc#w9jfhwQK%m&S zDqY`nKZxbY_Dmw1a~L-GJgoXn2-jYHscVqnYQ3HGc~f}Djve?*`C6pY8TkEvnD%4= zK&I1a=kNOV`yaqf*opOPp4t43Z{PRXK9*+kekEcVj%&dJrpU}ps=xb~7dI$Y$3n5n<1sJ@~^PR$|-ME%5n#5JGgBkQYKwadEFF zTfUZ;mumntW5T3WU}uLAQgmj#3UwE@@=Je4JRXO?sHnvqbpqq@c!ZtFY??iL_AAUx;c(bd02slb42R1y zgDzVbZcdq%1fhvY99b{OYRq)G$IT5$|30Ny9$JdAV}@YppmPfvq*UN=f1I7KeyPMgG4TJlHtV=!~|M zl8!bo#=y26`2AkI^4||*#L$5)QB9%39}Usm-#d5gz=jPUqo$??UauEY%5I5f>uSH> zFSRzS7cW^dId^9T$U9|-L?WCG*OvVJSAX8}>Y5LF#hVh``}EVOZ|@TH>r;a1Q!c}Z zp#xi7LRW(8Y@(pMLCKGjatVgdcJ0EZO&f9GzyT;JQB+jq&aMK;0$?d6wARg~r}w@M zZQM?)FU%~nmqF$M_+2`kalBrSYE!014!-iOE&!y{Y3!=3#MZ4_P*YO_DJ47}Pj~CI zqjv4$;$jPgf1WpQ{&V48S&qEyIOrtWc6U zqV;uk_;kmo*j2d;4Gr~>Qntjw1!^?EeW$p%*vi=U%EgP9JR1syR9RV>(~4sUl?Z_N z@eaPnCk#={T`LiOGN};N%3cD&Rv48&;NTpK9hJQz`(R{Lg zzh4<`DlQs6eB8?~znpsDfd{zlwWW3>h=`e)2M->cVdj|t-V#Dw1fbiK#hjq|YZ7@= zwz|3+yLW$%eN|P6#bO{Lcsw3ABs>O<=9BgLe2UrZEbZNU+Q^Y3n?s?H=;(%Rr;Cx9 z1rZr$J_EpN02cwU0a$IxQ5y~B5R1idpt>4WReMogU5$7w2Ez=?vW`oeZRE85e!ped z?DTs5lWw@-hN_(G9hL7?V_CA2hz>II1OO2LR{+oe1Z5ev5M@Rz9>?KBhfsZ>8h<-* z0CjbBNG6j20L!xA@p|(%?#H)JVfV_Q4g>-gv-!yH3rwFgXHIn_5|KpI>E+UH&265h zJpi5tutaN(rluwxYiyLYwY4~W_z-Gq>(JQPfK)2gl5$Z>K}gwhS><@OnJ1GLM6xIl zfYxT^+2@?I^olF4XliSbJ3_aHC`(olkquyJMMcG?-JgHC2QXA6@;$;gKE_@1bFV=NO7AWulJWCppNJNetIr0~WYwN}U z^m=J&sVpfe5niuXE2VVS;2n93rDwp*teII`mL-aciliWV-RJXC+($x;FvcLAP6Mtr&s|wOj+Z=;dk;!^yFPeJ>KW@k!{<#!#0yOE|j~L z+#x&nN6wWcB4Jq;EXzVFm13pjJ07q9`MGoFzDPt)e*Z@+`*FpHZH>eWFT5~J+v(|! zHj^CN8LBK*B#5B1ad1adJ@t1~3T5oW(#tX7(9l2yics5m5?2jUd`bLT;0aJ}NFQ qSwCymtR1 void - date?: string - location?: string - relatedURLs?: string[] - metadata?: RSS3BaseAPI.Metadata - traits?: Array<{ - type: string - value: string - }> -} -const useStyles = makeStyles()((theme) => ({ - img: { - flexShrink: 1, - height: '300px !important', - width: '300px !important', - borderRadius: 8, - objectFit: 'cover', - }, - loadingFailImage: { - minHeight: '0 !important', - maxWidth: 'none', - width: 300, - height: 300, - }, - flexItem: { - display: 'flex', - width: '100%', - justifyContent: 'center', - }, - dayBox: { - display: 'flex', - alignItems: 'center', - color: theme.palette.maskColor.highlight, - }, - linkBox: { - display: 'flex', - width: 36, - height: 36, - borderRadius: 12, - backgroundColor: theme.palette.maskColor.highlight, - justifyContent: 'center', - alignItems: 'center', - marginLeft: 24, - }, - link: { - color: theme.palette.maskColor.highlight, - }, - txItem: { - display: 'flex', - justifyContent: 'space-between', - }, - donationAmount: { - fontSize: 16, - fontWeight: 400, - display: 'flex', - alignItems: 'center', - }, - threeLine: { - display: '-webkit-box', - '-webkit-line-clamp': 3, - height: 60, - fontSize: 14, - fontWeight: 400, - width: '100%', - overflow: 'hidden', - textOverflow: 'ellipsis', - '-webkit-box-orient': 'vertical', - }, - themeColor: { - color: theme.palette.maskColor.highlight, - }, - linkLogo: { - width: 24, - height: 24, - }, - icons: { - margin: '16px 0 16px 0', - display: 'flex', - alignItems: 'center', - }, - traitsBox: { - marginTop: 16, - gridRowGap: 16, - gridColumnGap: 20, - display: 'grid', - gridTemplateColumns: 'repeat(3, 170px)', - }, - traitItem: { - backgroundColor: theme.palette.maskColor.bg, - borderRadius: 8, - padding: 12, - }, - traitValue: { - fontSize: 14, - fontWeight: 700, - color: theme.palette.maskColor.main, - }, - secondText: { - fontSize: 14, - fontWeight: 400, - color: theme.palette.maskColor.second, - }, -})) - -const ChainID = { - ethereum: ChainId.Mainnet, - polygon: ChainId.Matic, - bnb: ChainId.BSC, -} - -export const CollectionDetailCard = memo( - ({ - img, - open, - onClose, - title, - referenceUrl, - metadata, - description, - contributions = EMPTY_LIST, - date, - location, - relatedURLs = EMPTY_LIST, - traits, - }) => { - const t = useSharedI18N() - const { classes } = useStyles() - - const icons = relatedURLs.map((url) => { - let icon: ReactNode = null - if (url.includes('etherscan.io')) { - icon = - } else if (url.includes('polygonscan.com/tx')) { - icon = - } else if (url.includes('polygonscan.com/token')) { - icon = - } else if (url.includes('opensea.io')) { - icon = - } else if (url.includes('gitcoin.co')) { - icon = - } - return icon ? ( - - {icon} - - ) : null - }) - - return ( - - - - - - - - - - {title} - -
{icons}
- - - {referenceUrl} - - {date && ( - - {date} - - )} - {location && ( - - @ - {location} - - )} - - {t.description()} - -
- {description} -
- - {contributions.length ? ( - <> - - {t.contributions()} - - - {contributions.length} - - - ) : null} - {contributions.map((contribution) => { - const days = differenceInCalendarDays(Date.now(), Number(contribution.timeStamp) * 1000) - const hours = differenceInCalendarHours(Date.now(), Number(contribution.timeStamp) * 1000) - return ( -
- - {contribution.formatedAmount} {contribution.symbol} - -
- {days > 0 ? `${days} ${t.day({ count: days })} ` : ''} - {hours > 0 ? `${hours} ${t.day({ count: hours })} ` : ''} - {t.ago()} - - - -
-
- ) - })} - {traits && ( - - {t.properties()} - - )} - - {traits?.map((trait) => ( -
- {trait.type} - {trait.value} -
- ))} -
-
-
- ) - }, -) diff --git a/packages/shared/src/UI/components/ConcealableTabs/index.tsx b/packages/shared/src/UI/components/ConcealableTabs/index.tsx new file mode 100644 index 000000000000..405928a12ca6 --- /dev/null +++ b/packages/shared/src/UI/components/ConcealableTabs/index.tsx @@ -0,0 +1,212 @@ +import { LeftArrowIcon, RightArrowIcon } from '@masknet/icons' +import { makeStyles } from '@masknet/theme' +import { Button } from '@mui/material' +import classnames from 'classnames' +import { throttle } from 'lodash-unified' +import { HTMLProps, ReactNode, useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react' + +const TAB_WIDTH = 126 +const useStyles = makeStyles()((theme) => ({ + container: { + display: 'flex', + position: 'relative', + backgroundColor: theme.palette.background.default, + '&::after': { + content: '""', + position: 'absolute', + left: 0, + right: 0, + bottom: 0, + height: 1, + backgroundColor: theme.palette.divider, + zIndex: 0, + }, + }, + track: { + flexGrow: 1, + display: 'flex', + overflow: 'auto', + 'scrollbar-width': 'none', + '&::-webkit-scrollbar': { + display: 'none', + }, + }, + button: { + height: 35, + minWidth: TAB_WIDTH, + padding: theme.spacing(0, 2.5), + borderRadius: 0, + flexShrink: 0, + border: '1px solid transparent', + }, + normal: { + boxSizing: 'border-box', + color: `${theme.palette.text.secondary} !important`, + backgroundColor: theme.palette.background.default, + border: '1px solid transparent', + '&:hover': { + color: `${theme.palette.text.primary} !important`, + backgroundColor: theme.palette.background.default, + }, + }, + selected: { + color: `${theme.palette.text.primary} !important`, + backgroundColor: theme.palette.background.paper, + border: '1px solid', + borderColor: theme.palette.background.paper, + borderBottomColor: theme.palette.background.paper, + '&:hover': { + borderBottomColor: theme.palette.background.paper, + backgroundColor: theme.palette.background.paper, + }, + position: 'relative', + zIndex: 10, + '&::after': { + content: '""', + position: 'absolute', + left: 0, + right: 0, + bottom: 0, + height: 1, + backgroundColor: theme.palette.background.paper, + }, + }, + controllers: { + display: 'flex', + flexGrow: 0, + alignItems: 'center', + borderLeft: `1px solid ${theme.palette.divider}`, + }, + controller: { + display: 'flex', + minWidth: 35, + color: theme.palette.text.primary, + border: 'none', + width: 35, + height: 35, + borderRadius: 0, + boxSizing: 'border-box', + alignItems: 'center', + justifyContent: 'center', + '&:hover': { + border: 'none !important', + borderBottomColor: theme.palette.divider, + color: `${theme.palette.text.primary} !important`, + backgroundColor: theme.palette.background.paper, + }, + '&[disabled]': { + backgroundColor: theme.palette.background.default, + }, + }, +})) + +interface TabOption { + id: T + label: string +} + +export interface ConcealableTabsProps extends Omit, 'onChange'> { + tabs: Array> + selectedId?: T + onChange?(id: T): void + tail?: ReactNode +} + +export function ConcealableTabs({ + className, + tabs, + selectedId, + tail, + onChange, + ...rest +}: ConcealableTabsProps) { + const { classes } = useStyles() + const [overflow, setOverflow] = useState(false) + + const trackRef = useRef(null) + const [reachedLeftEdge, setReachedLeftEdge] = useState(false) + const [reachedRightEdge, setReachedRightEdge] = useState(false) + + useLayoutEffect(() => { + const tabList = trackRef.current + if (!tabList) return + const isWider = tabList.scrollWidth > tabList.offsetWidth + setOverflow(isWider) + + if (!isWider) return + const detectScrollStatus = throttle(() => { + const reachedRight = tabList.scrollWidth - tabList.offsetWidth <= tabList.scrollLeft + const reachedLeft = tabList.scrollLeft === 0 + setReachedRightEdge(reachedRight) + setReachedLeftEdge(reachedLeft) + }, 100) + + detectScrollStatus() + tabList.addEventListener('scroll', detectScrollStatus) + return () => { + tabList.removeEventListener('scroll', detectScrollStatus) + } + }, []) + + useEffect(() => { + if (selectedId === undefined && tabs.length) { + onChange?.(tabs[0].id) + } + }, [selectedId, tabs.map((x) => x.id).join(), onChange]) + + const slide = useCallback((toLeft: boolean) => { + const tabList = trackRef.current + if (!tabList) return + const scrolled = Math.round(tabList.scrollLeft / TAB_WIDTH) + tabList.scrollTo({ left: TAB_WIDTH * (scrolled + (toLeft ? 1 : -1)), behavior: 'smooth' }) + }, []) + + return ( +
+
+ {tabs.map((tab) => ( + + ))} +
+ {overflow || tail ? ( +
+ {overflow ? ( + <> + + + + ) : null} + {tail} +
+ ) : null} +
+ ) +} diff --git a/packages/shared/src/UI/components/NFTCard/index.tsx b/packages/shared/src/UI/components/NFTCard/index.tsx index 549219c934a8..241ea284d505 100644 --- a/packages/shared/src/UI/components/NFTCard/index.tsx +++ b/packages/shared/src/UI/components/NFTCard/index.tsx @@ -1,8 +1,8 @@ import { MaskAvatarIcon, SelectedIcon } from '@masknet/icons' -import { ImageIcon, useImageChecker } from '@masknet/shared' +import { useImageChecker } from '@masknet/shared' import { makeStyles, ShadowRootTooltip } from '@masknet/theme' import { isSameAddress, NetworkPluginID, NonFungibleToken } from '@masknet/web3-shared-base' -import { ChainId, NETWORK_DESCRIPTORS, SchemaType } from '@masknet/web3-shared-evm' +import type { ChainId, SchemaType } from '@masknet/web3-shared-evm' import { Box, Skeleton } from '@mui/material' import classNames from 'classnames' @@ -81,11 +81,6 @@ const useStyles = makeStyles<{ networkPluginID: NetworkPluginID }>()((theme, pro maskIcon: { fontSize: 30, }, - networkIcon: { - position: 'absolute', - top: 6, - right: 6, - }, })) interface NFTImageCollectibleAvatarProps { @@ -94,7 +89,6 @@ interface NFTImageCollectibleAvatarProps { selectedToken?: NonFungibleToken pluginId: NetworkPluginID size?: number - showNetwork?: boolean } export function NFTImageCollectibleAvatar({ @@ -103,7 +97,6 @@ export function NFTImageCollectibleAvatar({ selectedToken, pluginId, size = 126, - showNetwork = false, }: NFTImageCollectibleAvatarProps) { const { classes } = useStyles({ networkPluginID: pluginId }) const { value: isImageToken, loading } = useImageChecker(token.metadata?.imageURL) @@ -128,7 +121,6 @@ export function NFTImageCollectibleAvatar({ token={token} selectedToken={selectedToken} onChange={onChange} - showNetwork={showNetwork} /> ) : ( @@ -146,7 +138,6 @@ interface NFTImageProps { selectedToken?: NonFungibleToken onChange?: (token: NonFungibleToken) => void size?: number - showNetwork?: boolean } function isSameNFT( @@ -163,9 +154,8 @@ function isSameNFT( } export function NFTImage(props: NFTImageProps) { - const { token, onChange, selectedToken, showBadge = false, pluginId, size = 126, showNetwork = false } = props + const { token, onChange, selectedToken, showBadge = false, pluginId, size = 126 } = props const { classes } = useStyles({ networkPluginID: pluginId }) - const iconURL = NETWORK_DESCRIPTORS.find((network) => network?.chainId === token.chainId)?.icon return ( @@ -179,8 +169,6 @@ export function NFTImage(props: NFTImageProps) { isSameNFT(pluginId, token, selectedToken) ? classes.itemSelected : '', )} /> - {showNetwork && } - {showBadge && isSameNFT(pluginId, token, selectedToken) ? ( ) : null} diff --git a/packages/shared/src/UI/components/NFTCardStyledAssetPlayer/index.tsx b/packages/shared/src/UI/components/NFTCardStyledAssetPlayer/index.tsx index 8d7435aa5b37..9982f6ff5e44 100644 --- a/packages/shared/src/UI/components/NFTCardStyledAssetPlayer/index.tsx +++ b/packages/shared/src/UI/components/NFTCardStyledAssetPlayer/index.tsx @@ -5,8 +5,6 @@ import { AssetPlayer } from '../AssetPlayer' import { useNonFungibleToken, Web3Helper } from '@masknet/plugin-infra/web3' import { NetworkPluginID } from '@masknet/web3-shared-base' import { useImageChecker } from '../../../hooks' -import { NETWORK_DESCRIPTORS } from '@masknet/web3-shared-evm' -import { ImageIcon } from '../ImageIcon' import { Image } from '../Image' const useStyles = makeStyles()((theme) => ({ @@ -32,12 +30,6 @@ const useStyles = makeStyles()((theme) => ({ display: 'flex', justifyContent: 'center', alignItems: 'center', - position: 'relative', - }, - networkIcon: { - position: 'absolute', - top: 6, - right: 6, }, })) @@ -52,7 +44,6 @@ interface Props extends withClasses<'loadingFailImage' | 'iframe' | 'wrapper' | isNative?: boolean setERC721TokenName?: (name: string) => void setSourceType?: (type: string) => void - showNetwork?: boolean } const assetPlayerFallbackImageDark = new URL('./nft_token_fallback_dark.png', import.meta.url) @@ -70,7 +61,6 @@ export function NFTCardStyledAssetPlayer(props: Props) { setERC721TokenName, renderOrder, setSourceType, - showNetwork = false, } = props const classes = useStylesExtends(useStyles(), props) const theme = useTheme() @@ -90,8 +80,6 @@ export function NFTCardStyledAssetPlayer(props: Props) { const fallbackImageURL = theme.palette.mode === 'dark' ? assetPlayerFallbackImageDark : assetPlayerFallbackImageLight - const networkIcon = NETWORK_DESCRIPTORS.find((network) => network?.chainId === chainId)?.icon - return isImageToken || isNative ? (
- {showNetwork && }
) : ( ( - ({ address, pluginId, domainSize, size = 5, fontSize = '14px', fontWeight = 700 }) => { - const { value: domain } = useReverseAddress(pluginId, address) - const { Others } = useWeb3State(pluginId) +export const ReversedAddress = memo(({ address, pluginId, domainSize, size = 5 }) => { + const { value: domain } = useReverseAddress(pluginId, address) + const { Others } = useWeb3State(pluginId) - if (!domain || !Others?.formatDomainName) - return ( - - {Others?.formatAddress?.(address, size) ?? address} - - ) + if (!domain || !Others?.formatDomainName) return <>{Others?.formatAddress?.(address, size) ?? address} - return ( - - {Others.formatDomainName(domain, domainSize)} - - ) - }, -) + return <>{Others.formatDomainName(domain, domainSize)} +}) diff --git a/packages/shared/src/UI/components/TokenSecurity/components/RiskCard.tsx b/packages/shared/src/UI/components/TokenSecurity/components/RiskCard.tsx index 0dc0ef48a6a0..62071b3981d1 100644 --- a/packages/shared/src/UI/components/TokenSecurity/components/RiskCard.tsx +++ b/packages/shared/src/UI/components/TokenSecurity/components/RiskCard.tsx @@ -51,7 +51,6 @@ export const RiskCard = memo(({ info, tokenSecurity }) => { fee: '', percentage: '', distance: '', - count: 0, })} titleColor={DefineMapping[info.level].titleColor} description={t[info.messageKey]({ @@ -62,7 +61,6 @@ export const RiskCard = memo(({ info, tokenSecurity }) => { fee: '', percentage: '', distance: '', - count: 0, })} /> ) diff --git a/packages/shared/src/UI/components/index.ts b/packages/shared/src/UI/components/index.ts index de17c3b9a517..32a582dc5205 100644 --- a/packages/shared/src/UI/components/index.ts +++ b/packages/shared/src/UI/components/index.ts @@ -2,6 +2,7 @@ export * from './AddressViewer' export * from './ApplicationEntry' export * from './AssetPlayer' export * from './ChainIcon' +export * from './ConcealableTabs' export * from './FungibleTokenList' export * from './I18NextProviderHMR' export * from './ImageIcon' @@ -22,5 +23,4 @@ export * from './Linking' export * from './LoadRetry' export * from './NFTCard' export * from './TokenSecurity' -export * from './CollectionDetailCard' export * from './Image' diff --git a/packages/shared/src/locales/en-US.json b/packages/shared/src/locales/en-US.json index 4f767c757ee6..dff481cfe823 100644 --- a/packages/shared/src/locales/en-US.json +++ b/packages/shared/src/locales/en-US.json @@ -32,8 +32,6 @@ "load_retry": "Reload", "powered_by": "Powered by", "go_plus": "GO+", - "rss3": "RSS3", - "mask_network": "Mask Network", "high_risk": "High Risk", "low_risk": "Low Risk", "medium_risk": "Medium Risk", @@ -43,16 +41,7 @@ "token_info": "Token info", "more_details": "More Details", "more": "More", - "details": "Details", "unnamed": "Unnamed", - "contributions": "Contributions", - "description": "Description", - "day_one": "day", - "day_other": "days", - "hour_one": "hour", - "hour_other": "hours", - "ago": "ago", - "properties": "Properties", "security_detection": "Security Detection", "risky_items": "{{quantity}} Risky factors", "attention_items": "{{quantity}} Attention factors", diff --git a/packages/web3-providers/src/rss3/constants.ts b/packages/web3-providers/src/rss3/constants.ts index dbda73f602ec..3bf8bc91b322 100644 --- a/packages/web3-providers/src/rss3/constants.ts +++ b/packages/web3-providers/src/rss3/constants.ts @@ -1,13 +1,4 @@ -import { NetworkPluginID } from '@masknet/web3-shared-base' - export const RSS3_ENDPOINT = 'https://hub.pass3.me' -export const RSS3_FEED_ENDPOINT = 'https://pregod.rss3.dev/v0.4.0/' - -export const PLATFORM = { - [NetworkPluginID.PLUGIN_EVM]: 'ethereum', - [NetworkPluginID.PLUGIN_FLOW]: 'flow', - [NetworkPluginID.PLUGIN_SOLANA]: 'solana', -} export const NEW_RSS3_ENDPOINT = 'https://prenode.rss3.dev' export const CollectionType = { diff --git a/packages/web3-providers/src/rss3/index.ts b/packages/web3-providers/src/rss3/index.ts index 730156c6c6ee..8005b0e45425 100644 --- a/packages/web3-providers/src/rss3/index.ts +++ b/packages/web3-providers/src/rss3/index.ts @@ -1,10 +1,10 @@ import urlcat from 'urlcat' import RSS3 from 'rss3-next' import { ChainId, SchemaType } from '@masknet/web3-shared-evm' -import { PLATFORM, RSS3_ENDPOINT, CollectionType, NEW_RSS3_ENDPOINT, RSS3_FEED_ENDPOINT } from './constants' +import { CollectionType, NEW_RSS3_ENDPOINT, RSS3_ENDPOINT } from './constants' import { NonFungibleTokenAPI, RSS3BaseAPI } from '../types' import { fetchJSON } from '../helpers' -import { createIndicator, createPageable, HubOptions, NetworkPluginID, TokenType } from '@masknet/web3-shared-base' +import { createIndicator, createPageable, HubOptions, TokenType } from '@masknet/web3-shared-base' export class RSS3API implements RSS3BaseAPI.Provider, NonFungibleTokenAPI.Provider { createRSS3( @@ -109,15 +109,4 @@ export class RSS3API implements RSS3BaseAPI.Provider, NonFungibleTokenAPI.Provid .filter((x) => x.chainId === chainId) return createPageable(data, createIndicator(indicator)) } - - async getWeb3Feed( - address: string, - { networkPluginId = NetworkPluginID.PLUGIN_EVM }: HubOptions = {}, - type?: RSS3BaseAPI.FeedType, - ) { - if (!address) return - const url = `${RSS3_FEED_ENDPOINT}account:${address}@${PLATFORM[networkPluginId]}/notes?limit=100&exclude_tags=POAP&tags=Gitcoin&tags=POAP&tags=NFT&tags=Donation&latest=false` - const res = fetchJSON(url) - return res - } } diff --git a/packages/web3-providers/src/types/RSS3.ts b/packages/web3-providers/src/types/RSS3.ts index 62122d682267..9b0f3250f276 100644 --- a/packages/web3-providers/src/types/RSS3.ts +++ b/packages/web3-providers/src/types/RSS3.ts @@ -128,76 +128,18 @@ export namespace RSS3BaseAPI { detail: FootprintType } - export type FeedType = 'Token' | 'Donation' | 'NFT' - export enum AssetType { GitcoinDonation = 'Gitcoin-Donation', POAP = 'POAP', NFT = 'NFT', } - export type Tags = 'NFT' | 'Token' | 'POAP' | 'Gitcoin' | 'Mirror Entry' | 'ETH' - export interface NameInfo { rnsName: string ensName: string | null address: string } - export interface Metadata { - collection_address?: string - collection_name?: string - contract_type?: string - from?: string - log_index?: string - network?: 'polygon' | 'ethereum' | 'bnb' - proof?: string - to?: string - token_id?: string - token_standard?: string - token_symbol?: string - token_address?: string - } - - export interface Attachments { - address?: string - mime_type?: string - size_in_bytes?: string - type?: string - } - - export interface Web3Feed { - attachments?: Attachments[] - authors: string[] - /* cspell:disable-next-line */ - backlinks: string - date_created: string - date_updated: string - identifier: string - links: string - related_urls?: string[] - // this field works different from API doc - source: string - tags: Tags[] - summary?: string - title?: string - metadata?: Metadata - imageURL?: string - traits?: Array<{ - type: string - value: string - }> - } - - export interface Web3FeedResponse { - version: string - date_updated: string - identifier: string - identifier_next?: string - total: string - list: Web3Feed[] - } - export interface Provider { createRSS3(address: string): RSS3 getFileData(rss3: RSS3, address: string, key: string): Promise