Skip to content

Commit

Permalink
Update HomePage graph labels for localnet
Browse files Browse the repository at this point in the history
  • Loading branch information
buberdds committed Nov 11, 2024
1 parent 75262ee commit 2038749
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 26 deletions.
46 changes: 21 additions & 25 deletions src/app/pages/HomePage/Graph/Graph/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
useMemo,
useState,
} from 'react'
import { RouteUtils } from '../../../../utils/route-utils'
import { RouteUtils, isLocalnet } from '../../../../utils/route-utils'
import { useScreenSize } from '../../../../hooks/useScreensize'
import { Layer } from '../../../../../oasis-nexus/api'
import { Network } from '../../../../../types/network'
Expand Down Expand Up @@ -42,6 +42,22 @@ interface GraphStyledProps extends GraphBaseProps {
hoveredLayer: Layer | null
}

const LayerNotEnabledLabel = ({ network }: { network: Network }) => {
const { t } = useTranslation()
const isLocal = isLocalnet(network)

return (
<>
<tspan dx="-4" dy="-5">
{isLocal ? t('home.not') : t('home.coming')}
</tspan>
<tspan dx="-35" dy="12">
{isLocal ? t('home.enabled') : t('home.soon')}
</tspan>
</>
)
}

const GraphStyled = styled('svg', {
shouldForwardProp: prop =>
!(['disabled', 'transparent', 'selectedArea', 'hoveredLayer'] as (keyof GraphStyledProps)[]).includes(
Expand Down Expand Up @@ -604,12 +620,7 @@ const GraphCmp: ForwardRefRenderFunction<SVGSVGElement, GraphProps> = (
)}
{!isMobile && hoveredLayer === Layer.emerald && disabledMap[Layer.emerald] && (
<text x="177.4" y="97" fill={graphTheme.hoverText} fontSize="12px" fontWeight="700">
<tspan dx="-4" dy="-5">
{t('home.coming')}
</tspan>
<tspan dx="-35" dy="12">
{t('home.soon')}
</tspan>
<LayerNotEnabledLabel network={network} />
</text>
)}
</g>
Expand Down Expand Up @@ -660,12 +671,7 @@ const GraphCmp: ForwardRefRenderFunction<SVGSVGElement, GraphProps> = (
)}
{!isMobile && hoveredLayer === Layer.sapphire && disabledMap[Layer.sapphire] && (
<text x="106" y="305" fill={graphTheme.hoverText} fontSize="12px" fontWeight="700">
<tspan dx="-4" dy="-5">
{t('home.coming')}
</tspan>
<tspan dx="-35" dy="12">
{t('home.soon')}
</tspan>
<LayerNotEnabledLabel network={network} />
</text>
)}
</g>
Expand Down Expand Up @@ -737,12 +743,7 @@ const GraphCmp: ForwardRefRenderFunction<SVGSVGElement, GraphProps> = (
)}
{!isMobile && hoveredLayer === Layer.consensus && disabledMap[Layer.consensus] && (
<text x="170" y="212" fill={graphTheme.hoverText} fontSize="12px" fontWeight="700">
<tspan dx="-4" dy="-5">
{t('home.coming')}
</tspan>
<tspan dx="-35" dy="12">
{t('home.soon')}
</tspan>
<LayerNotEnabledLabel network={network} />
</text>
)}
</g>
Expand Down Expand Up @@ -786,12 +787,7 @@ const GraphCmp: ForwardRefRenderFunction<SVGSVGElement, GraphProps> = (
)}
{!isMobile && hoveredLayer === Layer.cipher && disabledMap[Layer.cipher] && (
<text x="290" y="205" fill={graphTheme.hoverText} fontSize="12px" fontWeight="700">
<tspan dx="-4" dy="-5">
{t('home.coming')}
</tspan>
<tspan dx="-35" dy="12">
{t('home.soon')}
</tspan>
<LayerNotEnabledLabel network={network} />
</text>
)}
</g>
Expand Down
4 changes: 3 additions & 1 deletion src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,9 @@
},
"selectedNetwork": "Selected network",
"coming": "Coming",
"soon": "soon"
"soon": "soon",
"not": "Not",
"enabled": "enabled"
},
"paratimes": {
"activeNodes": "{{nodes}} active",
Expand Down

0 comments on commit 2038749

Please sign in to comment.