Skip to content

Commit

Permalink
Add more endpoints for the Kusama network and allow switching endpoin…
Browse files Browse the repository at this point in the history
…t after a connection error (#151)

* [MapNodeInfo] allow switching networks upon connection error

* [MapNodeInfoSwitchWidget] add other endpoints that have offchain indexing enabled.

* [MapNodeInfo] betting text rendering

* [MapNodeInfo] decrease size off the error display
  • Loading branch information
clangenb authored Jul 22, 2024
1 parent a998585 commit ffea513
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 18 deletions.
42 changes: 25 additions & 17 deletions src/map/MapNodeInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ function MapNodeInfoMain (props) {
}, [system]);

return (
<Card className='encointer-map-node-info' style={props.style || {}}>{
apiState === 'READY'
? <React.Fragment>
<Card.Content className='info' onClick={onClickNode}>
<Card.Header>{nodeInfo.nodeName} <Icon name='chevron down' /></Card.Header>
<Card.Meta>{`${nodeInfo.chain || ''} v${nodeInfo.nodeVersion}`}</Card.Meta>
</Card.Content>
<Card.Content className='blocks'>
<Card className='encointer-map-node-info' style={props.style || {}}>
<Card.Content className='info' onClick={onClickNode}>
<Card.Header>{nodeName(nodeInfo)} <Icon name='chevron down' /></Card.Header>
<Card.Meta>{chainInfo(nodeInfo)}</Card.Meta>
</Card.Content>
{
apiState === 'READY'
? <Card.Content className='blocks'>
{
getCurrentCeremonyIndex
? <React.Fragment>
Expand All @@ -97,18 +97,26 @@ function MapNodeInfoMain (props) {
</React.Fragment>
}
</Card.Content>
</React.Fragment>
: <Card.Content className='loading'>
{
apiState !== 'ERROR'
? <Card.Meta><Loader active size='small' inline /> Connecting to the blockchain</Card.Meta>
: <Card.Meta className='error'>Error connecting to the blockchain</Card.Meta>
}
</Card.Content>
}</Card>
: <Card.Content className='loading'>
{
apiState !== 'ERROR'
? <Card.Meta><Loader active size='small' inline /> Connecting to the blockchain</Card.Meta>
: <Card.Meta className='error'>Error connecting to the blockchain</Card.Meta>
}
</Card.Content>
}
</Card>
);
}

function nodeName (nodeInfo) {
return nodeInfo.nodeName !== undefined ? nodeInfo.nodeName : '...getting node name';
}

function chainInfo (nodeInfo) {
return nodeInfo.chain !== undefined ? `${nodeInfo.chain} v${nodeInfo.nodeVersion}` : '';
}

export default function MapNodeInfo (props) {
return <MapNodeInfoMain {...props} />;
}
14 changes: 14 additions & 0 deletions src/map/MapNodeSwitchWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,20 @@ function createEndpoints () {
provider: 'Encointer Association',
value: 'wss://kusama.api.encointer.org'
},
{
info: 'encointer',
text: 'Mainnet on Kusama',
icon: 'encointer-notee.svg',
provider: 'IBP1',
value: 'wss://sys.ibp.network/encointer-kusama'
},
{
info: 'encointer',
text: 'Mainnet on Kusama',
icon: 'encointer-notee.svg',
provider: 'IBP2',
value: 'wss://sys.dotters.network/encointer-kusama'
},
{
isHeader: true,
text: 'Public Test Networks',
Expand Down
2 changes: 1 addition & 1 deletion src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
.encointer-map .encointer-map-node-info > .loading > .error {
font-weight: bold;
color: #800;
font-size: 2rem;
font-size: 1rem;
}

.encointer-map .encointer-map-node-info > .info {
Expand Down

0 comments on commit ffea513

Please sign in to comment.