Skip to content

Commit

Permalink
Merge pull request #293 from pshenmic/fix/network-selector
Browse files Browse the repository at this point in the history
Fix network selector
  • Loading branch information
pshenmic authored Oct 25, 2024
2 parents 980b4d2 + 0df1586 commit 3580ee9
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/frontend/src/app/validator/[hash]/Validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function Validator ({ hash }) {
const [withdrawals, setWithdrawals] = useState({ data: {}, props: { currentPage: 0 }, loading: true, error: false })
const [activeChartTab, setActiveChartTab] = useState(0)
const baseUrl = process.env.NEXT_PUBLIC_BASE_URL
const activeNetwork = networks.find(network => network.apiBaseUrl === baseUrl)
const activeNetwork = networks.find(network => network.explorerBaseUrl === baseUrl)
const l1explorerBaseUrl = activeNetwork?.l1explorerBaseUrl || null

const poseStatusColor = (validator.data?.proTxInfo?.state?.PoSeBanHeight > 0 &&
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/src/components/layout/navbar/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import './NetworkSelect.scss'
// props.data - The data array [{ name: '', subname: '', disabled: boolean, link: '' }]
function Dropdown ({ active, data }) {
const ButtonContainer = ({ item, children }) => item.name !== active
? <a href={item.link} rel={'noopener noreferrer'}>{children}</a>
: <>{children}</>
? <a href={item.explorerBaseUrl} rel={'noopener noreferrer'}>{children}</a>
: children

return (
<div className={'InternalNavigation'}>
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/layout/navbar/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function Navbar () {
<IconButton
className={'Navbar__Burger'}
size={'md'}
icon={isOpen ? <CloseIcon /> : <HamburgerIcon />}
icon={isOpen ? <CloseIcon/> : <HamburgerIcon/>}
aria-label={'Open Menu'}
display={{ lg: 'none' }}
onClick={isOpen ? onClose : onOpen}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { networks } from '../../../constants/networks'

function NetworkSelect () {
const baseUrl = process.env.NEXT_PUBLIC_BASE_URL
const activeNetwork = networks.find(network => network.apiBaseUrl === baseUrl)
const activeNetwork = networks.find(network => network.explorerBaseUrl === baseUrl)
const [showDropdown, setShowDropdown] = useState(false)

return (
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/src/constants/networks.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ export const networks = [
name: 'mainnet',
subname: '',
disabled: false,
apiBaseUrl: 'https://platform-explorer.com',
explorerBaseUrl: 'https://platform-explorer.com',
l1explorerBaseUrl: 'https://insight.dash.org/insight'
},
{
name: 'testnet',
subname: '',
disabled: false,
apiBaseUrl: 'https://testnet.platform-explorer.com',
explorerBaseUrl: 'https://testnet.platform-explorer.com',
l1explorerBaseUrl: 'http://insight.testnet.networks.dash.org:3001/insight'
}
]

0 comments on commit 3580ee9

Please sign in to comment.