Skip to content

Commit

Permalink
fix switching to logged in network
Browse files Browse the repository at this point in the history
  • Loading branch information
aeddaqqa committed Nov 20, 2023
1 parent 4fc5da4 commit 732325e
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions src/components/Navbar/NetworkSwitcher.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import React from 'react'
import { mdiDeleteOutline, mdiPencilOutline, mdiPlus } from '@mdi/js'
import Icon from '@mdi/react'
import {
Box,
Button,
MenuItem,
Typography,
Select,
Chip,
DialogTitle,
useTheme,
IconButton,
MenuItem,
MenuList,
Select,
Stack,
Box,
Chip,
IconButton,
Typography,
useTheme,
} from '@mui/material'
import { mdiDeleteOutline, mdiPencilOutline, mdiPlus } from '@mdi/js'
import React from 'react'
import useNetwork from '../../hooks/useNetwork'
import { networkStatusColor, networkStatusName } from '../../utils/networkUtils'
import DialogAnimate from '../Animate/DialogAnimate'
import MHidden from '../@material-extend/MHidden'
import DialogAnimate from '../Animate/DialogAnimate'
import AddNewNetwork from './AddNewNetwork'
import SelectedNetwork from './SelectNetwork'
import useNetwork from '../../hooks/useNetwork'

interface NetworkSwitcherProps {
handleCloseSidebar?: () => void
Expand Down Expand Up @@ -90,8 +90,12 @@ export default function NetworkSwitcher({ handleCloseSidebar }: NetworkSwitcherP
flexDirection: 'column',
alignItems: 'baseline',
color: theme.palette.text.primary,
...(network.name === activeNetwork.name && { cursor: 'auto' }),
}}
onClick={() => {
if (network.name === activeNetwork.name) return
changeNetwork(network.name)
}}
onClick={() => changeNetwork(network.name)}
>
<Stack
direction="row"
Expand Down Expand Up @@ -195,9 +199,14 @@ export default function NetworkSwitcher({ handleCloseSidebar }: NetworkSwitcherP
value={network.name}
divider
onClick={() => {
if (network.name === activeNetwork.name) return
handleChangeNetwork(network.name)
}}
sx={{ gap: '.6rem', justifyContent: 'space-between' }}
sx={{
gap: '.6rem',
justifyContent: 'space-between',
...(network.name === activeNetwork.name && { cursor: 'auto' }),
}}
data-cy={`network-name-${network.name}`}
>
<Typography variant="body2" component="span" noWrap>
Expand Down

0 comments on commit 732325e

Please sign in to comment.