Skip to content

Commit

Permalink
chore: migrate internal
Browse files Browse the repository at this point in the history
  • Loading branch information
alessey committed Dec 17, 2024
1 parent 7e1e569 commit 9dbd68e
Show file tree
Hide file tree
Showing 80 changed files with 71 additions and 89 deletions.
2 changes: 1 addition & 1 deletion src/checkout/components/CheckoutButton.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ vi.mock('./CheckoutProvider', () => ({
useCheckoutContext: vi.fn(),
}));

vi.mock('../../internal/components/Spinner', () => ({
vi.mock('@/ui-react/internal/Spinner', () => ({
Spinner: () => <div data-testid="spinner">Loading...</div>,
}));

Expand Down
3 changes: 1 addition & 2 deletions src/checkout/components/CheckoutButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Spinner } from '@/ui-react/internal/Spinner';
import { useMemo } from 'react';
import { Spinner } from '../../internal/components/Spinner';

import { useIcon } from '../../core-react/internal/hooks/useIcon';
import {
border,
Expand Down
8 changes: 4 additions & 4 deletions src/core-react/internal/hooks/useIcon.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { coinbasePaySvg } from '@/core/svg/coinbasePaySvg';
import { fundWalletSvg } from '@/core/svg/fundWallet';
import { swapSettingsSvg } from '@/core/svg/swapSettings';
import { walletSvg } from '@/core/svg/walletSvg';
import { renderHook } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import { coinbasePaySvg } from '../../../internal/svg/coinbasePaySvg';
import { fundWalletSvg } from '../../../internal/svg/fundWallet';
import { swapSettingsSvg } from '../../../internal/svg/swapSettings';
import { walletSvg } from '../../../internal/svg/walletSvg';
import { useIcon } from './useIcon';

describe('useIcon', () => {
Expand Down
8 changes: 4 additions & 4 deletions src/core-react/internal/hooks/useIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { coinbasePaySvg } from '@/core/svg/coinbasePaySvg';
import { fundWalletSvg } from '@/core/svg/fundWallet';
import { swapSettingsSvg } from '@/core/svg/swapSettings';
import { walletSvg } from '@/core/svg/walletSvg';
import { isValidElement, useMemo } from 'react';
import { coinbasePaySvg } from '../../../internal/svg/coinbasePaySvg';
import { fundWalletSvg } from '../../../internal/svg/fundWallet';
import { swapSettingsSvg } from '../../../internal/svg/swapSettings';
import { walletSvg } from '../../../internal/svg/walletSvg';

export const useIcon = ({ icon }: { icon?: React.ReactNode }) => {
return useMemo(() => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/fund/components/FundButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { addSvg } from '@/core/svg/addSvg';
import { useCallback } from 'react';
import { useTheme } from '../../core-react/internal/hooks/useTheme';
import { addSvg } from '../../internal/svg/addSvg';
import { border, cn, color, pressable, text } from '../../styles/theme';

import { openPopup } from '@/ui-react/internal/utils/openPopup';
Expand Down
4 changes: 2 additions & 2 deletions src/identity/components/Avatar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defaultAvatarSVG } from '@/core/svg/defaultAvatarSVG';
import { defaultLoadingSVG } from '@/core/svg/defaultLoadingSVG';
import { Children, useMemo } from 'react';
import { findComponent } from '../../core-react/internal/utils/findComponent';
import { defaultAvatarSVG } from '../../internal/svg/defaultAvatarSVG';
import { defaultLoadingSVG } from '../../internal/svg/defaultLoadingSVG';
import { cn } from '../../styles/theme';
import { useAvatar } from '../hooks/useAvatar';
import { useName } from '../hooks/useName';
Expand Down
2 changes: 1 addition & 1 deletion src/identity/components/Badge.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { badgeSvg } from '../../internal/svg/badgeSvg';
import { badgeSvg } from '@/core/svg/badgeSvg';
import { background, cn } from '../../styles/theme';
import type { BadgeReact } from '../types';

Expand Down
10 changes: 5 additions & 5 deletions src/identity/utils/getSocialPlatformDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { githubSvg } from '../../internal/svg/githubSvg';
import { twitterSvg } from '../../internal/svg/twitterSvg';
import { warpcastSvg } from '../../internal/svg/warpcastSvg';
import { websiteSvg } from '../../internal/svg/websiteSvg';
import { border, cn, pressable } from '../../styles/theme';
import { githubSvg } from '@/core/svg/githubSvg';
import { twitterSvg } from '@/core/svg/twitterSvg';
import { warpcastSvg } from '@/core/svg/warpcastSvg';
import { websiteSvg } from '@/core/svg/websiteSvg';
import { border, cn, pressable } from '@/styles/theme';

export type SocialPlatform = 'twitter' | 'github' | 'farcaster' | 'website';

Expand Down
23 changes: 0 additions & 23 deletions src/internal/svg/disconnectSvg.stories.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/swap/components/Swap.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ vi.mock('./SwapProvider', () => ({
useSwapContext: vi.fn(),
}));

vi.mock('../../internal/svg/closeSvg', () => ({
vi.mock('@/core/svg/closeSvg', () => ({
CloseSvg: () => <div data-testid="mock-close-svg" />,
}));

Expand Down
2 changes: 1 addition & 1 deletion src/swap/components/SwapAmountInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useCallback, useEffect, useMemo } from 'react';
import { useValue } from '../../core-react/internal/hooks/useValue';
import { getRoundedAmount } from '../../core/utils/getRoundedAmount';
import { isValidAmount } from '../../core/utils/isValidAmount';
import { TextInput } from '../../internal/components/TextInput';
import {
background,
border,
Expand All @@ -13,6 +12,7 @@ import {
} from '../../styles/theme';
import { TokenChip, TokenSelectDropdown } from '../../token';
import type { Token } from '../../token';
import { TextInput } from '../../ui/react/internal/TextInput';
import type { SwapAmountInputReact } from '../types';
import { formatAmount } from '../utils/formatAmount';
import { useSwapContext } from './SwapProvider';
Expand Down
2 changes: 1 addition & 1 deletion src/swap/components/SwapButton.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ vi.mock('./SwapProvider', () => ({
useSwapContext: vi.fn(),
}));

vi.mock('../../internal/components/Spinner', () => ({
vi.mock('@/ui-react/internal/Spinner', () => ({
Spinner: () => <div data-testid="spinner">Loading...</div>,
}));

Expand Down
2 changes: 1 addition & 1 deletion src/swap/components/SwapButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Spinner } from '../../internal/components/Spinner';
import { Spinner } from '@/ui-react/internal/Spinner';
import {
background,
border,
Expand Down
4 changes: 2 additions & 2 deletions src/swap/components/SwapToast.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { useCallback } from 'react';
import { cn, color, text } from '../../styles/theme';

import { successSvg } from '@/core/svg/successSvg';
import { useAccount } from 'wagmi';
import { getChainExplorer } from '../../core/network/getChainExplorer';
import { Toast } from '../../internal/components/Toast';
import { successSvg } from '../../internal/svg/successSvg';
import { Toast } from '../../ui/react/internal/Toast';
import type { SwapToastReact } from '../types';
import { useSwapContext } from './SwapProvider';

Expand Down
2 changes: 1 addition & 1 deletion src/swap/components/SwapToggleButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { toggleSvg } from '../../internal/svg/toggleSvg';
import { toggleSvg } from '@/core/svg/toggleSvg';
import { border, cn, pressable } from '../../styles/theme';
import type { SwapToggleButtonReact } from '../types';
import { useSwapContext } from './SwapProvider';
Expand Down
6 changes: 3 additions & 3 deletions src/token/components/TokenSearch.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { closeSvg } from '@/core/svg/closeSvg';
import { searchIconSvg } from '@/core/svg/searchIconSvg';
import { useCallback, useState } from 'react';
import { useTheme } from '../../core-react/internal/hooks/useTheme';
import { TextInput } from '../../internal/components/TextInput';
import { closeSvg } from '../../internal/svg/closeSvg';
import { searchIconSvg } from '../../internal/svg/searchIconSvg';
import { cn, color, placeholder, pressable } from '../../styles/theme';
import { TextInput } from '../../ui/react/internal/TextInput';
import type { TokenSearchReact } from '../types';

export function TokenSearch({
Expand Down
4 changes: 2 additions & 2 deletions src/token/components/TokenSelectButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { caretDownSvg } from '@/core/svg/caretDownSvg';
import { caretUpSvg } from '@/core/svg/caretUpSvg';
import { type ForwardedRef, forwardRef } from 'react';
import { caretDownSvg } from '../../internal/svg/caretDownSvg';
import { caretUpSvg } from '../../internal/svg/caretUpSvg';
import { border, cn, color, pressable, text } from '../../styles/theme';
import type { TokenSelectButtonReact } from '../types';
import { TokenImage } from './TokenImage';
Expand Down
2 changes: 1 addition & 1 deletion src/transaction/components/TransactionButton.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useCallback, useMemo } from 'react';
import { useAccount, useChainId } from 'wagmi';
import { getChainExplorer } from '../../core/network/getChainExplorer';
import { Spinner } from '../../internal/components/Spinner';
import { border, cn, color, pressable, text } from '../../styles/theme';
import { Spinner } from '../../ui/react/internal/Spinner';
import type { TransactionButtonReact } from '../types';
import { isSpinnerDisplayed } from '../utils/isSpinnerDisplayed';
import { useTransactionContext } from './TransactionProvider';
Expand Down
2 changes: 1 addition & 1 deletion src/transaction/components/TransactionToast.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useCallback } from 'react';
import { Toast } from '../../internal/components/Toast';
import { Toast } from '../../ui/react/internal/Toast';
import type { TransactionToastReact } from '../types';
import { useTransactionContext } from './TransactionProvider';

Expand Down
6 changes: 3 additions & 3 deletions src/transaction/components/TransactionToastIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { errorSvg } from '@/core/svg/errorSvg';
import { successSvg } from '@/core/svg/successSvg';
import { useMemo } from 'react';
import { Spinner } from '../../internal/components/Spinner';
import { errorSvg } from '../../internal/svg/errorSvg';
import { successSvg } from '../../internal/svg/successSvg';
import { cn, text } from '../../styles/theme';
import { Spinner } from '../../ui/react/internal/Spinner';
import type { TransactionToastIconReact } from '../types';
import { useTransactionContext } from './TransactionProvider';

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { zIndex } from '@/styles/constants';
import { cn } from '@/styles/theme';
import { useCallback, useEffect, useState } from 'react';
import { zIndex } from '../../styles/constants';
import { cn } from '../../styles/theme';

type DraggableProps = {
children: React.ReactNode;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { cbwSvg } from '@/core/svg/cbwSvg';
import { render, screen } from '@testing-library/react';
import { describe, expect, it, vi } from 'vitest';
import { cbwSvg } from '../../svg/cbwSvg';
import { QrCodeSvg } from './QrCodeSvg';

vi.mock('../../../core-react/internal/hooks/useTheme', () => ({
vi.mock('../../../../core-react/internal/hooks/useTheme', () => ({
useTheme: vi.fn(() => 'default'),
}));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useId, useMemo } from 'react';
import { useTheme } from '../../../core-react/internal/hooks/useTheme';
import { useTheme } from '../../../../core-react/internal/hooks/useTheme';
import {
GRADIENT_END_COORDINATES,
GRADIENT_START_COORDINATES,
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { cbwSvg } from '@/core/svg/cbwSvg';
import React, { useMemo } from 'react';
import ReactDOMServer from 'react-dom/server';
import { cbwSvg } from '../../svg/cbwSvg';

type RenderLogoProps = {
size: number;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
it,
vi,
} from 'vitest';
import { pressable } from '../../styles/theme';
import { pressable } from '../../../styles/theme';
import { DELAY_MS, QuantitySelector } from './QuantitySelector';

describe('QuantitySelector component', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { TextInput } from '@/ui-react/internal/TextInput';
import { useCallback, useState } from 'react';
import { TextInput } from '../../internal/components/TextInput';
import { background, border, cn, color, pressable } from '../../styles/theme';
import {
background,
border,
cn,
color,
pressable,
} from '../../../styles/theme';

export const DELAY_MS = 200;

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cn } from '../../styles/theme';
import { cn } from '../../../styles/theme';

type SpinnerReact = {
className?: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useCallback } from 'react';
import type { ChangeEvent } from 'react';
import { useDebounce } from '../../core-react/internal/hooks/useDebounce';
import { useDebounce } from '../../../core-react/internal/hooks/useDebounce';

type TextInputReact = {
'aria-label'?: string;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { closeSvg } from '@/core/svg/closeSvg';
import { useEffect } from 'react';
import { background, cn } from '../../styles/theme';
import { getToastPosition } from '../../ui/react/internal/utils/getToastPosition';
import { closeSvg } from '../svg/closeSvg';
import { background, cn } from '../../../styles/theme';
import { getToastPosition } from './utils/getToastPosition';

type ToastProps = {
className?: string;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/react/nft/mint/NFTMintButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useNFTLifecycleContext } from '@/core-react/nft/providers/NFTLifecycleP
import { useNFTContext } from '@/core-react/nft/providers/NFTProvider';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { useAccount, useChainId } from 'wagmi';
import { Spinner } from '../../../../internal/components/Spinner';
import { cn, color, text } from '../../../../styles/theme';
import {
Transaction,
Expand All @@ -16,6 +15,7 @@ import {
} from '../../../../transaction';
import type { Call } from '../../../../transaction/types';
import { ConnectWallet } from '../../../../wallet';
import { Spinner } from '../../internal/Spinner';

type NFTMintButtonReact = {
className?: string;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/react/nft/mint/NFTQuantitySelector.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { NFTQuantitySelector } from './NFTQuantitySelector';

vi.mock('@/core-react/nft/providers/NFTProvider');

vi.mock('../../../../internal/components/QuantitySelector', () => ({
vi.mock('@/ui-react/internal/QuantitySelector', () => ({
QuantitySelector: ({
onChange,
minQuantity,
Expand Down
2 changes: 1 addition & 1 deletion src/ui/react/nft/mint/NFTQuantitySelector.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useNFTContext } from '@/core-react/nft/providers/NFTProvider';
import { QuantitySelector } from '../../../../internal/components/QuantitySelector';
import { QuantitySelector } from '@/ui-react/internal/QuantitySelector';
import { cn } from '../../../../styles/theme';

type NFTQuantitySelectorReact = {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/react/nft/mint/NFTTotalCost.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useNFTContext } from '@/core-react/nft/providers/NFTProvider';
import { infoSvg } from '@/core/svg/infoSvg';
import { multiplyFloats } from '@/core/utils/multiplyFloats';
import { type ReactNode, useCallback, useMemo, useState } from 'react';
import { infoSvg } from '../../../../internal/svg/infoSvg';
import { background, border, cn, text } from '../../../../styles/theme';
import { formatAmount } from '../../../../token/utils/formatAmount';

Expand Down
2 changes: 1 addition & 1 deletion src/ui/react/nft/view/NFTImage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useNFTContext } from '@/core-react/nft/providers/NFTProvider';
import type { NFTError } from '@/core/api/types';
import { defaultNFTSvg } from '@/core/svg/defaultNFTSvg';
import { type MouseEvent, useCallback, useEffect, useState } from 'react';
import { defaultNFTSvg } from '../../../../internal/svg/defaultNFTSvg';
import { cn } from '../../../../styles/theme';

type NFTImageReact = {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/react/nft/view/NFTNetwork.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { baseSvg } from '@/core/svg/baseSvg';
import type { ReactNode } from 'react';
import { type Chain, base } from 'viem/chains';
import { useChainId } from 'wagmi';
import { baseSvg } from '../../../../internal/svg/baseSvg';
import { cn, color, text } from '../../../../styles/theme';

type NFTNetworkReact = {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/react/nft/view/NFTVideo.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useNFTContext } from '@/core-react/nft/providers/NFTProvider';
import type { NFTError } from '@/core/api/types';
import { useEffect, useRef } from 'react';
import { defaultNFTSvg } from '../../../../internal/svg/defaultNFTSvg';
import { defaultNFTSvg } from '../../../../core/svg/defaultNFTSvg';
import { cn } from '../../../../styles/theme';

type NFTVideoReact = {
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/components/ConnectWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { useAccount, useConnect } from 'wagmi';
import { findComponent } from '../../core-react/internal/utils/findComponent';
import { useOnchainKit } from '../../core-react/useOnchainKit';
import { IdentityProvider } from '../../identity/components/IdentityProvider';
import { Spinner } from '../../internal/components/Spinner';
import {
border,
cn,
color,
text as dsText,
pressable,
} from '../../styles/theme';
import { Spinner } from '../../ui/react/internal/Spinner';
import type { ConnectWalletReact } from '../types';
import { ConnectButton } from './ConnectButton';
import { ConnectWalletText } from './ConnectWalletText';
Expand Down
4 changes: 2 additions & 2 deletions src/wallet/components/WalletDropdownBasename.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { basenameSvg } from '@/core/svg/basenameSvg';
import { base } from 'viem/chains';
import { useAccount } from 'wagmi';
import { useName } from '../../identity/hooks/useName';
import { Spinner } from '../../internal/components/Spinner';
import { basenameSvg } from '../../internal/svg/basenameSvg';
import { cn, color, pressable, text } from '../../styles/theme';
import { Spinner } from '../../ui/react/internal/Spinner';
import type { WalletDropdownBasenameReact } from '../types';

export function WalletDropdownBasename({
Expand Down
Loading

0 comments on commit 9dbd68e

Please sign in to comment.