diff --git a/packages/mask/popups/pages/Wallet/AddToken/index.tsx b/packages/mask/popups/pages/Wallet/AddToken/index.tsx index 5613e5fda61b..18ac73d17877 100644 --- a/packages/mask/popups/pages/Wallet/AddToken/index.tsx +++ b/packages/mask/popups/pages/Wallet/AddToken/index.tsx @@ -193,7 +193,8 @@ export const Component = memo(function AddToken() { chainId={chainId} onAdd={addCustomNFTs} disabled={loadingAddCustomNFTs} - classes={{ grid: classes.grid, form: classes.form, main: classes.nftContent }} + className={classes.form} + classes={{ grid: classes.grid, main: classes.nftContent }} /> diff --git a/packages/plugins/Avatar/src/Application/NFTListDialog.tsx b/packages/plugins/Avatar/src/Application/NFTListDialog.tsx index 6be86ea1767e..483fb45c851c 100644 --- a/packages/plugins/Avatar/src/Application/NFTListDialog.tsx +++ b/packages/plugins/Avatar/src/Application/NFTListDialog.tsx @@ -54,6 +54,7 @@ const useStyles = makeStyles()((theme) => ({ }, content: { padding: 0, + width: '100%', backgroundColor: theme.palette.maskColor.bottom, scrollbarWidth: 'none', '::-webkit-scrollbar': { @@ -203,7 +204,7 @@ export function NFTListDialog() { onChainChange={setAssetChainId as (chainId?: Web3Helper.ChainIdAll) => void} /> - : + : No valid wallet detected. Please connect wallet or verify wallet firstly. } diff --git a/packages/plugins/Avatar/src/Application/UploadAvatarDialog.tsx b/packages/plugins/Avatar/src/Application/UploadAvatarDialog.tsx index b7b68010c836..62196ec38c5f 100644 --- a/packages/plugins/Avatar/src/Application/UploadAvatarDialog.tsx +++ b/packages/plugins/Avatar/src/Application/UploadAvatarDialog.tsx @@ -1,12 +1,12 @@ -import { Trans } from '@lingui/macro' +import { t, Trans } from '@lingui/macro' import { delay } from '@masknet/kit' import { useLastRecognizedIdentity } from '@masknet/plugin-infra/content-script' -import { currentVisitingProfile } from '@masknet/plugin-infra/content-script/context' -import { usePersonaConnectStatus } from '@masknet/shared' +import { currentVisitingProfile, share } from '@masknet/plugin-infra/content-script/context' +import { TransactionConfirmModal, usePersonaConnectStatus } from '@masknet/shared' import { makeStyles, useCustomSnackbar } from '@masknet/theme' import { useNetworkContext } from '@masknet/web3-hooks-base' import { Twitter } from '@masknet/web3-providers' -import { isSameAddress } from '@masknet/web3-shared-base' +import { isSameAddress, TokenType } from '@masknet/web3-shared-base' import { Button, DialogActions, DialogContent, Slider } from '@mui/material' import { useCallback, useState } from 'react' import AvatarEditor from 'react-avatar-editor' @@ -98,7 +98,13 @@ export function UploadAvatarDialog() { navigate(RoutePaths.Exit) setDisabled(false) await delay(500) - location.reload() + TransactionConfirmModal.open({ + title: t`NFTs Profile`, + message: t`You have set NFT PFP successfully.`, + shareText: t`I just set my NFT PFP using Mask Extension for free! To browse other's unique NFT collections and web3 activities on Twitter. Download the most powerful tool Mask.io.`, + tokenType: TokenType.Fungible, + share, + }) }, 'image/png') }, [account, editor, identifier, navigate, currentPersona, proof, isBindAccount, saveAvatar, identity]) diff --git a/packages/plugins/RedPacket/src/SiteAdaptor/RedPacket/index.tsx b/packages/plugins/RedPacket/src/SiteAdaptor/RedPacket/index.tsx index df0e24d4f536..cc2bd7a6728f 100644 --- a/packages/plugins/RedPacket/src/SiteAdaptor/RedPacket/index.tsx +++ b/packages/plugins/RedPacket/src/SiteAdaptor/RedPacket/index.tsx @@ -185,7 +185,6 @@ export const RedPacket = memo(function RedPacket({ payload }: RedPacketProps) { if (isZero(data.claimed_amount)) return TransactionConfirmModal.open({ shareText: claimedShareText, - amount: formatBalance(data.claimed_amount, token?.decimals, { significant: 2 }), token, tokenType: TokenType.Fungible, messageTextForNFT: _(msg`1 NFT claimed.`), diff --git a/packages/plugins/RedPacket/src/SiteAdaptor/RedPacketNft.tsx b/packages/plugins/RedPacket/src/SiteAdaptor/RedPacketNft.tsx index 3aac9eda9752..6a2bcf75a4f0 100644 --- a/packages/plugins/RedPacket/src/SiteAdaptor/RedPacketNft.tsx +++ b/packages/plugins/RedPacket/src/SiteAdaptor/RedPacketNft.tsx @@ -294,7 +294,6 @@ export function RedPacketNft({ payload }: RedPacketNftProps) { TransactionConfirmModal.open({ shareText, - amount: '1', nonFungibleTokenId: availability.claimed_id, nonFungibleTokenAddress: payload.contractAddress, tokenType: TokenType.NonFungible, diff --git a/packages/plugins/ScamSniffer/src/Worker/rpc.ts b/packages/plugins/ScamSniffer/src/Worker/rpc.ts index a57373d5577a..0b948a01d688 100644 --- a/packages/plugins/ScamSniffer/src/Worker/rpc.ts +++ b/packages/plugins/ScamSniffer/src/Worker/rpc.ts @@ -37,7 +37,7 @@ export async function detectScam(post: PostDetail) { const detector = getDetector() await detector.update() const result = await detector.detectScam(post) - const mainType = result?.matchType.split('')[0] + const mainType = result?.matchType.split(':')[0] if (mainType === 'match_by_domain_sim_days') return null return result } diff --git a/packages/plugins/Tips/src/components/TipDialog.tsx b/packages/plugins/Tips/src/components/TipDialog.tsx index 3d71a2940c19..46c64f8952bc 100644 --- a/packages/plugins/Tips/src/components/TipDialog.tsx +++ b/packages/plugins/Tips/src/components/TipDialog.tsx @@ -144,7 +144,6 @@ export function TipDialog({ open = false, onClose }: TipDialogProps) { await TransactionConfirmModal.openAndWaitForClose({ shareText, - amount, tokenType: tipType, token, nonFungibleTokenId, diff --git a/packages/shared/src/UI/components/AddCollectibles/index.tsx b/packages/shared/src/UI/components/AddCollectibles/index.tsx index b41a33861304..ed4b92e8a6c0 100644 --- a/packages/shared/src/UI/components/AddCollectibles/index.tsx +++ b/packages/shared/src/UI/components/AddCollectibles/index.tsx @@ -1,6 +1,8 @@ +import { msg, Trans } from '@lingui/macro' +import { useLingui } from '@lingui/react' import { Icons } from '@masknet/icons' import { EMPTY_LIST, type NetworkPluginID } from '@masknet/shared-base' -import { ActionButton, MaskTextField, makeStyles } from '@masknet/theme' +import { ActionButton, makeStyles, MaskTextField } from '@masknet/theme' import type { Web3Helper } from '@masknet/web3-helpers' import { useAccount, @@ -16,14 +18,12 @@ import { Stack, Typography, useTheme } from '@mui/material' import { Box } from '@mui/system' import { useQueries, useQuery } from '@tanstack/react-query' import { compact, uniq } from 'lodash-es' -import { memo, useCallback, useMemo, useState, type FormEvent } from 'react' +import { memo, useCallback, useMemo, useState, type FormEvent, type HTMLProps } from 'react' import { Controller, useForm } from 'react-hook-form' import { CollectibleItem, CollectibleItemSkeleton } from '../AssetsManagement/CollectibleItem.js' import { EmptyStatus } from '../EmptyStatus/index.js' import { LoadingStatus } from '../LoadingStatus/index.js' import { ReloadStatus } from '../ReloadStatus/index.js' -import { msg, Trans } from '@lingui/macro' -import { useLingui } from '@lingui/react' const useStyles = makeStyles()((theme) => ({ form: { @@ -100,8 +100,9 @@ type AddingNFTs = [ ] export interface AddCollectiblesProps - extends withClasses<'grid' | 'form' | 'main'> { - pluginID?: T + extends withClasses<'grid' | 'form' | 'main'>, + HTMLProps { + pluginID: T chainId?: Web3Helper.Definition[T]['ChainId'] /** * Specified account. @@ -125,13 +126,13 @@ function isValidTokenIds(rawIds: string) { } export const AddCollectibles = memo(function AddCollectibles(props: AddCollectiblesProps) { + const { pluginID, chainId: defaultChainId, account: defaultAccount, onAdd, className, ...rest } = props const { _ } = useLingui() - const { pluginID, chainId: defaultChainId, account: defaultAccount, onAdd } = props const { chainId } = useChainContext({ chainId: defaultChainId }) const theme = useTheme() const walletAccount = useAccount() const account = defaultAccount || walletAccount - const { classes } = useStyles(undefined, { props }) + const { classes, cx } = useStyles(undefined, { props }) const Utils = useWeb3Utils(pluginID) const { @@ -233,7 +234,7 @@ export const AddCollectibles = memo(function AddCollectibles(props: AddCollectib const disabled = !selectedTokenIds.length || isLoadingContract || isValidating || props.disabled return ( -
+ ({ margin: 'auto', border: `1px ${theme.palette.maskColor.secondaryLine} solid`, }, + icon: { + filter: 'drop-shadow(0px 6px 12px rgba(61, 194, 51, 0.20))', + backdropFilter: 'blur(8px)', + }, })) export interface TokenTransactionConfirmModalProps extends PropsWithChildren { - amount: string | null token?: Web3Helper.FungibleTokenAll | null nonFungibleTokenId?: string | null nonFungibleTokenAddress?: string @@ -87,7 +90,6 @@ export function TokenTransactionConfirmModal({ children, messageTextForNFT, messageTextForFT, - amount, tokenType, token, nonFungibleTokenAddress, @@ -114,15 +116,17 @@ export function TokenTransactionConfirmModal({ {isToken ? - + {token ? + + : } Congratulations! diff --git a/packages/shared/src/UI/modals/AddCollectiblesModal/AddCollectiblesDialog.tsx b/packages/shared/src/UI/modals/AddCollectiblesModal/AddCollectiblesDialog.tsx index a9f2ab0b1c6b..6627960da8c2 100644 --- a/packages/shared/src/UI/modals/AddCollectiblesModal/AddCollectiblesDialog.tsx +++ b/packages/shared/src/UI/modals/AddCollectiblesModal/AddCollectiblesDialog.tsx @@ -1,18 +1,27 @@ +import { Trans } from '@lingui/macro' import { type NetworkPluginID } from '@masknet/shared-base' import { makeStyles } from '@masknet/theme' +import { useNetworks } from '@masknet/web3-hooks-base' import { DialogContent } from '@mui/material' -import { memo } from 'react' +import { memo, useState } from 'react' +import { AddCollectibles, SelectNetworkSidebar, type AddCollectiblesProps } from '../../components/index.js' import { InjectedDialog } from '../../contexts/components/index.js' -import { AddCollectibles, type AddCollectiblesProps } from '../../components/index.js' -import { Trans } from '@lingui/macro' -const useStyles = makeStyles()(() => ({ +const useStyles = makeStyles()((theme) => ({ content: { padding: 0, + display: 'flex', + gap: theme.spacing(1), }, grid: { gridTemplateColumns: 'repeat(auto-fill, minmax(20%, 1fr))', }, + sidebar: { + marginLeft: theme.spacing(1), + }, + form: { + flexGrow: 1, + }, })) interface AddCollectiblesDialogProps extends AddCollectiblesProps { @@ -22,16 +31,27 @@ interface AddCollectiblesDialogProps onAdd()} title={Add NFTs}> + void } -export function TransactionConfirm({ onSubmit, shareText, share, ...rest }: TransactionConfirmProps) { +export function TransactionConfirm({ onSubmit, shareText, share, message, ...rest }: TransactionConfirmProps) { const handleConfirm = useCallback(() => { share?.(shareText) onSubmit?.() @@ -20,8 +21,8 @@ export function TransactionConfirm({ onSubmit, shareText, share, ...rest }: Tran return ( Share : OK} onConfirm={handleConfirm} diff --git a/packages/shared/src/UI/modals/TokenTransactionConfirmModal/index.tsx b/packages/shared/src/UI/modals/TokenTransactionConfirmModal/index.tsx index 504411b8a8cb..1ddf171093d4 100644 --- a/packages/shared/src/UI/modals/TokenTransactionConfirmModal/index.tsx +++ b/packages/shared/src/UI/modals/TokenTransactionConfirmModal/index.tsx @@ -10,11 +10,11 @@ export interface TransactionConfirmModalOpenProps extends Omit) { const [shareText, setShareText] = useState('') const [share, setShare] = useState<(text: string) => void>() - const [amount, setAmount] = useState(null) const [token, setToken] = useState() const [tokenType, setTokenType] = useState(TokenType.Fungible) const [messageTextForNFT, setMessageTextForNFT] = useState() const [messageTextForFT, setMessageTextForFT] = useState() + const [message, setMessage] = useState() const [title, setTitle] = useState() const [nonFungibleTokenId, setNonFungibleTokenId] = useState() const [nonFungibleTokenAddress, setNonFungibleTokenAddress] = useState() @@ -23,12 +23,12 @@ export function TransactionConfirmModal({ ref }: SingletonModalProps props.share) - setAmount(props.amount) setToken(props.token) setTokenType(props.tokenType) setTitle(props.title) setMessageTextForFT(props.messageTextForFT) setMessageTextForNFT(props.messageTextForNFT) + setMessage(props.message) setNonFungibleTokenId(props.nonFungibleTokenId ?? undefined) setNonFungibleTokenAddress(props.nonFungibleTokenAddress ?? undefined) }, @@ -40,7 +40,6 @@ export function TransactionConfirmModal({ ref }: SingletonModalProps dispatch?.close()} - amount={amount} tokenType={tokenType} nonFungibleTokenId={nonFungibleTokenId} nonFungibleTokenAddress={nonFungibleTokenAddress} @@ -50,6 +49,7 @@ export function TransactionConfirmModal({ ref }: SingletonModalProps ) }