diff --git a/src/core-react/nft/hooks/useMintData.test.ts b/src/core-react/nft/hooks/useMintData.test.ts index e5d9fac766..3f38bfa6c1 100644 --- a/src/core-react/nft/hooks/useMintData.test.ts +++ b/src/core-react/nft/hooks/useMintData.test.ts @@ -13,7 +13,7 @@ import { useNFTLifecycleContext } from '../providers/NFTLifecycleProvider'; import { useMintData } from './useMintData'; import { useMintDetails } from './useMintDetails'; -vi.mock('../components/NFTLifecycleProvider'); +vi.mock('../providers/NFTLifecycleProvider'); vi.mock('./useMintDetails'); vi.mock('wagmi'); diff --git a/src/core-react/nft/hooks/useMintData.ts b/src/core-react/nft/hooks/useMintData.ts index e98e66ef1e..1f23870498 100644 --- a/src/core-react/nft/hooks/useMintData.ts +++ b/src/core-react/nft/hooks/useMintData.ts @@ -1,8 +1,8 @@ import { useEffect, useState } from 'react'; import { useAccount } from 'wagmi'; +import { convertIpfsToHttps } from '../../../core/nft/utils/ipfs'; import { useNFTLifecycleContext } from '../providers/NFTLifecycleProvider'; import type { NFTData, NFTError } from '../types'; -import { convertIpfsToHttps } from '../../../core/nft/utils/ipfs'; import { useMintDetails } from './useMintDetails'; export function useMintData( diff --git a/src/core-react/nft/hooks/useMintDetails.test.ts b/src/core-react/nft/hooks/useMintDetails.test.ts index 1497a6f228..3b8094d119 100644 --- a/src/core-react/nft/hooks/useMintDetails.test.ts +++ b/src/core-react/nft/hooks/useMintDetails.test.ts @@ -1,10 +1,10 @@ import { renderHook, waitFor } from '@testing-library/react'; import { type Mock, beforeEach, describe, expect, it, vi } from 'vitest'; -import { getMintDetails } from '../../core/api/getMintDetails'; -import { getNewReactQueryTestProvider } from '../../identity/hooks/getNewReactQueryTestProvider'; +import { getMintDetails } from '../../../core/api/getMintDetails'; +import { getNewReactQueryTestProvider } from '../../../identity/hooks/getNewReactQueryTestProvider'; import { useMintDetails } from './useMintDetails'; -vi.mock('../../core/api/getMintDetails'); +vi.mock('../../../core/api/getMintDetails'); describe('useMintDetails', () => { beforeEach(() => { diff --git a/src/core-react/nft/hooks/useMintDetails.ts b/src/core-react/nft/hooks/useMintDetails.ts index 1da10b2cd8..24f53d0576 100644 --- a/src/core-react/nft/hooks/useMintDetails.ts +++ b/src/core-react/nft/hooks/useMintDetails.ts @@ -1,6 +1,9 @@ import { type UseQueryResult, useQuery } from '@tanstack/react-query'; import { getMintDetails } from '../../../core/api/getMintDetails'; -import type { GetMintDetailsParams, MintDetails } from '../../../core/api/types'; +import type { + GetMintDetailsParams, + MintDetails, +} from '../../../core/api/types'; import { isNFTError } from '../../../core/nft/utils/isNFTError'; export function useMintDetails({ diff --git a/src/core-react/nft/hooks/useNFTData.test.ts b/src/core-react/nft/hooks/useNFTData.test.ts index e7330cec3b..aa3598c681 100644 --- a/src/core-react/nft/hooks/useNFTData.test.ts +++ b/src/core-react/nft/hooks/useNFTData.test.ts @@ -8,12 +8,12 @@ import { it, vi, } from 'vitest'; -import { useNFTLifecycleContext } from '../components/NFTLifecycleProvider'; +import { useNFTLifecycleContext } from '../providers/NFTLifecycleProvider'; import { useNFTData } from './useNFTData'; import { useTokenDetails } from './useTokenDetails'; vi.mock('./useTokenDetails'); -vi.mock('../components/NFTLifecycleProvider'); +vi.mock('../providers/NFTLifecycleProvider'); describe('useNFTData', () => { const mockUpdateLifecycleStatus = vi.fn(); diff --git a/src/core-react/nft/hooks/useNFTData.ts b/src/core-react/nft/hooks/useNFTData.ts index 33bc46bbb6..b4f3127b9f 100644 --- a/src/core-react/nft/hooks/useNFTData.ts +++ b/src/core-react/nft/hooks/useNFTData.ts @@ -1,7 +1,7 @@ import { useEffect, useState } from 'react'; +import { convertIpfsToHttps } from '../../../core/nft/utils/ipfs'; import { useNFTLifecycleContext } from '../providers/NFTLifecycleProvider'; import type { ContractType, NFTData, NFTError } from '../types'; -import { convertIpfsToHttps } from '../../../core/nft/utils/ipfs'; import { useTokenDetails } from './useTokenDetails'; export function useNFTData( diff --git a/src/core-react/nft/hooks/useTokenDetails.test.ts b/src/core-react/nft/hooks/useTokenDetails.test.ts index d5c93d8204..a03d5b831a 100644 --- a/src/core-react/nft/hooks/useTokenDetails.test.ts +++ b/src/core-react/nft/hooks/useTokenDetails.test.ts @@ -1,10 +1,10 @@ import { renderHook, waitFor } from '@testing-library/react'; import { type Mock, beforeEach, describe, expect, it, vi } from 'vitest'; -import { getTokenDetails } from '../../core/api/getTokenDetails'; -import { getNewReactQueryTestProvider } from '../../identity/hooks/getNewReactQueryTestProvider'; +import { getTokenDetails } from '../../../core/api/getTokenDetails'; +import { getNewReactQueryTestProvider } from '../../../identity/hooks/getNewReactQueryTestProvider'; import { useTokenDetails } from './useTokenDetails'; -vi.mock('../../core/api/getTokenDetails'); +vi.mock('../../../core/api/getTokenDetails'); describe('useTokenDetails', () => { beforeEach(() => { diff --git a/src/core-react/nft/hooks/useTokenDetails.ts b/src/core-react/nft/hooks/useTokenDetails.ts index 3df2220b99..b4194e8ab6 100644 --- a/src/core-react/nft/hooks/useTokenDetails.ts +++ b/src/core-react/nft/hooks/useTokenDetails.ts @@ -1,6 +1,9 @@ import { type UseQueryResult, useQuery } from '@tanstack/react-query'; import { getTokenDetails } from '../../../core/api/getTokenDetails'; -import type { GetTokenDetailsParams, TokenDetails } from '../../../core/api/types'; +import type { + GetTokenDetailsParams, + TokenDetails, +} from '../../../core/api/types'; import { isNFTError } from '../../../core/nft/utils/isNFTError'; export function useTokenDetails({ diff --git a/src/core/nft/utils/buildMintTransactionData.test.ts b/src/core/nft/utils/buildMintTransactionData.test.ts index d6c036f9f1..662220f841 100644 --- a/src/core/nft/utils/buildMintTransactionData.test.ts +++ b/src/core/nft/utils/buildMintTransactionData.test.ts @@ -3,7 +3,7 @@ import { type Mock, describe, expect, it, vi } from 'vitest'; import { buildMintTransaction as buildMintTransationApi } from '../../api/buildMintTransaction'; import { buildMintTransactionData } from './buildMintTransactionData'; -vi.mock('../../core/api/buildMintTransaction'); +vi.mock('../../api/buildMintTransaction'); describe('buildMintTransactionData', () => { const mockBuildMintTransaction = buildMintTransationApi as Mock; diff --git a/src/core/nft/utils/buildMintTransactionData.ts b/src/core/nft/utils/buildMintTransactionData.ts index bec600e14d..8006fe4a3b 100644 --- a/src/core/nft/utils/buildMintTransactionData.ts +++ b/src/core/nft/utils/buildMintTransactionData.ts @@ -1,7 +1,7 @@ import type { Address } from 'viem'; +import type { Call } from '../../../transaction/types'; import { buildMintTransaction as buildMintTransactionApi } from '../../api/buildMintTransaction'; import type { BuildMintTransactionParams } from '../../api/types'; -import type { Call } from '../../../transaction/types'; async function getMintTransaction({ mintAddress, diff --git a/src/ui/react/nft/NFTCard.test.tsx b/src/ui/react/nft/NFTCard.test.tsx index 43be352348..4b2da9f212 100644 --- a/src/ui/react/nft/NFTCard.test.tsx +++ b/src/ui/react/nft/NFTCard.test.tsx @@ -10,18 +10,30 @@ import { vi, } from 'vitest'; import { useAccount } from 'wagmi'; +<<<<<<< HEAD import { useIsMounted } from '../../core-react/internal/hooks/useIsMounted'; +======= +import { NFTProvider } from '../../../core-react/nft/providers/NFTProvider'; +import { useIsMounted } from '../../../useIsMounted'; +>>>>>>> 38ec07ca (fix: lint/tests) import { NFTCard } from './NFTCard'; -import { NFTProvider } from './NFTProvider'; vi.mock('wagmi', () => ({ useAccount: vi.fn(), })); +<<<<<<< HEAD vi.mock('../../core-react/internal/hooks/useTheme', () => ({ useTheme: vi.fn(() => 'default-light'), })); vi.mock('../../core-react/internal/hooks/useIsMounted'); vi.mock('./NFTProvider', () => ({ +======= +vi.mock('../../../useTheme', () => ({ + useTheme: vi.fn(() => 'default-light'), +})); +vi.mock('../../../useIsMounted'); +vi.mock('../../../core-react/nft/providers/NFTProvider', () => ({ +>>>>>>> 38ec07ca (fix: lint/tests) NFTProvider: vi.fn(({ children }) =>
{children}
), })); diff --git a/src/ui/react/nft/NFTCard.tsx b/src/ui/react/nft/NFTCard.tsx index 86f4a13c30..abae0f87e4 100644 --- a/src/ui/react/nft/NFTCard.tsx +++ b/src/ui/react/nft/NFTCard.tsx @@ -7,8 +7,6 @@ import { useNFTData as defaultUseNFTData } from '../../../core-react/nft/hooks/u import { LifecycleType, type NFTCardReact } from '../../../core-react/nft/types'; import NFTErrorBoundary from './NFTErrorBoundary'; import { NFTErrorFallback } from './NFTErrorFallback'; -import { NFTLifecycleProvider } from '../../../core-react/nft/providers/NFTLifecycleProvider'; -import { NFTProvider } from '../../../core-react/nft/providers/NFTProvider'; export function NFTCard({ children, diff --git a/src/ui/react/nft/NFTMintCard.test.tsx b/src/ui/react/nft/NFTMintCard.test.tsx index acb2799e40..e8ff5f7c9c 100644 --- a/src/ui/react/nft/NFTMintCard.test.tsx +++ b/src/ui/react/nft/NFTMintCard.test.tsx @@ -9,6 +9,7 @@ import { it, vi, } from 'vitest'; +<<<<<<< HEAD import { useIsMounted } from '../../core-react/internal/hooks/useIsMounted'; import { NFTMintCard } from './NFTMintCard'; @@ -17,6 +18,16 @@ vi.mock('../../core-react/internal/hooks/useTheme', () => ({ })); vi.mock('../../core-react/internal/hooks/useIsMounted'); vi.mock('./NFTProvider', () => ({ +======= +import { useIsMounted } from '../../../useIsMounted'; +import { NFTMintCard } from './NFTMintCard'; + +vi.mock('../../../useTheme', () => ({ + useTheme: vi.fn(() => 'default-light'), +})); +vi.mock('../../../useIsMounted'); +vi.mock('../../../core-react/nft/providers/NFTProvider', () => ({ +>>>>>>> 38ec07ca (fix: lint/tests) NFTProvider: vi.fn(({ children }) =>
{children}
), })); diff --git a/src/ui/react/nft/components/view/NFTAudio.tsx b/src/ui/react/nft/components/view/NFTAudio.tsx deleted file mode 100644 index c9c8fcffbc..0000000000 --- a/src/ui/react/nft/components/view/NFTAudio.tsx +++ /dev/null @@ -1,105 +0,0 @@ -import { - type MouseEvent, - useCallback, - useEffect, - useRef, - useState, -} from 'react'; -import { background, cn } from '../../../../../styles/theme'; -import type { NFTError } from '../../../../../core-react/nft/types'; -import { useNFTContext } from '../../../../../core-react/nft/providers/NFTProvider'; - -type NFTAudioReact = { - className?: string; - onLoading?: (mediaUrl: string) => void; - onLoaded?: () => void; - onError?: (error: NFTError) => void; -}; - -export function NFTAudio({ - className, - onLoading, - onLoaded, - onError, -}: NFTAudioReact) { - const { animationUrl } = useNFTContext(); - const audioRef = useRef(null); - const [isPlaying, setIsPlaying] = useState(false); - - useEffect(() => { - function onEnded() { - setIsPlaying(false); - } - - if (animationUrl && audioRef?.current) { - audioRef.current.onloadstart = () => { - onLoading?.(animationUrl); - }; - - audioRef.current.onloadeddata = () => { - onLoaded?.(); - }; - - audioRef.current.addEventListener('ended', onEnded); - - audioRef.current.onerror = (error: string | Event) => { - onError?.({ - error: typeof error === 'string' ? error : error.type, - code: 'NmNAc01', // NFT module NFTAudio component 01 error - message: 'Error loading audio', - }); - }; - } - }, [animationUrl, onLoading, onLoaded, onError]); - - const handlePlayPause = useCallback( - (event: MouseEvent) => { - event.stopPropagation(); - if (isPlaying) { - audioRef.current?.pause(); - setIsPlaying(false); - } else { - audioRef.current?.play(); - setIsPlaying(true); - } - }, - [isPlaying], - ); - - if (!animationUrl) { - return null; - } - - return ( -
- - -
- ); -} diff --git a/src/ui/react/nft/components/view/NFTImage.tsx b/src/ui/react/nft/components/view/NFTImage.tsx deleted file mode 100644 index dd76c71ea8..0000000000 --- a/src/ui/react/nft/components/view/NFTImage.tsx +++ /dev/null @@ -1,97 +0,0 @@ -import { type MouseEvent, useCallback, useEffect, useState } from 'react'; -import { defaultNFTSvg } from '../../../../../internal/svg/defaultNFTSvg'; -import { cn } from '../../../../../styles/theme'; -import type { NFTError } from '../../../../../core-react/nft/types'; -import { useNFTContext } from '../../../../../core-react/nft/providers/NFTProvider'; - -type NFTImageReact = { - className?: string; - square?: boolean; - onLoading?: (mediaUrl: string) => void; - onLoaded?: () => void; - onError?: (error: NFTError) => void; -}; - -export function NFTImage({ - className, - square = true, - onLoading, - onLoaded, - onError, -}: NFTImageReact) { - const { imageUrl, description } = useNFTContext(); - const [loaded, setLoaded] = useState(false); - const [error, setError] = useState(false); - - const loadImage = useCallback(() => { - if (imageUrl) { - onLoading?.(imageUrl); - - const img = new Image(); - img.onload = () => { - setLoaded(true); - onLoaded?.(); - }; - - img.onerror = (error: string | Event) => { - onError?.({ - error: typeof error === 'string' ? error : error.type, - code: 'NmNIc01', // NFT module NFTImage component 01 error - message: 'Error loading image', - }); - setError(true); - }; - img.src = imageUrl; - } - }, [imageUrl, onLoading, onLoaded, onError]); - - useEffect(() => { - loadImage(); - }, [loadImage]); - - const handleRetry = useCallback( - async (e: MouseEvent) => { - e.stopPropagation(); - setError(false); - loadImage(); - }, - [loadImage], - ); - - return ( -
*]:col-start-1 [&>*]:col-end-1 [&>*]:row-start-1 [&>*]:row-end-1', - className, - )} - > -
{defaultNFTSvg}
-
- {description} -
- {error && ( -
- -
- )} -
- ); -} diff --git a/src/ui/react/nft/components/view/NFTVideo.tsx b/src/ui/react/nft/components/view/NFTVideo.tsx deleted file mode 100644 index a2ffcd319d..0000000000 --- a/src/ui/react/nft/components/view/NFTVideo.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import { useEffect, useRef } from 'react'; -import { defaultNFTSvg } from '../../../../../internal/svg/defaultNFTSvg'; -import { cn } from '../../../../../styles/theme'; -import type { NFTError } from '../../../../../core-react/nft/types'; -import { useNFTContext } from '../../../../../core-react/nft/providers/NFTProvider'; - -type NFTVideoReact = { - className?: string; - square?: boolean; - onLoading?: (mediaUrl: string) => void; - onLoaded?: () => void; - onError?: (error: NFTError) => void; -}; - -export function NFTVideo({ - className, - square = true, - onLoading, - onLoaded, - onError, -}: NFTVideoReact) { - const { animationUrl, imageUrl } = useNFTContext(); - const videoRef = useRef(null); - - useEffect(() => { - if (animationUrl && videoRef?.current) { - videoRef.current.onloadstart = () => { - onLoading?.(animationUrl); - }; - - videoRef.current.onloadeddata = () => { - onLoaded?.(); - }; - - videoRef.current.onerror = (error: string | Event) => { - onError?.({ - error: typeof error === 'string' ? error : error.type, - code: 'NmNVc01', // NFT module NFTVideo component 01 error - message: 'Error loading video', - }); - }; - } - }, [animationUrl, onLoading, onLoaded, onError]); - - if (!animationUrl) { - return
{defaultNFTSvg}
; - } - - return ( -
*]:col-start-1 [&>*]:col-end-1 [&>*]:row-start-1 [&>*]:row-end-1', - { 'content-center justify-center': !square }, - className, - )} - > -
- ); -} diff --git a/src/ui/react/nft/mint/NFTAssetCost.test.tsx b/src/ui/react/nft/mint/NFTAssetCost.test.tsx index 244fdf9e2c..69f0775d04 100644 --- a/src/ui/react/nft/mint/NFTAssetCost.test.tsx +++ b/src/ui/react/nft/mint/NFTAssetCost.test.tsx @@ -9,10 +9,10 @@ import { it, vi, } from 'vitest'; -import { useNFTContext } from '../NFTProvider'; +import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; import { NFTAssetCost } from './NFTAssetCost'; -vi.mock('../NFTProvider'); +vi.mock('../../../../core-react/nft/providers/NFTProvider'); describe('NFTAssetCost', () => { const mockUseNFTContext = useNFTContext as Mock; diff --git a/src/ui/react/nft/mint/NFTAssetCost.tsx b/src/ui/react/nft/mint/NFTAssetCost.tsx index 59a021b1a6..47d01a267b 100644 --- a/src/ui/react/nft/mint/NFTAssetCost.tsx +++ b/src/ui/react/nft/mint/NFTAssetCost.tsx @@ -1,8 +1,8 @@ +import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; import { multiplyFloats } from '../../../../core/utils/multiplyFloats'; import { cn, text } from '../../../../styles/theme'; import { formatAmount as formatSN } from '../../../../swap/utils/formatAmount'; import { formatAmount } from '../../../../token/utils/formatAmount'; -import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; type NFTAssetCostReact = { className?: string; diff --git a/src/ui/react/nft/mint/NFTCollectionTitle.test.tsx b/src/ui/react/nft/mint/NFTCollectionTitle.test.tsx index b46718713d..4e07fcba06 100644 --- a/src/ui/react/nft/mint/NFTCollectionTitle.test.tsx +++ b/src/ui/react/nft/mint/NFTCollectionTitle.test.tsx @@ -1,10 +1,10 @@ import '@testing-library/jest-dom'; import { render } from '@testing-library/react'; import { type Mock, describe, expect, it, vi } from 'vitest'; -import { useNFTContext } from '../NFTProvider'; +import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; import { NFTCollectionTitle } from './NFTCollectionTitle'; -vi.mock('../NFTProvider', () => ({ +vi.mock('../../../../core-react/nft/providers/NFTProvider', () => ({ useNFTContext: vi.fn(), })); diff --git a/src/ui/react/nft/mint/NFTCollectionTitle.tsx b/src/ui/react/nft/mint/NFTCollectionTitle.tsx index 4a1a3c087f..d796e00290 100644 --- a/src/ui/react/nft/mint/NFTCollectionTitle.tsx +++ b/src/ui/react/nft/mint/NFTCollectionTitle.tsx @@ -1,5 +1,5 @@ -import { cn, text } from '../../../../styles/theme'; import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; +import { cn, text } from '../../../../styles/theme'; type NFTCollectionTitleReact = { className?: string; diff --git a/src/ui/react/nft/mint/NFTCreator.test.tsx b/src/ui/react/nft/mint/NFTCreator.test.tsx index cc326a2043..4e716b147c 100644 --- a/src/ui/react/nft/mint/NFTCreator.test.tsx +++ b/src/ui/react/nft/mint/NFTCreator.test.tsx @@ -1,19 +1,19 @@ import '@testing-library/jest-dom'; import { render } from '@testing-library/react'; import { type Mock, beforeEach, describe, expect, it, vi } from 'vitest'; -import { useOnchainKit } from '../../../core-react/useOnchainKit'; -import { useNFTContext } from '../NFTProvider'; +import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; +import { useOnchainKit } from '../../../../core-react/useOnchainKit'; import { NFTCreator } from './NFTCreator'; -vi.mock('../../../core-react/useOnchainKit', () => ({ +vi.mock('../../../../core-react/useOnchainKit', () => ({ useOnchainKit: vi.fn(), })); -vi.mock('../NFTProvider', () => ({ +vi.mock('../../../../core-react/nft/providers/NFTProvider', () => ({ useNFTContext: vi.fn(), })); -vi.mock('../../../identity', async () => ({ - ...(await vi.importActual('../../../identity')), +vi.mock('../../../../identity', async () => ({ + ...(await vi.importActual('../../../../identity')), Identity: ({ className }: { className: string }) => (
Identity
), diff --git a/src/ui/react/nft/mint/NFTMintButton.test.tsx b/src/ui/react/nft/mint/NFTMintButton.test.tsx index 548f02793e..284cb6136e 100644 --- a/src/ui/react/nft/mint/NFTMintButton.test.tsx +++ b/src/ui/react/nft/mint/NFTMintButton.test.tsx @@ -11,6 +11,7 @@ import { useChainId, } from 'wagmi'; import { mock } from 'wagmi/connectors'; +<<<<<<< HEAD import { useOnchainKit } from '../../../core-react/useOnchainKit'; import { useNFTLifecycleContext } from '../NFTLifecycleProvider'; import { useNFTContext } from '../NFTProvider'; @@ -19,6 +20,16 @@ import { NFTMintButton } from './NFTMintButton'; vi.mock('../NFTProvider'); vi.mock('../NFTLifecycleProvider'); vi.mock('../../../core-react/useOnchainKit'); +======= +import { useNFTLifecycleContext } from '../../../../core-react/nft/providers/NFTLifecycleProvider'; +import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; +import { useOnchainKit } from '../../../../useOnchainKit'; +import { NFTMintButton } from './NFTMintButton'; + +vi.mock('../../../../core-react/nft/providers/NFTProvider'); +vi.mock('../../../../core-react/nft/providers/NFTLifecycleProvider'); +vi.mock('../../../../useOnchainKit'); +>>>>>>> 38ec07ca (fix: lint/tests) vi.mock('wagmi', async (importOriginal) => { return { ...(await importOriginal()), @@ -29,9 +40,9 @@ vi.mock('wagmi', async (importOriginal) => { vi.mock('../../../internal/components/Spinner', () => ({ Spinner: () =>
Spinner
, })); -vi.mock('../../../transaction', async (importOriginal) => { +vi.mock('../../../../transaction', async (importOriginal) => { return { - ...(await importOriginal()), + ...(await importOriginal()), TransactionLifecycleStatus: vi.fn(), TransactionButton: ({ text, @@ -89,7 +100,7 @@ vi.mock('../../../transaction', async (importOriginal) => { TransactionStatusLabel: vi.fn(), }; }); -vi.mock('../../../wallet', () => ({ +vi.mock('../../../../wallet', () => ({ ConnectWallet: () =>
ConnectWallet
, })); diff --git a/src/ui/react/nft/mint/NFTMintButton.tsx b/src/ui/react/nft/mint/NFTMintButton.tsx index c8c5c86770..365c149af5 100644 --- a/src/ui/react/nft/mint/NFTMintButton.tsx +++ b/src/ui/react/nft/mint/NFTMintButton.tsx @@ -1,5 +1,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react'; import { useAccount, useChainId } from 'wagmi'; +import { useNFTLifecycleContext } from '../../../../core-react/nft/providers/NFTLifecycleProvider'; +import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; import { Spinner } from '../../../../internal/components/Spinner'; import { cn, color, text } from '../../../../styles/theme'; import { @@ -14,8 +16,6 @@ import { } from '../../../../transaction'; import type { Call } from '../../../../transaction/types'; import { ConnectWallet } from '../../../../wallet'; -import { useNFTLifecycleContext } from '../../../../core-react/nft/providers/NFTLifecycleProvider'; -import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; type NFTMintButtonReact = { className?: string; diff --git a/src/ui/react/nft/mint/NFTMinters.test.tsx b/src/ui/react/nft/mint/NFTMinters.test.tsx index aed94df106..5fa1b64dbe 100644 --- a/src/ui/react/nft/mint/NFTMinters.test.tsx +++ b/src/ui/react/nft/mint/NFTMinters.test.tsx @@ -1,13 +1,13 @@ import '@testing-library/jest-dom'; import { render } from '@testing-library/react'; import { type Mock, beforeEach, describe, expect, it, vi } from 'vitest'; -import { useNFTContext } from '../NFTProvider'; +import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; import { NFTMinters } from './NFTMinters'; -vi.mock('../NFTProvider'); +vi.mock('../../../../core-react/nft/providers/NFTProvider'); -vi.mock('../../../identity', async () => ({ - ...(await vi.importActual('../../../identity')), +vi.mock('../../../../identity', async () => ({ + ...(await vi.importActual('../../../../identity')), Identity: ({ className, children, diff --git a/src/ui/react/nft/mint/NFTQuantitySelector.test.tsx b/src/ui/react/nft/mint/NFTQuantitySelector.test.tsx index 1af731c9e9..ca7dc433e5 100644 --- a/src/ui/react/nft/mint/NFTQuantitySelector.test.tsx +++ b/src/ui/react/nft/mint/NFTQuantitySelector.test.tsx @@ -10,12 +10,12 @@ import { it, vi, } from 'vitest'; -import { useNFTContext } from '../NFTProvider'; +import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; import { NFTQuantitySelector } from './NFTQuantitySelector'; -vi.mock('../NFTProvider'); +vi.mock('../../../../core-react/nft/providers/NFTProvider'); -vi.mock('../../../internal/components/QuantitySelector', () => ({ +vi.mock('../../../../internal/components/QuantitySelector', () => ({ QuantitySelector: ({ onChange, minQuantity, diff --git a/src/ui/react/nft/mint/NFTQuantitySelector.tsx b/src/ui/react/nft/mint/NFTQuantitySelector.tsx index dfd28722c7..c636e026be 100644 --- a/src/ui/react/nft/mint/NFTQuantitySelector.tsx +++ b/src/ui/react/nft/mint/NFTQuantitySelector.tsx @@ -1,6 +1,6 @@ +import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; import { QuantitySelector } from '../../../../internal/components/QuantitySelector'; import { cn } from '../../../../styles/theme'; -import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; type NFTQuantitySelectorReact = { className?: string; diff --git a/src/ui/react/nft/mint/NFTTotalCost.test.tsx b/src/ui/react/nft/mint/NFTTotalCost.test.tsx index 4dce22d588..6016cf3d50 100644 --- a/src/ui/react/nft/mint/NFTTotalCost.test.tsx +++ b/src/ui/react/nft/mint/NFTTotalCost.test.tsx @@ -9,10 +9,10 @@ import { it, vi, } from 'vitest'; -import { useNFTContext } from '../NFTProvider'; +import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; import { NFTTotalCost } from './NFTTotalCost'; -vi.mock('../NFTProvider'); +vi.mock('../../../../core-react/nft/providers/NFTProvider'); describe('NFTTotalCost', () => { const mockUseNFTContext = useNFTContext as Mock; diff --git a/src/ui/react/nft/mint/NFTTotalCost.tsx b/src/ui/react/nft/mint/NFTTotalCost.tsx index f000905bcd..2376807f00 100644 --- a/src/ui/react/nft/mint/NFTTotalCost.tsx +++ b/src/ui/react/nft/mint/NFTTotalCost.tsx @@ -1,9 +1,9 @@ import { type ReactNode, useCallback, useMemo, useState } from 'react'; +import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; import { multiplyFloats } from '../../../../core/utils/multiplyFloats'; import { infoSvg } from '../../../../internal/svg/infoSvg'; import { background, border, cn, text } from '../../../../styles/theme'; import { formatAmount } from '../../../../token/utils/formatAmount'; -import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; type NFTTotalCostReact = { className?: string; diff --git a/src/ui/react/nft/view/NFTAudio.test.tsx b/src/ui/react/nft/view/NFTAudio.test.tsx index af462360cf..4a5bd2c52d 100644 --- a/src/ui/react/nft/view/NFTAudio.test.tsx +++ b/src/ui/react/nft/view/NFTAudio.test.tsx @@ -9,12 +9,12 @@ import { it, vi, } from 'vitest'; -import { useNFTContext } from '../NFTProvider'; +import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; import { NFTAudio } from './NFTAudio'; const mockAnimationUrl = 'https://example.com/audio.mp3'; -vi.mock('../NFTProvider', () => ({ +vi.mock('../../../../core-react/nft/providers/NFTProvider', () => ({ useNFTContext: vi.fn(), })); diff --git a/src/ui/react/nft/view/NFTAudio.tsx b/src/ui/react/nft/view/NFTAudio.tsx index c34c705f45..861065912e 100644 --- a/src/ui/react/nft/view/NFTAudio.tsx +++ b/src/ui/react/nft/view/NFTAudio.tsx @@ -5,9 +5,9 @@ import { useRef, useState, } from 'react'; -import { background, cn } from '../../../../styles/theme'; -import type { NFTError } from '../../../../core-react/nft/types'; import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; +import type { NFTError } from '../../../../core-react/nft/types'; +import { background, cn } from '../../../../styles/theme'; type NFTAudioReact = { className?: string; diff --git a/src/ui/react/nft/view/NFTImage.test.tsx b/src/ui/react/nft/view/NFTImage.test.tsx index 206f0c8df7..7e43e2f894 100644 --- a/src/ui/react/nft/view/NFTImage.test.tsx +++ b/src/ui/react/nft/view/NFTImage.test.tsx @@ -1,7 +1,7 @@ import '@testing-library/jest-dom'; import { fireEvent, render, waitFor } from '@testing-library/react'; import { type Mock, beforeEach, describe, expect, it, vi } from 'vitest'; -import { useNFTContext } from '../NFTProvider'; +import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; import { NFTImage } from './NFTImage'; const mockContext = { @@ -9,7 +9,7 @@ const mockContext = { description: 'Test NFT Image', }; -vi.mock('../NFTProvider', () => ({ +vi.mock('../../../../core-react/nft/providers/NFTProvider', () => ({ useNFTContext: vi.fn(), })); diff --git a/src/ui/react/nft/view/NFTImage.tsx b/src/ui/react/nft/view/NFTImage.tsx index 4ea745d019..3ec0d7c941 100644 --- a/src/ui/react/nft/view/NFTImage.tsx +++ b/src/ui/react/nft/view/NFTImage.tsx @@ -1,8 +1,8 @@ import { type MouseEvent, useCallback, useEffect, useState } from 'react'; +import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; +import type { NFTError } from '../../../../core-react/nft/types'; import { defaultNFTSvg } from '../../../../internal/svg/defaultNFTSvg'; import { cn } from '../../../../styles/theme'; -import type { NFTError } from '../../../../core-react/nft/types'; -import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; type NFTImageReact = { className?: string; diff --git a/src/ui/react/nft/view/NFTLastSoldPrice.test.tsx b/src/ui/react/nft/view/NFTLastSoldPrice.test.tsx index 10ced254f7..822eed0c92 100644 --- a/src/ui/react/nft/view/NFTLastSoldPrice.test.tsx +++ b/src/ui/react/nft/view/NFTLastSoldPrice.test.tsx @@ -9,10 +9,10 @@ import { it, vi, } from 'vitest'; -import { useNFTContext } from '../NFTProvider'; +import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; import { NFTLastSoldPrice } from './NFTLastSoldPrice'; -vi.mock('../NFTProvider', () => ({ +vi.mock('../../../../core-react/nft/providers/NFTProvider', () => ({ useNFTContext: vi.fn(), })); diff --git a/src/ui/react/nft/view/NFTLastSoldPrice.tsx b/src/ui/react/nft/view/NFTLastSoldPrice.tsx index 87cbf8fff7..12901ce27a 100644 --- a/src/ui/react/nft/view/NFTLastSoldPrice.tsx +++ b/src/ui/react/nft/view/NFTLastSoldPrice.tsx @@ -1,8 +1,8 @@ import type { ReactNode } from 'react'; +import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; import { cn, color, text } from '../../../../styles/theme'; import { formatAmount as formatSN } from '../../../../swap/utils/formatAmount'; import { formatAmount } from '../../../../token/utils/formatAmount'; -import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; type NFTLastSoldPriceReact = { className?: string; diff --git a/src/ui/react/nft/view/NFTMedia.test.tsx b/src/ui/react/nft/view/NFTMedia.test.tsx index 2356acd94b..f06ead4d16 100644 --- a/src/ui/react/nft/view/NFTMedia.test.tsx +++ b/src/ui/react/nft/view/NFTMedia.test.tsx @@ -1,15 +1,15 @@ import '@testing-library/jest-dom'; import { fireEvent, render } from '@testing-library/react'; import { type Mock, beforeEach, describe, expect, it, vi } from 'vitest'; -import { LifecycleType } from '../../types'; -import { useNFTLifecycleContext } from '../NFTLifecycleProvider'; -import { useNFTContext } from '../NFTProvider'; +import { useNFTLifecycleContext } from '../../../../core-react/nft/providers/NFTLifecycleProvider'; +import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; +import { LifecycleType } from '../../../../core-react/nft/types'; import { NFTMedia } from './NFTMedia'; -vi.mock('../NFTProvider', () => ({ +vi.mock('../../../../core-react/nft/providers/NFTProvider', () => ({ useNFTContext: vi.fn(), })); -vi.mock('../NFTLifecycleProvider', () => ({ +vi.mock('../../../../core-react/nft/providers/NFTLifecycleProvider', () => ({ useNFTLifecycleContext: vi.fn(), })); diff --git a/src/ui/react/nft/view/NFTMedia.tsx b/src/ui/react/nft/view/NFTMedia.tsx index e43928572f..710f5d8bcd 100644 --- a/src/ui/react/nft/view/NFTMedia.tsx +++ b/src/ui/react/nft/view/NFTMedia.tsx @@ -1,8 +1,12 @@ import { useCallback, useMemo } from 'react'; -import { cn } from '../../../../../styles/theme'; -import { LifecycleType, MediaType, type NFTError } from '../../../../../core/nft/types'; -import { useNFTLifecycleContext } from '../NFTLifecycleProvider'; -import { useNFTContext } from '../NFTProvider'; +import { useNFTLifecycleContext } from '../../../../core-react/nft/providers/NFTLifecycleProvider'; +import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; +import { + LifecycleType, + MediaType, + type NFTError, +} from '../../../../core-react/nft/types'; +import { cn } from '../../../../styles/theme'; import { NFTAudio } from './NFTAudio'; import { NFTImage } from './NFTImage'; import { NFTVideo } from './NFTVideo'; diff --git a/src/ui/react/nft/view/NFTMintDate.test.tsx b/src/ui/react/nft/view/NFTMintDate.test.tsx index 08f6f1ac93..0a6d313207 100644 --- a/src/ui/react/nft/view/NFTMintDate.test.tsx +++ b/src/ui/react/nft/view/NFTMintDate.test.tsx @@ -1,10 +1,10 @@ import '@testing-library/jest-dom'; import { render } from '@testing-library/react'; import { type Mock, beforeEach, describe, expect, it, vi } from 'vitest'; -import { useNFTContext } from '../NFTProvider'; +import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; import { NFTMintDate } from './NFTMintDate'; -vi.mock('../NFTProvider'); +vi.mock('../../../../core-react/nft/providers/NFTProvider'); describe('NFTMintDate', () => { const mockUseNFTContext = useNFTContext as Mock; diff --git a/src/ui/react/nft/view/NFTMintDate.tsx b/src/ui/react/nft/view/NFTMintDate.tsx index 44a63599d6..30253bddca 100644 --- a/src/ui/react/nft/view/NFTMintDate.tsx +++ b/src/ui/react/nft/view/NFTMintDate.tsx @@ -1,6 +1,6 @@ import { type ReactNode, useMemo } from 'react'; -import { cn, color, text } from '../../../../styles/theme'; import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; +import { cn, color, text } from '../../../../styles/theme'; const DATE_OPTIONS = { year: 'numeric', diff --git a/src/ui/react/nft/view/NFTOwner.test.tsx b/src/ui/react/nft/view/NFTOwner.test.tsx index b1490274e0..c4e81942a3 100644 --- a/src/ui/react/nft/view/NFTOwner.test.tsx +++ b/src/ui/react/nft/view/NFTOwner.test.tsx @@ -9,12 +9,12 @@ import { it, vi, } from 'vitest'; -import { useOnchainKit } from '../../../core-react/useOnchainKit'; -import { useNFTContext } from '../NFTProvider'; +import { useOnchainKit } from '../../../../core-react/useOnchainKit'; +import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; import { NFTOwner } from './NFTOwner'; -vi.mock('../../../core-react/useOnchainKit'); -vi.mock('../NFTProvider'); +vi.mock('../../../../core-react/useOnchainKit'); +vi.mock('../../../../core-react/nft/providers/NFTProvider'); vi.mock('../../../identity', async () => ({ ...(await vi.importActual('../../../identity')), Identity: ({ diff --git a/src/ui/react/nft/view/NFTTitle.test.tsx b/src/ui/react/nft/view/NFTTitle.test.tsx index 5911aa59f2..16f498e9cc 100644 --- a/src/ui/react/nft/view/NFTTitle.test.tsx +++ b/src/ui/react/nft/view/NFTTitle.test.tsx @@ -1,10 +1,10 @@ import '@testing-library/jest-dom'; import { render } from '@testing-library/react'; import { type Mock, describe, expect, it, vi } from 'vitest'; -import { useNFTContext } from '../NFTProvider'; +import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; import { NFTTitle } from './NFTTitle'; -vi.mock('../NFTProvider', () => ({ +vi.mock('../../../../core-react/nft/providers/NFTProvider', () => ({ useNFTContext: vi.fn(), })); diff --git a/src/ui/react/nft/view/NFTTitle.tsx b/src/ui/react/nft/view/NFTTitle.tsx index 36fb081724..b98c632550 100644 --- a/src/ui/react/nft/view/NFTTitle.tsx +++ b/src/ui/react/nft/view/NFTTitle.tsx @@ -1,5 +1,5 @@ -import { cn, text } from '../../../../styles/theme'; import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; +import { cn, text } from '../../../../styles/theme'; type NFTTitleReact = { className?: string; diff --git a/src/ui/react/nft/view/NFTVideo.tsx b/src/ui/react/nft/view/NFTVideo.tsx index ea3010cd15..240af97fbe 100644 --- a/src/ui/react/nft/view/NFTVideo.tsx +++ b/src/ui/react/nft/view/NFTVideo.tsx @@ -1,8 +1,8 @@ import { useEffect, useRef } from 'react'; +import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; +import type { NFTError } from '../../../../core-react/nft/types'; import { defaultNFTSvg } from '../../../../internal/svg/defaultNFTSvg'; import { cn } from '../../../../styles/theme'; -import type { NFTError } from '../../../../core-react/nft/types'; -import { useNFTContext } from '../../../../core-react/nft/providers/NFTProvider'; type NFTVideoReact = { className?: string;