Skip to content

Commit

Permalink
Create a special hook for init global toasts
Browse files Browse the repository at this point in the history
  • Loading branch information
kkosiorowska committed Apr 8, 2024
1 parent 37ce916 commit 1107ecf
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
3 changes: 1 addition & 2 deletions dapp/src/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from "./store"
export * from "./toasts"
export * from "./useDetectThemeMode"
export * from "./useRequestBitcoinAccount"
export * from "./useRequestEthereumAccount"
Expand All @@ -17,8 +18,6 @@ export * from "./useInitApp"
export * from "./useCurrencyConversion"
export * from "./useDepositTelemetry"
export * from "./useFetchBTCPriceUSD"
export * from "./useToast"
export * from "./useWallet"
export * from "./useShowWalletErrorToast"
export * from "./useTimeout"
export * from "./useSize"
3 changes: 3 additions & 0 deletions dapp/src/hooks/toasts/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from "./useInitGlobalToasts"
export * from "./useShowWalletErrorToast"
export * from "./useToast"
6 changes: 6 additions & 0 deletions dapp/src/hooks/toasts/useInitGlobalToasts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { useShowWalletErrorToast } from "./useShowWalletErrorToast"

export function useInitGlobalToasts() {
useShowWalletErrorToast("ethereum")
useShowWalletErrorToast("bitcoin")
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import WalletErrorToast, {
WALLET_ERROR_TOAST_ID,
} from "#/components/WalletErrorToast"
import { useToast } from "./useToast"
import { useWallet } from "./useWallet"
import { useTimeout } from "./useTimeout"
import { useWallet } from "../useWallet"
import { useTimeout } from "../useTimeout"

export function useShowWalletErrorToast(
type: "bitcoin" | "ethereum",
Expand Down
File renamed without changes.
5 changes: 2 additions & 3 deletions dapp/src/hooks/useInitApp.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { useSentry } from "./sentry"
import { useInitializeAcreSdk } from "./useInitializeAcreSdk"
import { useFetchBTCPriceUSD } from "./useFetchBTCPriceUSD"
import { useShowWalletErrorToast } from "./useShowWalletErrorToast"
import { useInitGlobalToasts } from "./toasts/useInitGlobalToasts"

export function useInitApp() {
// TODO: Let's uncomment when dark mode is ready
// useDetectThemeMode()
useSentry()
useInitializeAcreSdk()
useFetchBTCPriceUSD()
useShowWalletErrorToast("ethereum")
useShowWalletErrorToast("bitcoin")
useInitGlobalToasts()
}

0 comments on commit 1107ecf

Please sign in to comment.