Skip to content

Commit

Permalink
fix: error toast copy appearing as c (#8388)
Browse files Browse the repository at this point in the history
  • Loading branch information
woodenfurniture authored Dec 17, 2024
1 parent a30975d commit 97ecf10
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { AssetIconWithBadge } from 'components/AssetIconWithBadge'
import { Row } from 'components/Row/Row'
import { RawText, Text } from 'components/Text'
import { TransactionTypeIcon } from 'components/TransactionHistory/TransactionTypeIcon'
import { useErrorHandler } from 'hooks/useErrorToast/useErrorToast'
import { useErrorToast } from 'hooks/useErrorToast/useErrorToast'
import { useWallet } from 'hooks/useWallet/useWallet'
import { getMixPanel } from 'lib/mixpanel/mixPanelSingleton'
import { MixPanelEvent } from 'lib/mixpanel/types'
Expand All @@ -46,7 +46,7 @@ type CancelLimitOrderProps = {

export const CancelLimitOrder = ({ orderToCancel, resetOrderToCancel }: CancelLimitOrderProps) => {
const wallet = useWallet().state.wallet
const { showErrorToast } = useErrorHandler()
const { showErrorToast } = useErrorToast()
const queryClient = useQueryClient()
const mixpanel = getMixPanel()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { SlideTransition } from 'components/SlideTransition'
import { RawText, Text } from 'components/Text'
import { TransactionDate } from 'components/TransactionHistoryRows/TransactionDate'
import { useActions } from 'hooks/useActions'
import { useErrorHandler } from 'hooks/useErrorToast/useErrorToast'
import { useErrorToast } from 'hooks/useErrorToast/useErrorToast'
import { useWallet } from 'hooks/useWallet/useWallet'
import { getMixPanel } from 'lib/mixpanel/mixPanelSingleton'
import { MixPanelEvent } from 'lib/mixpanel/types'
Expand Down Expand Up @@ -55,7 +55,7 @@ export const LimitOrderConfirm = () => {
const translate = useTranslate()
const wallet = useWallet().state.wallet
const { confirmSubmit, setLimitOrderInitialized } = useActions(limitOrderSlice.actions)
const { showErrorToast } = useErrorHandler()
const { showErrorToast } = useErrorToast()
const queryClient = useQueryClient()
const mixpanel = getMixPanel()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { Hash } from 'viem'
import type { AllowanceType } from 'hooks/queries/useApprovalFees'
import { getApprovalAmountCryptoBaseUnit, useApprovalFees } from 'hooks/queries/useApprovalFees'
import { useIsAllowanceApprovalRequired } from 'hooks/queries/useIsAllowanceApprovalRequired'
import { useErrorHandler } from 'hooks/useErrorToast/useErrorToast'
import { useErrorToast } from 'hooks/useErrorToast/useErrorToast'
import { useWallet } from 'hooks/useWallet/useWallet'
import { selectHopSellAccountId } from 'state/slices/tradeQuoteSlice/selectors'
import { tradeQuoteSlice } from 'state/slices/tradeQuoteSlice/tradeQuoteSlice'
Expand All @@ -24,7 +24,7 @@ export const useAllowanceApproval = (
isInitiallyRequired: boolean,
) => {
const dispatch = useAppDispatch()
const { showErrorToast } = useErrorHandler()
const { showErrorToast } = useErrorToast()
const wallet = useWallet().state.wallet ?? undefined

const hopSellAccountIdFilter = useMemo(() => ({ hopIndex }), [hopIndex])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { reactQueries } from 'react-queries'
import type { Hash } from 'viem'
import { AllowanceType, useApprovalFees } from 'hooks/queries/useApprovalFees'
import { useIsAllowanceResetRequired } from 'hooks/queries/useIsAllowanceResetRequired'
import { useErrorHandler } from 'hooks/useErrorToast/useErrorToast'
import { useErrorToast } from 'hooks/useErrorToast/useErrorToast'
import { useWallet } from 'hooks/useWallet/useWallet'
import { selectHopSellAccountId } from 'state/slices/tradeQuoteSlice/selectors'
import { tradeQuoteSlice } from 'state/slices/tradeQuoteSlice/tradeQuoteSlice'
Expand All @@ -23,7 +23,7 @@ export const useAllowanceReset = (
isInitiallyRequired: boolean,
) => {
const dispatch = useAppDispatch()
const { showErrorToast } = useErrorHandler()
const { showErrorToast } = useErrorToast()
const wallet = useWallet().state.wallet ?? undefined

const hopSellAccountIdFilter = useMemo(() => ({ hopIndex }), [hopIndex])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { toAddressNList } from '@shapeshiftoss/chain-adapters'
import type { TradeQuote, TradeQuoteStep } from '@shapeshiftoss/swapper'
import assert from 'assert'
import { useCallback, useMemo } from 'react'
import { useErrorHandler } from 'hooks/useErrorToast/useErrorToast'
import { useErrorToast } from 'hooks/useErrorToast/useErrorToast'
import { useWallet } from 'hooks/useWallet/useWallet'
import { assertGetEvmChainAdapter } from 'lib/utils/evm'
import { selectPortfolioAccountMetadataByAccountId } from 'state/slices/selectors'
Expand All @@ -17,7 +17,7 @@ export const useSignPermit2 = (
confirmedTradeId: TradeQuote['id'],
) => {
const dispatch = useAppDispatch()
const { showErrorToast } = useErrorHandler()
const { showErrorToast } = useErrorToast()
const wallet = useWallet().state.wallet ?? undefined

const hopSellAccountIdFilter = useMemo(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import type { CosmosSdkChainId } from '@shapeshiftoss/types'
import type { TypedData } from 'eip-712'
import { useCallback, useEffect, useMemo, useRef } from 'react'
import { useTranslate } from 'react-polyglot'
import { useErrorHandler } from 'hooks/useErrorToast/useErrorToast'
import { useErrorToast } from 'hooks/useErrorToast/useErrorToast'
import { useWallet } from 'hooks/useWallet/useWallet'
import { bnOrZero } from 'lib/bignumber/bignumber'
import { THORSWAP_MAXIMUM_YEAR_TRESHOLD, THORSWAP_UNIT_THRESHOLD } from 'lib/fees/model'
Expand Down Expand Up @@ -58,7 +58,7 @@ export const useTradeExecution = (
const dispatch = useAppDispatch()
const wallet = useWallet().state.wallet
const slippageTolerancePercentageDecimal = useAppSelector(selectTradeSlippagePercentageDecimal)
const { showErrorToast } = useErrorHandler()
const { showErrorToast } = useErrorToast()
const trackMixpanelEvent = useMixpanel()
const hasMixpanelSuccessOrFailFiredRef = useRef(false)
const thorVotingPower = useAppSelector(selectThorVotingPower)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { getMixpanelEventData } from 'components/MultiHopTrade/helpers'
import { useInputOutputDifferenceDecimalPercentage } from 'components/MultiHopTrade/hooks/useInputOutputDifference'
import { TradeInputTab, TradeRoutePaths } from 'components/MultiHopTrade/types'
import { WalletActions } from 'context/WalletProvider/actions'
import { useErrorHandler } from 'hooks/useErrorToast/useErrorToast'
import { useErrorToast } from 'hooks/useErrorToast/useErrorToast'
import { useFeatureFlag } from 'hooks/useFeatureFlag/useFeatureFlag'
import { useModal } from 'hooks/useModal/useModal'
import { useWallet } from 'hooks/useWallet/useWallet'
Expand Down Expand Up @@ -89,7 +89,7 @@ export const TradeInput = ({ isCompact, tradeInputRef, onChangeTab }: TradeInput
const translate = useTranslate()
const mixpanel = getMixPanel()
const history = useHistory()
const { showErrorToast } = useErrorHandler()
const { showErrorToast } = useErrorToast()
const { sellAssetAccountId, buyAssetAccountId, setSellAssetAccountId, setBuyAssetAccountId } =
useAccountIds()
const buyAssetSearch = useModal('buyTradeAssetSearch')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type { StepComponentProps } from 'components/DeFi/components/Steps'
import { Text } from 'components/Text'
import { getChainAdapterManager } from 'context/PluginProvider/chainAdapterSingleton'
import { useBrowserRouter } from 'hooks/useBrowserRouter/useBrowserRouter'
import { useErrorHandler } from 'hooks/useErrorToast/useErrorToast'
import { useErrorToast } from 'hooks/useErrorToast/useErrorToast'
import { bnOrZero } from 'lib/bignumber/bignumber'
import { fromBaseUnit } from 'lib/math'
import { trackOpportunityEvent } from 'lib/mixpanel/helpers'
Expand Down Expand Up @@ -72,7 +72,7 @@ export const ExpiredWithdraw: React.FC<ExpiredWithdrawProps> = ({
const { getUnstakeFees } = useFoxFarming(contractAddress)

const methods = useForm<WithdrawValues>({ mode: 'onChange' })
const { showErrorToast } = useErrorHandler()
const { showErrorToast } = useErrorToast()

const asset = useAppSelector(state =>
selectAssetById(state, opportunity?.underlyingAssetId ?? ''),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { useHistory } from 'react-router-dom'
import { encodeFunctionData, getAddress, maxUint256 } from 'viem'
import type { StepComponentProps } from 'components/DeFi/components/Steps'
import { useBrowserRouter } from 'hooks/useBrowserRouter/useBrowserRouter'
import { useErrorHandler } from 'hooks/useErrorToast/useErrorToast'
import { useErrorToast } from 'hooks/useErrorToast/useErrorToast'
import { usePoll } from 'hooks/usePoll/usePoll'
import { useWallet } from 'hooks/useWallet/useWallet'
import { bnOrZero } from 'lib/bignumber/bignumber'
Expand Down Expand Up @@ -55,7 +55,7 @@ export const Approve: React.FC<ApproveProps> = ({ accountId, onNext, isReset })
const { state, dispatch } = useContext(DepositContext)
const estimatedGasCryptoPrecision = state?.approve.estimatedGasCryptoPrecision
const history = useHistory()
const { showErrorToast } = useErrorHandler()
const { showErrorToast } = useErrorToast()
const {
state: { wallet },
} = useWallet()
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useErrorToast/useErrorToast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { RawText } from 'components/Text'

const defaultErrorMsgTranslation = 'common.generalError'

export const useErrorHandler = () => {
export const useErrorToast = () => {
const toast = useToast()
const translate = useTranslate()

Expand All @@ -29,7 +29,7 @@ export const useErrorHandler = () => {
return [errorMsgTranslation, errorMsgTranslationOptions]
}

return defaultErrorMsgTranslation
return [defaultErrorMsgTranslation]
})()

const description = translate(...translationArgs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { fromHex, isHex } from 'viem'
import { CircularProgress } from 'components/CircularProgress/CircularProgress'
import { FoxIcon } from 'components/Icons/FoxIcon'
import { Text } from 'components/Text'
import { useErrorHandler } from 'hooks/useErrorToast/useErrorToast'
import { useErrorToast } from 'hooks/useErrorToast/useErrorToast'
import { useWallet } from 'hooks/useWallet/useWallet'
import { fromBaseUnit } from 'lib/math'
import { selectFeeAssetByChainId } from 'state/slices/selectors'
Expand All @@ -58,7 +58,7 @@ export const EIP155TransactionConfirmation: FC<

const { isLoading, feeAsset, fees, feeAssetPrice } = useCallRequestEvmFees(state)

const { showErrorToast } = useErrorHandler()
const { showErrorToast } = useErrorToast()
const translate = useTranslate()
const cardBg = useColorModeValue('white', 'gray.850')
const {
Expand Down

0 comments on commit 97ecf10

Please sign in to comment.