Skip to content

Commit

Permalink
chore: add NEW badge
Browse files Browse the repository at this point in the history
  • Loading branch information
anxolin committed Jan 9, 2025
1 parent 863d399 commit d7022e7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion apps/cowswap-frontend/src/common/pure/NetworksList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { getChainInfo } from '@cowprotocol/common-const'
import { getExplorerBaseUrl } from '@cowprotocol/common-utils'
import { SupportedChainId } from '@cowprotocol/cow-sdk'
import { ExternalLink } from '@cowprotocol/ui'
import { Badge, BadgeTypes, Color, ExternalLink } from '@cowprotocol/ui'

import { Trans } from '@lingui/macro'

import * as styledEl from './styled'
import { AlertCircle } from 'react-feather'

const NEW_NETWORK_ID = 8453

export interface NetworksListProps {
currentChainId: SupportedChainId | null
Expand All @@ -25,11 +28,17 @@ export function NetworksList(props: NetworksListProps) {

const isActive = targetChainId === currentChainId
const logoUrl = getLogo(isDarkMode, isActive, logo.dark, logo.light)
const isNewNetwork = targetChainId === NEW_NETWORK_ID

const rowContent = (
<styledEl.FlyoutRow key={targetChainId} onClick={() => onSelectChain(targetChainId)} active={isActive}>
<styledEl.Logo src={logoUrl} />
<styledEl.NetworkLabel>{label}</styledEl.NetworkLabel>
{isNewNetwork && (
<Badge type={BadgeTypes.ALERT} style={{ marginLeft: 'auto' }}>
NEW
</Badge>
)}
{isActive && <styledEl.FlyoutRowActiveIndicator active />}
</styledEl.FlyoutRow>
)
Expand Down

0 comments on commit d7022e7

Please sign in to comment.