diff --git a/packages/frontend/src/components/Header/Header.tsx b/packages/frontend/src/components/Header/Header.tsx index 60b407be..1e05eea0 100644 --- a/packages/frontend/src/components/Header/Header.tsx +++ b/packages/frontend/src/components/Header/Header.tsx @@ -2,13 +2,11 @@ import { FunctionComponent } from 'react'; import { Navbar } from '@sifi/shared-ui'; import logo from 'src/assets/logoWhite.svg'; import HeaderMenu from '../HeaderMenu/HeaderMenu'; -import { HeaderChainSelector } from '../HeaderChainSelector/HeaderChainSelector'; const Header: FunctionComponent = () => { return ( <> - diff --git a/packages/frontend/src/components/HeaderChainSelector/HeaderChainSelector.stories.tsx b/packages/frontend/src/components/HeaderChainSelector/HeaderChainSelector.stories.tsx deleted file mode 100644 index e60f2986..00000000 --- a/packages/frontend/src/components/HeaderChainSelector/HeaderChainSelector.stories.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { userEvent, within } from '@storybook/testing-library'; -import { HeaderChainSelector } from './HeaderChainSelector'; -import { MockWagmiDecorator } from '../../../.storybook/decorators/wagmiDecorator'; - -export default { - title: 'Components/HeaderChainSelector', - component: HeaderChainSelector, - decorators: [MockWagmiDecorator()], -}; - -const Default = () => ; - -const Open = () => ; - -Open.play = async ({ canvasElement }: { canvasElement: HTMLElement }) => { - const canvas = within(canvasElement); - userEvent.click(await canvas.findByRole('button')); -}; - -export { Default, Open }; diff --git a/packages/frontend/src/components/HeaderChainSelector/HeaderChainSelector.tsx b/packages/frontend/src/components/HeaderChainSelector/HeaderChainSelector.tsx deleted file mode 100644 index 8cebf2cc..00000000 --- a/packages/frontend/src/components/HeaderChainSelector/HeaderChainSelector.tsx +++ /dev/null @@ -1,99 +0,0 @@ -import { Fragment } from 'react'; -import { Listbox, Transition } from '@headlessui/react'; -import { ReactComponent as DownCaret } from 'src/assets/down-caret.svg'; -import { SUPPORTED_CHAINS, getChainIcon } from 'src/utils/chains'; -import { Chain, useNetwork, useSwitchNetwork } from 'wagmi'; -import { SwapFormKey } from 'src/providers/SwapFormProvider'; -import { useFormContext } from 'react-hook-form'; -import { useSwapFormValues } from 'src/hooks/useSwapFormValues'; - -const HeaderChainSelector: React.FC = () => { - const { chain: activeChain } = useNetwork(); - const { switchNetwork } = useSwitchNetwork(); - const { setValue } = useFormContext(); - const { fromChain } = useSwapFormValues(); - - const handleChange = (chain: Chain) => { - setValue(SwapFormKey.FromChain, chain); - - if (!switchNetwork) return; - - switchNetwork(chain.id); - }; - - return ( -
- -
- - {fromChain && ( - {fromChain.name} - )} - - - -
- {Object.values(SUPPORTED_CHAINS).map(chain => ( - - `dark:text-flashbang-white text-new-black font-display block cursor-pointer text-left text-base no-underline transition` - } - value={chain} - > - {({ selected }) => ( -
-
-
- {chain.name} -
- {chain.name} -
- {chain.id === activeChain?.id && ( -
-
-
- )} -
- )} - - ))} -
- - -
- -
- ); -}; - -export { HeaderChainSelector };