From 50267ba74df3d18df9ff6d075a8841548cc8a71e Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Mon, 30 Oct 2023 04:55:00 +0700 Subject: [PATCH 1/6] feat: swich to ETH --- src/components/ModalsGlobal/index.tsx | 5 ++ src/components/ProAmm/DropdownSelect.tsx | 13 +++-- src/components/WalletPopup/RewardCenter.tsx | 40 +++++++++++--- .../KyberDAO/KNCUtility/GasRefundBox.tsx | 6 +- src/pages/KyberDAO/StakeKNC/MigrateModal.tsx | 2 +- .../KyberDAO/StakeKNC/StakeKNCComponent.tsx | 17 +++--- .../StakeKNC/SwitchToEthereumModal.tsx | 30 +++++----- src/pages/KyberDAO/StakeKNC/index.tsx | 2 +- .../KyberDAO/Vote/ProposalItem/index.tsx | 2 +- src/pages/KyberDAO/Vote/index.tsx | 4 +- src/state/application/actions.ts | 53 ++---------------- src/state/application/hooks.ts | 34 ++++++++++-- src/state/application/reducer.ts | 6 +- src/state/application/types.ts | 55 +++++++++++++++++++ 14 files changed, 172 insertions(+), 97 deletions(-) create mode 100644 src/components/ModalsGlobal/index.tsx create mode 100644 src/state/application/types.ts diff --git a/src/components/ModalsGlobal/index.tsx b/src/components/ModalsGlobal/index.tsx new file mode 100644 index 0000000000..49652be182 --- /dev/null +++ b/src/components/ModalsGlobal/index.tsx @@ -0,0 +1,5 @@ +import SwitchToEthereumModal from 'pages/KyberDAO/StakeKNC/SwitchToEthereumModal' + +export default function Modal() { + return +} diff --git a/src/components/ProAmm/DropdownSelect.tsx b/src/components/ProAmm/DropdownSelect.tsx index 844f96f598..0d6f684b9c 100644 --- a/src/components/ProAmm/DropdownSelect.tsx +++ b/src/components/ProAmm/DropdownSelect.tsx @@ -7,7 +7,7 @@ import { AutoColumn } from 'components/Column' import Row, { RowBetween } from 'components/Row' import { useOnClickOutside } from 'hooks/useOnClickOutside' import { ApplicationModal } from 'state/application/actions' -import { useModalOpen, useToggleModal } from 'state/application/hooks' +import { useCloseModal, useModalOpen, useToggleModal } from 'state/application/hooks' import { TYPE } from 'theme' const StyledIcon = styled(Flex)` @@ -64,7 +64,7 @@ type DropdownSelectPropsType = { setActive?: any color?: any optionTitles?: any - name?: ApplicationModal + name?: ApplicationModal.TIME_DROPDOWN } const DropdownSelect = ({ @@ -79,11 +79,12 @@ const DropdownSelect = ({ const theme = useTheme() const open = useModalOpen(name) const toggle = useToggleModal(name) + const close = useCloseModal(name) - useOnClickOutside(node, open ? toggle : undefined) + useOnClickOutside(node, open ? close : undefined) return ( - + {optionTitles && optionTitles[active] ? optionTitles[active] : active} @@ -91,7 +92,7 @@ const DropdownSelect = ({ {open && ( - + {Object.keys(options).map((key, index) => { const option = options[key] @@ -99,7 +100,7 @@ const DropdownSelect = ({ option !== active && ( { - toggle() + close() setActive(option) }} key={index} diff --git a/src/components/WalletPopup/RewardCenter.tsx b/src/components/WalletPopup/RewardCenter.tsx index 391729136e..7a27d1995c 100644 --- a/src/components/WalletPopup/RewardCenter.tsx +++ b/src/components/WalletPopup/RewardCenter.tsx @@ -4,12 +4,16 @@ import { Flex, Text } from 'rebass' import styled from 'styled-components' import { ReactComponent as DollarIcon } from 'assets/svg/dollar.svg' +import { NotificationType } from 'components/Announcement/type' import { ButtonPrimary } from 'components/Button' import { MouseoverTooltip, TextDashed } from 'components/Tooltip' import useMixpanel, { MIXPANEL_TYPE } from 'hooks/useMixpanel' import { useRewards } from 'hooks/useRewards' import useTheme from 'hooks/useTheme' +import { useSwitchToEthereum } from 'pages/KyberDAO/StakeKNC/SwitchToEthereumModal' +import { useNotify } from 'state/application/hooks' import { formatNumberWithPrecisionRange } from 'utils' +import { friendlyError } from 'utils/errorMessage' import CardBackground from './AccountInfo/CardBackground' import Tab from './Transactions/Tab' @@ -79,20 +83,40 @@ const TABS = [ export default function RewardCenter() { const { mixpanelHandler } = useMixpanel() const theme = useTheme() + const notify = useNotify() const [activeTab, setActiveTab] = useState(REWARD_TYPE.VOTING_REWARDS) const { rewards, totalReward } = useRewards() const currentReward = rewards[activeTab] + const { switchToEthereum } = useSwitchToEthereum() const [claiming, setClaiming] = useState(false) const claimRewards = useCallback(async () => { - try { - setClaiming(true) - mixpanelHandler(MIXPANEL_TYPE.GAS_REFUND_CLAIM_CLICK, { source: 'wallet UI', token_amount: currentReward.knc }) - await currentReward.claim() - } finally { - setClaiming(false) - } - }, [currentReward, mixpanelHandler]) + switchToEthereum(t`Claim reward`) + .then(async () => { + try { + setClaiming(true) + mixpanelHandler(MIXPANEL_TYPE.GAS_REFUND_CLAIM_CLICK, { + source: 'wallet UI', + token_amount: currentReward.knc, + }) + await currentReward.claim() + } catch (error) { + const message = friendlyError(error) + console.error('Wrap error:', { message, error }) + notify( + { + title: t`Wrap Error`, + summary: message, + type: NotificationType.ERROR, + }, + 8000, + ) + } finally { + setClaiming(false) + } + }) + .catch() + }, [currentReward, mixpanelHandler, notify, switchToEthereum]) return ( diff --git a/src/pages/KyberDAO/KNCUtility/GasRefundBox.tsx b/src/pages/KyberDAO/KNCUtility/GasRefundBox.tsx index 22da024879..d7ba828fd3 100644 --- a/src/pages/KyberDAO/KNCUtility/GasRefundBox.tsx +++ b/src/pages/KyberDAO/KNCUtility/GasRefundBox.tsx @@ -187,7 +187,9 @@ export default function GasRefundBox() { text={ Gas Refund Rewards is only available on Ethereum chain. Switch your network to continue{' '} - here + switchToEthereum(t`Gas refund program`)}> + here + } width="244px" @@ -256,7 +258,7 @@ export default function GasRefundBox() { setShowEligibleTx(false)} /> - + ) } diff --git a/src/pages/KyberDAO/StakeKNC/MigrateModal.tsx b/src/pages/KyberDAO/StakeKNC/MigrateModal.tsx index 5e4881eb66..28db8515e4 100644 --- a/src/pages/KyberDAO/StakeKNC/MigrateModal.tsx +++ b/src/pages/KyberDAO/StakeKNC/MigrateModal.tsx @@ -79,7 +79,7 @@ export default function MigrateModal({ const handleMigrate = () => { setError('') - switchToEthereum().then(() => { + switchToEthereum(t`Migrate`).then(() => { try { setPendingText(t`Migrating ${value} KNCL to KNC`) setShowConfirm(true) diff --git a/src/pages/KyberDAO/StakeKNC/StakeKNCComponent.tsx b/src/pages/KyberDAO/StakeKNC/StakeKNCComponent.tsx index 4a732c117f..c1c985df01 100644 --- a/src/pages/KyberDAO/StakeKNC/StakeKNCComponent.tsx +++ b/src/pages/KyberDAO/StakeKNC/StakeKNCComponent.tsx @@ -219,7 +219,6 @@ export default function StakeKNCComponent() { const [showConfirm, setShowConfirm] = useState(false) const [attemptingTxn, setAttemptingTxn] = useState(false) const [pendingText, setPendingText] = useState('') - const [featureText, setFeatureText] = useState('') const [txHash, setTxHash] = useState(undefined) const [inputValue, setInputValue] = useState('1') const [transactionError, setTransactionError] = useState() @@ -290,7 +289,7 @@ export default function StakeKNCComponent() { const refetchGasRefundInfo = useRefetchGasRefundInfo() const handleStake = () => { - switchToEthereum() + switchToEthereum(t`Staking KNC`) .then(() => { setPendingText(t`Staking ${inputValue} KNC to KyberDAO`) setShowConfirm(true) @@ -308,11 +307,11 @@ export default function StakeKNCComponent() { setTransactionError(error?.message) }) }) - .catch(() => setFeatureText(t`Staking KNC`)) + .catch() } const handleUnstake = () => { - switchToEthereum() + switchToEthereum(t`Unstaking KNC`) .then(() => { setPendingText(t`Unstaking ${inputValue} KNC from KyberDAO`) setShowConfirm(true) @@ -329,29 +328,27 @@ export default function StakeKNCComponent() { setTransactionError(error?.message) }) }) - .catch(() => setFeatureText(t`Unstaking KNC`)) + .catch() } const handleDelegate = () => { - switchToEthereum() + switchToEthereum(t`Delegate`) .then(() => { isUndelegate.current = false toggleDelegateConfirm() }) .catch(_error => { - setFeatureText(t`Delegate`) setShowConfirm(false) }) } const handleUndelegate = () => { - switchToEthereum() + switchToEthereum(t`Undelegate`) .then(() => { isUndelegate.current = true toggleDelegateConfirm() }) .catch(() => { - setFeatureText(t`Undelegate`) setShowConfirm(false) }) } @@ -665,7 +662,7 @@ export default function StakeKNCComponent() { } /> - + { return { switchToEthereum: useCallback( - () => + (featureText: string) => new Promise(async (resolve: any, reject: any) => { if ([ChainId.GÖRLI, ChainId.MAINNET].includes(chainId)) { resolve() } else { reject() - toggleSwitchEthereumModal() + toggleSwitchEthereumModal({ featureText }) } }), [chainId, toggleSwitchEthereumModal], @@ -40,22 +40,23 @@ export const useSwitchToEthereum = () => { } } -export default function SwitchToEthereumModal({ featureText }: { featureText: string }) { +export default function SwitchToEthereumModal() { const { chainId } = useActiveWeb3React() const theme = useTheme() const modalOpen = useModalOpen(ApplicationModal.SWITCH_TO_ETHEREUM) - const toggleModal = useToggleModal(ApplicationModal.SWITCH_TO_ETHEREUM) + const closeModal = useCloseModal(ApplicationModal.SWITCH_TO_ETHEREUM) + const params = useModalOpenParams(ApplicationModal.SWITCH_TO_ETHEREUM) const { changeNetwork } = useChangeNetwork() const handleChangeToEthereum = useCallback(async () => { if (![ChainId.GÖRLI, ChainId.MAINNET].includes(chainId)) { await changeNetwork(ChainId.MAINNET) - toggleModal() + closeModal() } - }, [changeNetwork, toggleModal, chainId]) + }, [changeNetwork, closeModal, chainId]) return ( - + @@ -65,12 +66,15 @@ export default function SwitchToEthereumModal({ featureText }: { featureText: st Switch Network - - + + - {featureText} is only available on Ethereum chain. Please switch network to continue. + + {params?.featureText || t`This action`} is only available on Ethereum chain. Please switch network to + continue. + diff --git a/src/pages/KyberDAO/StakeKNC/index.tsx b/src/pages/KyberDAO/StakeKNC/index.tsx index 425c1ea407..417b16bf3c 100644 --- a/src/pages/KyberDAO/StakeKNC/index.tsx +++ b/src/pages/KyberDAO/StakeKNC/index.tsx @@ -127,7 +127,7 @@ export default function StakeKNC() { const navigate = useNavigate() const { mixpanelHandler } = useMixpanel() const handleMigrateClick = () => { - switchToEthereum().then(() => { + switchToEthereum('Migrate').then(() => { toggleMigrationModal() }) } diff --git a/src/pages/KyberDAO/Vote/ProposalItem/index.tsx b/src/pages/KyberDAO/Vote/ProposalItem/index.tsx index bcb205c4b7..33ec7c1952 100644 --- a/src/pages/KyberDAO/Vote/ProposalItem/index.tsx +++ b/src/pages/KyberDAO/Vote/ProposalItem/index.tsx @@ -246,7 +246,7 @@ function ProposalItem({ } const { switchToEthereum } = useSwitchToEthereum() const handleVote = useCallback(() => { - switchToEthereum().then(() => { + switchToEthereum(t`This action`).then(() => { selectedOptions.length > 0 && setShowConfirmModal(true) }) }, [switchToEthereum, setShowConfirmModal, selectedOptions]) diff --git a/src/pages/KyberDAO/Vote/index.tsx b/src/pages/KyberDAO/Vote/index.tsx index ada634d8c9..d706bd56dc 100644 --- a/src/pages/KyberDAO/Vote/index.tsx +++ b/src/pages/KyberDAO/Vote/index.tsx @@ -163,7 +163,7 @@ export default function Vote() { const isDelegated = stakerInfo && account ? stakerInfo.delegate?.toLowerCase() !== account.toLowerCase() : false const handleClaim = useCallback(() => { - switchToEthereum().then(() => { + switchToEthereum(t`Claim`).then(() => { mixpanelHandler(MIXPANEL_TYPE.KYBER_DAO_CLAIM_CLICK) toggleClaimConfirmModal() }) @@ -463,7 +463,7 @@ export default function Vote() { Note: Voting on KyberDAO is only available on Ethereum chain. - + ('application/updateBlockNumber') -export const setOpenModal = createAction('application/setOpenModal') +export const setOpenModal = createAction<{ + modal: ApplicationModal | null + params: ModalParams[ApplicationModal] | undefined +}>('application/setOpenModal') export const closeModal = createAction('application/closeModal') export const addPopup = createAction<{ key?: string diff --git a/src/state/application/hooks.ts b/src/state/application/hooks.ts index 5063fd4508..a90645719e 100644 --- a/src/state/application/hooks.ts +++ b/src/state/application/hooks.ts @@ -39,6 +39,7 @@ import { updateETHPrice, updatePrommETHPrice, } from './actions' +import { ModalParams } from './types' export function useBlockNumber(): number | undefined { const { chainId } = useActiveWeb3React() @@ -46,7 +47,7 @@ export function useBlockNumber(): number | undefined { return useSelector((state: AppState) => state.application.blockNumber[chainId]) } -export const useCloseModal = (modal: ApplicationModal) => { +export const useCloseModal = (modal: ApplicationModal): (() => void) => { const dispatch = useDispatch() const onCloseModal = useCallback(() => { @@ -61,10 +62,26 @@ export function useModalOpen(modal: ApplicationModal): boolean { return openModal === modal } -export function useToggleModal(modal: ApplicationModal): () => void { +export function useModalOpenParams(modal: T): ModalParams[T] | undefined { + const openModalParams = useSelector((state: AppState) => state.application.openModalParams[modal]) + return openModalParams +} + +type OpenModalReturnType = U extends undefined + ? () => void + : (params: U) => void + +export function useToggleModal( + modal: T, +): OpenModalReturnType { const open = useModalOpen(modal) const dispatch = useDispatch() - return useCallback(() => dispatch(setOpenModal(open ? null : modal)), [dispatch, modal, open]) + return useCallback( + (params?: U) => { + dispatch(setOpenModal({ modal: open ? null : modal, params })) + }, + [dispatch, modal, open], + ) as OpenModalReturnType } export function useToggleNotificationCenter() { @@ -76,9 +93,16 @@ export function useToggleNotificationCenter() { }, [clearAllPopup, toggleNotificationCenter]) } -export function useOpenModal(modal: ApplicationModal): () => void { +export function useOpenModal( + modal: T, +): OpenModalReturnType { const dispatch = useDispatch() - return useCallback(() => dispatch(setOpenModal(modal)), [dispatch, modal]) + return useCallback( + (params?: U) => { + dispatch(setOpenModal({ modal, params })) + }, + [dispatch, modal], + ) as OpenModalReturnType } export function useNetworkModalToggle(): () => void { diff --git a/src/state/application/reducer.ts b/src/state/application/reducer.ts index e903d92c47..ceb26f199a 100644 --- a/src/state/application/reducer.ts +++ b/src/state/application/reducer.ts @@ -22,6 +22,7 @@ import { updatePrommETHPrice, updateServiceWorker, } from './actions' +import { ModalParams } from './types' type ETHPrice = { currentPrice?: string @@ -43,6 +44,7 @@ interface ApplicationState { readonly blockNumber: { readonly [chainId: number]: number } readonly popupList: PopupItemType[] readonly openModal: ApplicationModal | null + readonly openModalParams: { [key in ApplicationModal]?: ModalParams[key] } readonly ethPrice: ETHPrice readonly prommEthPrice: ETHPrice readonly serviceWorkerRegistration: ServiceWorkerRegistration | null @@ -85,6 +87,7 @@ const initialState: ApplicationState = { blockNumber: {}, popupList: [], openModal: null, + openModalParams: {}, ethPrice: {}, prommEthPrice: {}, serviceWorkerRegistration: null, @@ -104,7 +107,8 @@ export default createReducer(initialState, builder => } }) .addCase(setOpenModal, (state, action) => { - state.openModal = action.payload + state.openModal = action.payload.modal + if (action.payload.modal) state.openModalParams[action.payload.modal] = action.payload.params as any }) .addCase(closeModal, (state, action) => { if (state.openModal === action.payload) { diff --git a/src/state/application/types.ts b/src/state/application/types.ts new file mode 100644 index 0000000000..81d70941b1 --- /dev/null +++ b/src/state/application/types.ts @@ -0,0 +1,55 @@ +export enum ApplicationModal { + NETWORK = 'NETWORK', + WALLET = 'WALLET', + SETTINGS = 'SETTINGS', + TRANSACTION_SETTINGS = 'TRANSACTION_SETTINGS', + SELF_CLAIM = 'SELF_CLAIM', + ADDRESS_CLAIM = 'ADDRESS_CLAIM', + CLAIM_POPUP = 'CLAIM_POPUP', + MENU = 'MENU', + DELEGATE = 'DELEGATE', + VOTE = 'VOTE', + PRICE_RANGE = 'PRICE_RANGE', + POOL_DETAIL = 'POOL_DETAIL', + DOWNLOAD_WALLET = 'DOWNLOAD_WALLET', + + MOBILE_LIVE_CHART = 'MOBILE_LIVE_CHART', + MOBILE_TRADE_ROUTES = 'MOBILE_TRADE_ROUTES', + + SHARE = 'SHARE', + TRENDING_SOON_SORTING = 'TRENDING_SOON_SORTING', + TRENDING_SOON_TOKEN_DETAIL = 'TRENDING_SOON_TOKEN_DETAIL', + COMMUNITY = 'COMMUNITY', + CONTRACT_ADDRESS = 'CONTRACT_ADDRESS', + FAUCET_POPUP = 'FAUCET_POPUP', + SELECT_CAMPAIGN = 'SELECT_CAMPAIGN', + REGISTER_CAMPAIGN_CAPTCHA = 'REGISTER_CAMPAIGN_CAPTCHA', + REGISTER_CAMPAIGN_SUCCESS = 'REGISTER_CAMPAIGN_SUCCESS', + NOTIFICATION_CENTER = 'NOTIFICATION_CENTER', + SWITCH_PROFILE_POPUP = 'SWITCH_PROFILE_POPUP', + MENU_NOTI_CENTER = 'MENU_NOTI_CENTER', + YOUR_CAMPAIGN_TRANSACTIONS = 'YOUR_CAMPAIGN_TRANSACTIONS', + + // KyberDAO + DELEGATE_CONFIRM = 'DELEGATE_CONFIRM', + YOUR_TRANSACTIONS_STAKE_KNC = 'YOUR_TRANSACTIONS_STAKE_KNC', + MIGRATE_KNC = 'MIGRATE_KNC', + KYBER_DAO_CLAIM = 'KYBER_DAO_CLAIM', + + SWAP_APPROVAL = 'SWAP_APPROVAL', + TIME_DROPDOWN = 'TIME_DROPDOWN', + + TRUESIGHT_POOLS = 'TRUESIGHT_POOLS', + + KYBERAI_TUTORIAL = 'KYBERAI_TUTORIAL', + KYBERAI_NEW_UPDATE = 'KYBERAI_NEW_UPDATE', + SWITCH_TO_ETHEREUM = 'SWITCH_TO_ETHEREUM', +} + +type ImplementedModalParams = { + [ApplicationModal.SWITCH_TO_ETHEREUM]: { featureText: string } + //... fill more here +} +export type ModalParams = { + [modal in Exclude]?: undefined +} & ImplementedModalParams From 5888c13ca4ef0eb459ffda1e434875bd639549d8 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Mon, 30 Oct 2023 09:39:48 +0700 Subject: [PATCH 2/6] global modals --- src/components/ModalsGlobal/index.tsx | 2 +- src/pages/App.tsx | 2 ++ src/pages/KyberDAO/KNCUtility/GasRefundBox.tsx | 3 +-- src/pages/KyberDAO/StakeKNC/StakeKNCComponent.tsx | 3 +-- src/pages/KyberDAO/Vote/index.tsx | 3 +-- src/state/application/types.ts | 2 +- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/components/ModalsGlobal/index.tsx b/src/components/ModalsGlobal/index.tsx index 49652be182..314ed4ab29 100644 --- a/src/components/ModalsGlobal/index.tsx +++ b/src/components/ModalsGlobal/index.tsx @@ -1,5 +1,5 @@ import SwitchToEthereumModal from 'pages/KyberDAO/StakeKNC/SwitchToEthereumModal' -export default function Modal() { +export default function ModalsGlobal() { return } diff --git a/src/pages/App.tsx b/src/pages/App.tsx index 3aee2286de..f3c930160f 100644 --- a/src/pages/App.tsx +++ b/src/pages/App.tsx @@ -19,6 +19,7 @@ import Footer from 'components/Footer/Footer' import Header from 'components/Header' import Loader from 'components/LocalLoader' import Modal from 'components/Modal' +import ModalsGlobal from 'components/ModalsGlobal' import ProtectedRoute, { ProtectedRouteKyberAI } from 'components/ProtectedRoute' import Snowfall from 'components/Snowflake/Snowfall' import Web3ReactManager from 'components/Web3ReactManager' @@ -257,6 +258,7 @@ export default function App() { return ( + {(BLACKLIST_WALLETS.includes(isAddressString(chainId, account)) || BLACKLIST_WALLETS.includes(account?.toLowerCase() || '')) && ( setShowEligibleTx(false)} /> - ) } diff --git a/src/pages/KyberDAO/StakeKNC/StakeKNCComponent.tsx b/src/pages/KyberDAO/StakeKNC/StakeKNCComponent.tsx index c1c985df01..7cfa6b6b9e 100644 --- a/src/pages/KyberDAO/StakeKNC/StakeKNCComponent.tsx +++ b/src/pages/KyberDAO/StakeKNC/StakeKNCComponent.tsx @@ -39,7 +39,7 @@ import { isAddress, shortenAddress } from 'utils' import KNCLogo from '../kncLogo' import DelegateConfirmModal from './DelegateConfirmModal' import MigrateModal from './MigrateModal' -import SwitchToEthereumModal, { useSwitchToEthereum } from './SwitchToEthereumModal' +import { useSwitchToEthereum } from './SwitchToEthereumModal' import YourTransactionsModal from './YourTransactionsModal' enum STAKE_TAB { @@ -662,7 +662,6 @@ export default function StakeKNCComponent() { } /> - Note: Voting on KyberDAO is only available on Ethereum chain. - Date: Mon, 30 Oct 2023 16:21:12 +0700 Subject: [PATCH 3/6] fix title --- src/components/WalletPopup/RewardCenter.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/WalletPopup/RewardCenter.tsx b/src/components/WalletPopup/RewardCenter.tsx index 7a27d1995c..67ebb0f0eb 100644 --- a/src/components/WalletPopup/RewardCenter.tsx +++ b/src/components/WalletPopup/RewardCenter.tsx @@ -105,7 +105,7 @@ export default function RewardCenter() { console.error('Wrap error:', { message, error }) notify( { - title: t`Wrap Error`, + title: t`Claim Error`, summary: message, type: NotificationType.ERROR, }, From 6fa900661e70527819a28f6c7e46c6840a7d81c2 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Mon, 30 Oct 2023 17:28:29 +0700 Subject: [PATCH 4/6] update text --- src/pages/KyberDAO/Vote/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/KyberDAO/Vote/index.tsx b/src/pages/KyberDAO/Vote/index.tsx index 9f1beb55e8..420006e3da 100644 --- a/src/pages/KyberDAO/Vote/index.tsx +++ b/src/pages/KyberDAO/Vote/index.tsx @@ -163,7 +163,7 @@ export default function Vote() { const isDelegated = stakerInfo && account ? stakerInfo.delegate?.toLowerCase() !== account.toLowerCase() : false const handleClaim = useCallback(() => { - switchToEthereum(t`Claim`).then(() => { + switchToEthereum(t`Claim reward`).then(() => { mixpanelHandler(MIXPANEL_TYPE.KYBER_DAO_CLAIM_CLICK) toggleClaimConfirmModal() }) From 69a3e91576eb3f70020ed4a93acae2049da3582d Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Tue, 31 Oct 2023 15:39:44 +0700 Subject: [PATCH 5/6] move ModalConfirm into ModalsGlobal --- src/components/ModalsGlobal/index.tsx | 8 +++++++- src/pages/App.tsx | 2 -- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/ModalsGlobal/index.tsx b/src/components/ModalsGlobal/index.tsx index 314ed4ab29..cb64a6e9e0 100644 --- a/src/components/ModalsGlobal/index.tsx +++ b/src/components/ModalsGlobal/index.tsx @@ -1,5 +1,11 @@ +import ModalConfirm from 'components/ConfirmModal' import SwitchToEthereumModal from 'pages/KyberDAO/StakeKNC/SwitchToEthereumModal' export default function ModalsGlobal() { - return + return ( + <> + + + + ) } diff --git a/src/pages/App.tsx b/src/pages/App.tsx index 02c4b0645f..97979c73cb 100644 --- a/src/pages/App.tsx +++ b/src/pages/App.tsx @@ -10,7 +10,6 @@ import snow from 'assets/images/snow.png' import Popups from 'components/Announcement/Popups' import TopBanner from 'components/Announcement/Popups/TopBanner' import AppHaveUpdate from 'components/AppHaveUpdate' -import ModalConfirm from 'components/ConfirmModal' import ErrorBoundary from 'components/ErrorBoundary' import Footer from 'components/Footer/Footer' import Header from 'components/Header' @@ -398,7 +397,6 @@ export default function App() { - ) From 6d86ae5811402a5ca912804c2316247243d7bd19 Mon Sep 17 00:00:00 2001 From: Nam Nguyen Date: Tue, 31 Oct 2023 15:44:26 +0700 Subject: [PATCH 6/6] trans --- src/pages/KyberDAO/StakeKNC/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/KyberDAO/StakeKNC/index.tsx b/src/pages/KyberDAO/StakeKNC/index.tsx index 417b16bf3c..5edcc65d9d 100644 --- a/src/pages/KyberDAO/StakeKNC/index.tsx +++ b/src/pages/KyberDAO/StakeKNC/index.tsx @@ -1,5 +1,5 @@ import { commify, formatUnits } from '@ethersproject/units' -import { Trans } from '@lingui/macro' +import { Trans, t } from '@lingui/macro' import { isMobile } from 'react-device-detect' import Skeleton from 'react-loading-skeleton' import { NavLink, useNavigate } from 'react-router-dom' @@ -127,7 +127,7 @@ export default function StakeKNC() { const navigate = useNavigate() const { mixpanelHandler } = useMixpanel() const handleMigrateClick = () => { - switchToEthereum('Migrate').then(() => { + switchToEthereum(t`Migrate`).then(() => { toggleMigrationModal() }) }