Browse Source

Add check for undefined hopsAway (#616)

* Add check for undefined hopsAway

Better UI for already "fixed" #351

* Change conditional
pull/620/head
philon- 1 year ago
committed by GitHub
parent
commit
b2bb3baa01
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 7
      src/pages/Nodes.tsx

7
src/pages/Nodes.tsx

@ -79,7 +79,6 @@ const NodesPage = (): JSX.Element => {
}, },
[hardware.myNodeNum], [hardware.myNodeNum],
); );
return ( return (
<> <>
<PageLayout <PageLayout
@ -125,14 +124,14 @@ const NodesPage = (): JSX.Element => {
{node.user?.longName ?? numberToHexUnpadded(node.num)} {node.user?.longName ?? numberToHexUnpadded(node.num)}
</h1>, </h1>,
<Mono key="hops" className="w-16"> <Mono key="hops" className="w-16">
{node.lastHeard !== 0 {node.hopsAway !== undefined
? node.viaMqtt === false && node.hopsAway === 0 ? node?.viaMqtt === false && node.hopsAway === 0
? "Direct" ? "Direct"
: `${node.hopsAway?.toString()} ${ : `${node.hopsAway?.toString()} ${
node.hopsAway ?? 0 > 1 ? "hops" : "hop" node.hopsAway ?? 0 > 1 ? "hops" : "hop"
} away` } away`
: "-"} : "-"}
{node.viaMqtt === true ? ", via MQTT" : ""} {node?.viaMqtt === true ? ", via MQTT" : ""}
</Mono>, </Mono>,
<Mono key="lastHeard"> <Mono key="lastHeard">
{node.lastHeard === 0 {node.lastHeard === 0

Loading…
Cancel
Save