From acba783914520757eff88b372b252912a9b7b7d2 Mon Sep 17 00:00:00 2001 From: nuanyang233 Date: Thu, 19 May 2022 20:08:30 +0800 Subject: [PATCH 1/3] fix: bugfix --- .../ArtBlocks/SNSAdaptor/ActionBar.tsx | 11 +++++- .../Gitcoin/SNSAdaptor/PreviewCard.tsx | 11 +++--- .../RedPacket/SNSAdaptor/RedPacketNft.tsx | 7 ---- .../src/web3/UI/EthereumChainBoundary.tsx | 38 +++++++++++++++---- 4 files changed, 44 insertions(+), 23 deletions(-) diff --git a/packages/mask/src/plugins/ArtBlocks/SNSAdaptor/ActionBar.tsx b/packages/mask/src/plugins/ArtBlocks/SNSAdaptor/ActionBar.tsx index 7a227a1f65d2..b44d1b4de614 100644 --- a/packages/mask/src/plugins/ArtBlocks/SNSAdaptor/ActionBar.tsx +++ b/packages/mask/src/plugins/ArtBlocks/SNSAdaptor/ActionBar.tsx @@ -7,12 +7,18 @@ import type { Project } from '../types' const useStyles = makeStyles()((theme) => { return { - root: {}, + root: { + flex: 1, + }, content: { padding: theme.spacing(0), }, button: { - flex: 1, + backgroundColor: theme.palette.maskColor.dark, + color: 'white', + '&:hover': { + backgroundColor: theme.palette.maskColor.dark, + }, }, } }) @@ -40,6 +46,7 @@ export function ActionBar(props: ActionBarProps) { ({ '-webkit-box-orient': 'vertical', }, button: { - color: theme.palette.mode === 'dark' ? 'white' : 'black', + backgroundColor: theme.palette.maskColor.dark, + color: 'white', + '&:hover': { + backgroundColor: theme.palette.maskColor.dark, + }, width: '100%', }, })) @@ -172,13 +176,8 @@ export function PreviewCard(props: PreviewCardProps) { diff --git a/packages/mask/src/web3/UI/EthereumChainBoundary.tsx b/packages/mask/src/web3/UI/EthereumChainBoundary.tsx index 03596762dc52..f062115d7316 100644 --- a/packages/mask/src/web3/UI/EthereumChainBoundary.tsx +++ b/packages/mask/src/web3/UI/EthereumChainBoundary.tsx @@ -1,4 +1,4 @@ -import React, { useCallback } from 'react' +import React, { useCallback, useMemo } from 'react' import { Box, Typography, Theme, useTheme } from '@mui/material' import { makeStyles, MaskColorVar, ShadowRootTooltip, useStylesExtends } from '@masknet/theme' import type { SxProps } from '@mui/system' @@ -59,13 +59,13 @@ export interface EthereumChainBoundaryProps extends withClasses<'switchButton'> switchButtonStyle?: SxProps children?: React.ReactNode isValidChainId?: (actualChainId: ChainId, expectedChainId: ChainId) => boolean + renderInTimeline?: boolean ActionButtonPromiseProps?: Partial } export function EthereumChainBoundary(props: EthereumChainBoundaryProps) { const { t } = useI18N() const theme = useTheme() - const pluginID = useCurrentWeb3NetworkPluginID() const plugin = useActivatedPlugin(pluginID, 'any') @@ -162,6 +162,26 @@ export function EthereumChainBoundary(props: EthereumChainBoundaryProps) { if (!isChainMatched) await switchToChain() }, [account, isAllowed, isChainMatched, isPluginMatched, providerType, expectedChainId]) + // TODO: will remove this and extract new boundary for timeline + const buttonProps = useMemo(() => { + return { + ...(props.renderInTimeline + ? { + variant: 'contained', + fullWidth: true, + sx: { + backgroundColor: theme.palette.maskColor.dark, + color: theme.palette.maskColor.white, + '&:hover': { + backgroundColor: theme.palette.maskColor.dark, + }, + }, + } + : {}), + ...props.ActionButtonPromiseProps, + } as Partial + }, [props.ActionButtonPromiseProps, props.renderInTimeline]) + const renderBox = (children?: React.ReactNode, tips?: string) => { return ( @@ -182,11 +202,13 @@ export function EthereumChainBoundary(props: EthereumChainBoundaryProps) { <> {!props.hiddenConnectButton ? ( } + fullWidth + startIcon={} variant="contained" size={props.ActionButtonPromiseProps?.size} sx={{ marginTop: 1.5 }} - onClick={openSelectProviderDialog}> + onClick={openSelectProviderDialog} + {...buttonProps}> {t('plugin_wallet_connect_wallet')} ) : null} @@ -228,7 +250,6 @@ export function EthereumChainBoundary(props: EthereumChainBoundaryProps) { /> } sx={props.switchButtonStyle} - style={{ borderRadius: 10 }} init={ {t('plugin_wallet_connect_network', { @@ -246,7 +267,8 @@ export function EthereumChainBoundary(props: EthereumChainBoundaryProps) { executor={onSwitchChain} completeOnClick={onSwitchChain} failedOnClick="use executor" - {...props.ActionButtonPromiseProps} + fullWidth + {...buttonProps} /> ) : null} , @@ -274,7 +296,6 @@ export function EthereumChainBoundary(props: EthereumChainBoundaryProps) { /> } sx={props.switchButtonStyle} - style={{ borderRadius: 10, paddingTop: 11, paddingBottom: 11 }} init={ {t('plugin_wallet_switch_network', { network: expectedNetwork.replace('Mainnet', '') })} @@ -288,7 +309,8 @@ export function EthereumChainBoundary(props: EthereumChainBoundaryProps) { executor={onSwitchChain} completeOnClick={onSwitchChain} failedOnClick="use executor" - {...props.ActionButtonPromiseProps} + fullWidth + {...buttonProps} /> ) : null} , From 62f68f22f8fdb7b98cfcfdce46bb7032fd186237 Mon Sep 17 00:00:00 2001 From: nuanyang233 Date: Thu, 19 May 2022 20:32:22 +0800 Subject: [PATCH 2/3] fix: bugfix for ui --- packages/mask/src/web3/UI/EthereumChainBoundary.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/mask/src/web3/UI/EthereumChainBoundary.tsx b/packages/mask/src/web3/UI/EthereumChainBoundary.tsx index f062115d7316..9626dece8fd5 100644 --- a/packages/mask/src/web3/UI/EthereumChainBoundary.tsx +++ b/packages/mask/src/web3/UI/EthereumChainBoundary.tsx @@ -247,6 +247,7 @@ export function EthereumChainBoundary(props: EthereumChainBoundaryProps) { } sx={props.switchButtonStyle} From 001d597ec7f1d267cd9e7fbbf8f090c27673fd10 Mon Sep 17 00:00:00 2001 From: nuanyang233 Date: Thu, 19 May 2022 21:07:01 +0800 Subject: [PATCH 3/3] fix: spell error --- .../mask/src/plugins/CryptoartAI/SNSAdaptor/Collectible.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/Collectible.tsx b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/Collectible.tsx index 40165f6de8cf..c4c929cd57e8 100644 --- a/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/Collectible.tsx +++ b/packages/mask/src/plugins/CryptoartAI/SNSAdaptor/Collectible.tsx @@ -136,7 +136,7 @@ export function Collectible(props: CollectibleProps) { target="_blank" rel="noopener noreferrer"> }