Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more endpoints for the Kusama network and allow switching endpoint after a connection error #151

Merged
merged 4 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
Comment on lines +78 to +80
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always display the dropdown error so that we can switch the network after a connection error

</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'
},
Comment on lines +45 to +58
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Omitted dwellir for now, as they disabled the offchain indexing

{
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
Loading