From 5ea9c0b81ae19875632110d1d387cca15fc1b148 Mon Sep 17 00:00:00 2001 From: Nicholas Barnett Date: Fri, 21 Jun 2024 12:14:03 -0500 Subject: [PATCH] fix(regressions): fixing build issues --- src/app/PageClient.tsx | 2 +- .../_components/BlockList/LayoutA/BurnBlock.tsx | 3 +-- .../BlockList/Sockets/useSubscribeBlocks.ts | 2 +- .../Sockets/useSubscribeBlocksUIBlock.ts | 2 +- src/app/_components/BtcAnchorBlockCard.tsx | 2 +- src/app/_components/ErrorBox.tsx | 3 +-- src/app/_components/Footer.tsx | 2 +- src/app/_components/NavBar/NetworkLabel.tsx | 2 +- src/app/_components/NavBar/NetworkModeBanner.tsx | 2 +- .../NavBar/__tests__/NetworkLabel.test.tsx | 2 +- src/app/_components/NavBar/index.tsx | 2 +- .../_components/StatusBar/IncidentsStatusBar.tsx | 2 +- src/app/block/[hash]/error.tsx | 4 +--- src/app/blocks/PageClient.tsx | 2 +- src/app/btcblock/[hash]/BitcoinAnchorDetails.tsx | 2 +- src/app/btcblock/[hash]/NavBlock.tsx | 2 +- src/app/error.tsx | 3 +-- src/app/global-error.tsx | 6 +----- src/app/layout.tsx | 6 +++--- src/app/sandbox/Wrapper.tsx | 4 ++-- .../DefaultView/SearchContractsForm.tsx | 2 +- .../ContractCall/SelectedContractView.tsx | 2 +- src/app/sandbox/components/TransactionsPanel.tsx | 2 +- src/app/sandbox/hooks/useUser.ts | 2 +- src/app/sandbox/layout/SideNav.tsx | 2 +- src/app/signers/data/UseSignerAddresses.ts | 2 +- src/app/signers/data/useSigners.ts | 2 +- src/app/signers/useSignerLocations.ts | 2 +- src/app/token/[tokenId]/error.tsx | 3 +-- src/app/txid/[txId]/BlocksVisualizer.tsx | 4 ++-- .../ContractCall/FunctionSummaryClarityValue.tsx | 4 ++-- src/app/txid/[txId]/TxAlerts.tsx | 3 +-- src/app/txid/[txId]/TxPage.tsx | 2 +- src/app/txid/[txId]/error.tsx | 4 +--- src/common/api/useApi.ts | 2 +- src/common/components/BtcStxBlockLinks.tsx | 2 +- src/common/components/ExplorerLinks.tsx | 2 +- .../modals/AddNetwork/AddNetworkForm.tsx | 7 ++++--- ...textProvider.tsx => GlobalContextProvider.tsx} | 8 ++++---- .../context/__tests__/GlobalContext.test.tsx | 12 ++++++------ .../{useAppContext.ts => useGlobalContext.ts} | 4 ++-- src/common/hooks/useIsNakamoto.ts | 2 +- src/common/hooks/useStacksNetwork.ts | 2 +- src/common/queries/usePoxInforRaw.ts | 2 +- src/common/utils/utils.ts | 15 +++++++++++++++ src/features/txsFilterAndSort/FilterButton.tsx | 2 +- 46 files changed, 77 insertions(+), 74 deletions(-) rename src/common/context/{AppContextProvider.tsx => GlobalContextProvider.tsx} (98%) rename src/common/context/{useAppContext.ts => useGlobalContext.ts} (50%) diff --git a/src/app/PageClient.tsx b/src/app/PageClient.tsx index 821ce2bc0..84b338df5 100644 --- a/src/app/PageClient.tsx +++ b/src/app/PageClient.tsx @@ -4,7 +4,7 @@ import { NextPage } from 'next'; import dynamic from 'next/dynamic'; import { DEFAULT_BLOCKS_LIST_LIMIT, DEFAULT_LIST_LIMIT_SMALL } from '../common/constants/constants'; -import { useGlobalContext } from '../common/context/useAppContext'; +import { useGlobalContext } from '../common/context/useGlobalContext'; import { NetworkModes } from '../common/types/network'; import { TxListTabs } from '../features/txs-list/tabs/TxListTabs'; import { Grid } from '../ui/Grid'; diff --git a/src/app/_components/BlockList/LayoutA/BurnBlock.tsx b/src/app/_components/BlockList/LayoutA/BurnBlock.tsx index 502a08d01..698b735e3 100644 --- a/src/app/_components/BlockList/LayoutA/BurnBlock.tsx +++ b/src/app/_components/BlockList/LayoutA/BurnBlock.tsx @@ -1,10 +1,9 @@ import { useColorModeValue } from '@chakra-ui/react'; import { ArrowBendDownLeft } from '@phosphor-icons/react'; -import * as React from 'react'; import { memo } from 'react'; import { Timestamp } from '../../../../common/components/Timestamp'; -import { useGlobalContext } from '../../../../common/context/useAppContext'; +import { useGlobalContext } from '../../../../common/context/useGlobalContext'; import { truncateMiddle } from '../../../../common/utils/utils'; import { Box } from '../../../../ui/Box'; import { Flex, FlexProps } from '../../../../ui/Flex'; diff --git a/src/app/_components/BlockList/Sockets/useSubscribeBlocks.ts b/src/app/_components/BlockList/Sockets/useSubscribeBlocks.ts index d4e50a212..bf70a89f4 100644 --- a/src/app/_components/BlockList/Sockets/useSubscribeBlocks.ts +++ b/src/app/_components/BlockList/Sockets/useSubscribeBlocks.ts @@ -3,7 +3,7 @@ import { useEffect, useRef } from 'react'; import { Block, StacksApiSocketClient } from '@stacks/blockchain-api-client'; import { NakamotoBlock } from '@stacks/blockchain-api-client/src/generated/models'; -import { useGlobalContext } from '../../../../common/context/useAppContext'; +import { useGlobalContext } from '../../../../common/context/useGlobalContext'; interface Subscription { unsubscribe(): void; diff --git a/src/app/_components/BlockList/Sockets/useSubscribeBlocksUIBlock.ts b/src/app/_components/BlockList/Sockets/useSubscribeBlocksUIBlock.ts index e65a1e0ee..a51d8b876 100644 --- a/src/app/_components/BlockList/Sockets/useSubscribeBlocksUIBlock.ts +++ b/src/app/_components/BlockList/Sockets/useSubscribeBlocksUIBlock.ts @@ -3,7 +3,7 @@ import { useEffect, useRef } from 'react'; import { StacksApiSocketClient } from '@stacks/blockchain-api-client'; import { NakamotoBlock } from '@stacks/blockchain-api-client/src/generated/models'; -import { useGlobalContext } from '../../../../common/context/useAppContext'; +import { useGlobalContext } from '../../../../common/context/useGlobalContext'; interface Subscription { unsubscribe(): void; diff --git a/src/app/_components/BtcAnchorBlockCard.tsx b/src/app/_components/BtcAnchorBlockCard.tsx index e74ce7473..8b414ec32 100644 --- a/src/app/_components/BtcAnchorBlockCard.tsx +++ b/src/app/_components/BtcAnchorBlockCard.tsx @@ -4,7 +4,7 @@ import { Block } from '@stacks/stacks-blockchain-api-types'; import { KeyValueVertical } from '../../common/components/KeyValueVertical'; import { Section } from '../../common/components/Section'; -import { useGlobalContext } from '../../common/context/useAppContext'; +import { useGlobalContext } from '../../common/context/useGlobalContext'; import { truncateMiddle } from '../../common/utils/utils'; import { Text } from '../../ui/Text'; import { TextLink } from '../../ui/TextLink'; diff --git a/src/app/_components/ErrorBox.tsx b/src/app/_components/ErrorBox.tsx index d31afbd9f..825ea72cb 100644 --- a/src/app/_components/ErrorBox.tsx +++ b/src/app/_components/ErrorBox.tsx @@ -1,7 +1,6 @@ import { XCircle } from '@phosphor-icons/react'; -import * as React from 'react'; -import { useGlobalContext } from '../../common/context/useAppContext'; +import { useGlobalContext } from '../../common/context/useGlobalContext'; import { buildUrl } from '../../common/utils/buildUrl'; import { Button } from '../../ui/Button'; import { ButtonLink } from '../../ui/ButtonLink'; diff --git a/src/app/_components/Footer.tsx b/src/app/_components/Footer.tsx index cba8dc1d1..903c0dcbf 100644 --- a/src/app/_components/Footer.tsx +++ b/src/app/_components/Footer.tsx @@ -5,7 +5,7 @@ import { FC } from 'react'; import { PAGE_MAX_WIDTH } from '../../common/constants/constants'; import { RELEASE_TAG_NAME } from '../../common/constants/env'; -import { useGlobalContext } from '../../common/context/useAppContext'; +import { useGlobalContext } from '../../common/context/useGlobalContext'; import { buildUrl } from '../../common/utils/buildUrl'; import { Box } from '../../ui/Box'; import { Flex } from '../../ui/Flex'; diff --git a/src/app/_components/NavBar/NetworkLabel.tsx b/src/app/_components/NavBar/NetworkLabel.tsx index 931f10779..9639c7b62 100644 --- a/src/app/_components/NavBar/NetworkLabel.tsx +++ b/src/app/_components/NavBar/NetworkLabel.tsx @@ -6,7 +6,7 @@ import { ChainID } from '@stacks/transactions'; import { Badge } from '../../../common/components/Badge'; import { DEFAULT_DEVNET_SERVER } from '../../../common/constants/constants'; -import { useGlobalContext } from '../../../common/context/useAppContext'; +import { useGlobalContext } from '../../../common/context/useGlobalContext'; import { useCustomNetworkApiInfo } from '../../../common/queries/useCustomNetworkApiInfo'; import { Network } from '../../../common/types/network'; import { buildUrl } from '../../../common/utils/buildUrl'; diff --git a/src/app/_components/NavBar/NetworkModeBanner.tsx b/src/app/_components/NavBar/NetworkModeBanner.tsx index b97855a7c..9a5785ce0 100644 --- a/src/app/_components/NavBar/NetworkModeBanner.tsx +++ b/src/app/_components/NavBar/NetworkModeBanner.tsx @@ -4,7 +4,7 @@ import { Flask } from '@phosphor-icons/react'; import { FC } from 'react'; import { Badge } from '../../../common/components/Badge'; -import { useGlobalContext } from '../../../common/context/useAppContext'; +import { useGlobalContext } from '../../../common/context/useGlobalContext'; import { capitalize } from '../../../common/utils/utils'; import { Flex } from '../../../ui/Flex'; import { Icon } from '../../../ui/Icon'; diff --git a/src/app/_components/NavBar/__tests__/NetworkLabel.test.tsx b/src/app/_components/NavBar/__tests__/NetworkLabel.test.tsx index 5bb39f76f..9188c3b5e 100644 --- a/src/app/_components/NavBar/__tests__/NetworkLabel.test.tsx +++ b/src/app/_components/NavBar/__tests__/NetworkLabel.test.tsx @@ -3,7 +3,7 @@ import { fireEvent, render } from '@testing-library/react'; import { ChainID } from '@stacks/transactions'; -import { useGlobalContext } from '../../../../common/context/useAppContext'; +import { useGlobalContext } from '../../../../common/context/useGlobalContext'; import { Network, NetworkModes } from '../../../../common/types/network'; import { useBreakpointValue } from '../../../../ui/hooks/useBreakpointValue'; import { NetworkLabel } from '../NetworkLabel'; diff --git a/src/app/_components/NavBar/index.tsx b/src/app/_components/NavBar/index.tsx index ef8d88e47..b616705a7 100644 --- a/src/app/_components/NavBar/index.tsx +++ b/src/app/_components/NavBar/index.tsx @@ -5,7 +5,7 @@ import { useMemo } from 'react'; import { openModal } from '../../../common/components/modals/modal-slice'; import { MODALS } from '../../../common/constants/constants'; -import { useGlobalContext } from '../../../common/context/useAppContext'; +import { useGlobalContext } from '../../../common/context/useGlobalContext'; import { useAppDispatch } from '../../../common/state/hooks'; import { Network } from '../../../common/types/network'; import { TokenPrice } from '../../../common/types/tokenPrice'; diff --git a/src/app/_components/StatusBar/IncidentsStatusBar.tsx b/src/app/_components/StatusBar/IncidentsStatusBar.tsx index 52dd8e73f..e852f7581 100644 --- a/src/app/_components/StatusBar/IncidentsStatusBar.tsx +++ b/src/app/_components/StatusBar/IncidentsStatusBar.tsx @@ -2,7 +2,7 @@ import { css } from '@emotion/react'; import { useEffect, useRef } from 'react'; import { IncidentImpact } from 'statuspage.io'; -import { useGlobalContext } from '../../../common/context/useAppContext'; +import { useGlobalContext } from '../../../common/context/useGlobalContext'; import { useUnresolvedIncidents } from '../../../common/queries/useUnresolvedIncidents'; import { useAppDispatch } from '../../../common/state/hooks'; import { Flex } from '../../../ui/Flex'; diff --git a/src/app/block/[hash]/error.tsx b/src/app/block/[hash]/error.tsx index ca8f87ed8..2509b1586 100644 --- a/src/app/block/[hash]/error.tsx +++ b/src/app/block/[hash]/error.tsx @@ -1,11 +1,10 @@ 'use client'; import { useEffect } from 'react'; -import * as React from 'react'; import { ErrorMessageLayout } from '../../../common/components/ErrorMessageLayout'; import { Section } from '../../../common/components/Section'; -import { useGlobalContext } from '../../../common/context/useAppContext'; +import { useGlobalContext } from '../../../common/context/useGlobalContext'; import { useError } from '../../../common/hooks/useError'; import { ExplorerError } from '../../../common/types/Error'; import { buildUrl } from '../../../common/utils/buildUrl'; @@ -14,7 +13,6 @@ import { ButtonLink } from '../../../ui/ButtonLink'; import { Flex } from '../../../ui/Flex'; import { Grid } from '../../../ui/Grid'; import { HStack } from '../../../ui/HStack'; -import { Stack } from '../../../ui/Stack'; import { PageTitle } from '../../_components/PageTitle'; const defaultErrorMessage = 'Failed to fetch block'; diff --git a/src/app/blocks/PageClient.tsx b/src/app/blocks/PageClient.tsx index a7c5f0999..a083111d0 100644 --- a/src/app/blocks/PageClient.tsx +++ b/src/app/blocks/PageClient.tsx @@ -3,7 +3,7 @@ import type { NextPage } from 'next'; import dynamic from 'next/dynamic'; -import { useGlobalContext } from '../../common/context/useAppContext'; +import { useGlobalContext } from '../../common/context/useGlobalContext'; import { NetworkModes } from '../../common/types/network'; import { BlockPageHeadersSkeleton, diff --git a/src/app/btcblock/[hash]/BitcoinAnchorDetails.tsx b/src/app/btcblock/[hash]/BitcoinAnchorDetails.tsx index 85e8a4f50..6eabaeea1 100644 --- a/src/app/btcblock/[hash]/BitcoinAnchorDetails.tsx +++ b/src/app/btcblock/[hash]/BitcoinAnchorDetails.tsx @@ -5,7 +5,7 @@ import styled from '@emotion/styled'; import { useParamsBlockHash } from '../../../app/block/[hash]/useParamsBlockHash'; import { KeyValueVertical } from '../../../common/components/KeyValueVertical'; import { Section } from '../../../common/components/Section'; -import { useGlobalContext } from '../../../common/context/useAppContext'; +import { useGlobalContext } from '../../../common/context/useGlobalContext'; import { useSuspenseBurnBlock } from '../../../common/queries/useBurnBlock'; import { toRelativeTime, truncateMiddle } from '../../../common/utils/utils'; import { Flex } from '../../../ui/Flex'; diff --git a/src/app/btcblock/[hash]/NavBlock.tsx b/src/app/btcblock/[hash]/NavBlock.tsx index 773e848ed..1e52401ab 100644 --- a/src/app/btcblock/[hash]/NavBlock.tsx +++ b/src/app/btcblock/[hash]/NavBlock.tsx @@ -1,6 +1,6 @@ import { ArrowLeft, ArrowRight } from '@phosphor-icons/react'; -import { useGlobalContext } from '../../../common/context/useAppContext'; +import { useGlobalContext } from '../../../common/context/useGlobalContext'; import { buildUrl } from '../../../common/utils/buildUrl'; import { Flex } from '../../../ui/Flex'; import { Icon } from '../../../ui/Icon'; diff --git a/src/app/error.tsx b/src/app/error.tsx index 085b7a738..a852a63de 100644 --- a/src/app/error.tsx +++ b/src/app/error.tsx @@ -1,11 +1,10 @@ 'use client'; -import * as React from 'react'; import { useEffect } from 'react'; import { ErrorMessageLayout } from '../common/components/ErrorMessageLayout'; import { Section } from '../common/components/Section'; -import { useGlobalContext } from '../common/context/useAppContext'; +import { useGlobalContext } from '../common/context/useGlobalContext'; import { buildUrl } from '../common/utils/buildUrl'; import { Box } from '../ui/Box'; import { Button } from '../ui/Button'; diff --git a/src/app/global-error.tsx b/src/app/global-error.tsx index 9568fcedf..24e140fe2 100644 --- a/src/app/global-error.tsx +++ b/src/app/global-error.tsx @@ -1,16 +1,12 @@ 'use client'; -import * as React from 'react'; import { useEffect } from 'react'; import { ErrorMessageLayout } from '../common/components/ErrorMessageLayout'; import { Section } from '../common/components/Section'; -import { useGlobalContext } from '../common/context/useAppContext'; -import { buildUrl } from '../common/utils/buildUrl'; +import { useGlobalContext } from '../common/context/useGlobalContext'; import { Box } from '../ui/Box'; -import { ButtonLink } from '../ui/ButtonLink'; import { Grid } from '../ui/Grid'; -import { Stack } from '../ui/Stack'; export default function Error({ error, diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 1e6c6a2e1..516de4a46 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -4,7 +4,7 @@ import { headers } from 'next/headers'; import { ReactNode } from 'react'; import { meta } from '../common/constants/meta'; -import { AppContextProvider } from '../common/context/AppContextProvider'; +import { GlobalContextProvider } from '../common/context/GlobalContextProvider'; import { PageWrapper } from './_components/PageWrapper'; import { Providers } from './_components/Providers'; import { getTokenPrice } from './getTokenPriceInfo'; @@ -20,11 +20,11 @@ export default async function RootLayout({ children }: { children: ReactNode }) return ( - + {children} - +