Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Main" branch clean-up #12

Merged
merged 14 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ const AppBody = () => {
}
}, [connector, dispatch, account])

useEffect(() => {
dispatch(fetchETHPriceUSD())
}, [dispatch])

usePosthog()
useSaveConnectedAddressToStore()
useSentry()
Expand Down
19 changes: 14 additions & 5 deletions src/components/tBTC/BridgeActivity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ export type BridgeActivityProps = {

type BridgeActivityContextValue = {
[Property in keyof BridgeActivityProps]-?: BridgeActivityProps[Property]
} & { isBridgeHistoryEmpty: boolean }
} & {
isBridgeHistoryEmpty: boolean
}

const BridgeActivityContext = createContext<
BridgeActivityContextValue | undefined
Expand Down Expand Up @@ -87,12 +89,15 @@ export const BridgeAcivityHeader: FC<StackProps> = (props) => {
export const BridgeActivityData: FC<ListProps> = (props) => {
const { data, isBridgeHistoryEmpty, isFetching, emptyState } =
useBridgeActivityContext()
const { active } = useWeb3React()

return isFetching ? (
<BridgeActivityLoadingState />
) : (
<List spacing="1" mt="2" {...props}>
{isBridgeHistoryEmpty ? emptyState : data.map(renderActivityItem)}
{active && !isBridgeHistoryEmpty
? data.map(renderActivityItem)
: emptyState}
</List>
)
}
Expand Down Expand Up @@ -182,14 +187,18 @@ export const ActivityItemWrapper: FC = ({ children }) => (

export const BridgeActivityEmptyHistoryImg: FC = () => {
const { isBridgeHistoryEmpty, isFetching } = useBridgeActivityContext()
const epmtyHistoryImg = useColorModeValue(
const { active } = useWeb3React()
const emptyHistoryImg = useColorModeValue(
emptyHistoryImageSrcLight,
emptyHistoryImageSrcDark
)

return isBridgeHistoryEmpty && !isFetching ? (
const shouldRenderEmptyState =
!active || (isBridgeHistoryEmpty && !isFetching)

return shouldRenderEmptyState ? (
<>
<Image alt="no-history" src={epmtyHistoryImg} mx="auto" mt={16} mb={4} />
<Image alt="no-history" src={emptyHistoryImg} mx="auto" mt={16} mb={4} />
<BodyMd textAlign="center">You have no history yet.</BodyMd>
</>
) : (
Expand Down
6 changes: 3 additions & 3 deletions src/contexts/TokenContext.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, { createContext } from "react"
import { Contract } from "@ethersproject/contracts"
import { AddressZero } from "@ethersproject/constants"
import { Contract } from "@ethersproject/contracts"
import { useWeb3React } from "@web3-react/core"
import React, { createContext } from "react"
import { featureFlags } from "../constants"
import { useKeep } from "../web3/hooks/useKeep"
import { useNu } from "../web3/hooks/useNu"
import { useT } from "../web3/hooks/useT"
Expand All @@ -11,7 +12,6 @@ import { Token } from "../enums"
import { TokenState } from "../types"
import { useTBTCTokenContract } from "../web3/hooks"
import { useTBTCv2TokenContract } from "../web3/hooks/useTBTCv2TokenContract"
import { featureFlags } from "../constants"

interface TokenContextState extends TokenState {
contract: Contract | null
Expand Down