Skip to content

Commit

Permalink
chore: Disable BridgeSwap temporarily
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinciarka committed Jul 16, 2024
1 parent 724f176 commit efef292
Showing 1 changed file with 8 additions and 38 deletions.
46 changes: 8 additions & 38 deletions apps/rays-dashboard/components/molecules/BridgeSwap/BridgeSwap.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
import { useEffect, useMemo } from 'react'
import { LiFiWalletManagement, supportedWallets } from '@lifi/wallet-management'
import { LiFiWidget } from '@lifi/widget'
import { Button } from '@summerfi/app-ui'
import { Button, Text } from '@summerfi/app-ui'
import { IconX } from '@tabler/icons-react'
import { useConnectWallet } from '@web3-onboard/react'

import { BridgeSwapOnboarding } from '@/components/molecules/BridgeSwap/BridgeSwapOnboarding'
import { swapWidgetConfig } from '@/constants/swap-widget-config'
import { useOnboarding } from '@/helpers/use-onboarding'

import bridgeSwapHandlerStyles from './BridgeSwapHandler.module.scss'

Expand All @@ -16,37 +8,15 @@ type BridgeSwapHandlerProps = {
setShowNavigationModule: (show: 'swap' | 'bridge' | undefined) => void
}

export default ({ showNavigationModule, setShowNavigationModule }: BridgeSwapHandlerProps) => {
const [{ wallet }] = useConnectWallet()
const [isOnboarded] = useOnboarding('SwapWidget')
const walletManagement = useMemo(() => new LiFiWalletManagement(), [])

useEffect(() => {
async function autoConnectLiFi() {
if (!wallet || !isOnboarded) {
const activeWallets = supportedWallets.filter(
(supportedWallet) => wallet?.label === supportedWallet.name,
)

if (!activeWallets.length) {
return
}
await walletManagement.connect(activeWallets[0])
}
}
void autoConnectLiFi()
}, [isOnboarded, wallet, walletManagement])

export default ({
showNavigationModule: _showNavigationModule,
setShowNavigationModule,
}: BridgeSwapHandlerProps) => {
return (
<>
{!isOnboarded ? (
<BridgeSwapOnboarding />
) : (
<LiFiWidget
integrator={swapWidgetConfig.integrator}
config={{ ...swapWidgetConfig, subvariantOptions: showNavigationModule }}
/>
)}
<Text as="p" style={{ textAlign: 'center', marginTop: '128px' }}>
Disabled temporarily.
</Text>
<Button
variant="unstyled"
onClick={() => {
Expand Down

0 comments on commit efef292

Please sign in to comment.