Skip to content

Commit

Permalink
fixes #79
Browse files Browse the repository at this point in the history
  • Loading branch information
bhaskarSingh committed Feb 20, 2020
1 parent a6d1419 commit 9e68f13
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 20 deletions.
31 changes: 16 additions & 15 deletions polkaviz-app/src/components/Rectangle.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,24 @@ class Rectangle extends React.Component {
});
document.body.style.cursor = 'pointer';
// this.setState({ showValidatorAddress: true });
// this.props.onIntentionHover({
// accountId:
// this.props.validatorAddress.toString().slice(0, 8) +
// '......' +
// this.props.validatorAddress.toString().slice(-8),
// backersText: this.props.nominators,
// selfText: this.props.bondvalue,
// })
this.props.onIntentionHover({
accountId:
this.props.validatorAddress.toString().slice(0, 8) +
'......' +
this.props.validatorAddress.toString().slice(-8),
backersText: this.props.nominators,
selfText: this.props.bondvalue,
})
// console.log("intentions info");
};
handleOnMouseOut = e => {
e.target.setAttrs({
scaleX: 1,
scaleY: 1,
});
document.body.style.cursor = 'default';
this.setState({ showValidatorAddress: false });
this.props.onIntentionMouseOut(e);
// e.target.setAttrs({
// scaleX: 1,
// scaleY: 1,
// });
// document.body.style.cursor = 'default';
// this.setState({ showValidatorAddress: false });
};
handleClick = () => {
document.body.style.cursor = 'default';
Expand Down Expand Up @@ -88,7 +89,7 @@ class Rectangle extends React.Component {
<Rect
x={this.props.x}
y={this.props.y}
width={3.5}
width={6}
height={10}
fill={this.props.color}
cornerRadius={4.69457}
Expand Down
20 changes: 20 additions & 0 deletions polkaviz-app/src/components/kusama/KusamaApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,15 @@ class KusamaApp extends React.Component {
});
}

onValidatorMouseOut = (e) => {
e.target.setAttrs({
scaleX: 1,
scaleY: 1,
});
document.body.style.cursor = 'default';
this.forceUpdate();
}

onIntentionHover = (info) => {
// console.log("intention info", info);
//check if specific validator info's length is more than 1
Expand All @@ -315,6 +324,15 @@ class KusamaApp extends React.Component {
});
}

onIntentionMouseOut = (e) => {
e.target.setAttrs({
scaleX: 1,
scaleY: 1,
});
document.body.style.cursor = 'default';
this.forceUpdate();
}

render() {
// TODO: Remove not in use variables/contants
const commonWidth = window.innerWidth + 300;
Expand Down Expand Up @@ -406,6 +424,7 @@ class KusamaApp extends React.Component {
<KusamaValidator
key={index}
onValidatorHover={this.onValidatorHover}
onValidatorMouseOut={this.onValidatorMouseOut}
validatorAddress={person.valname}
valinfo={person.valinfo}
accountIndex={person.accountIndex}
Expand Down Expand Up @@ -437,6 +456,7 @@ class KusamaApp extends React.Component {
<KusamaIntention
key={index}
onIntentionHover={this.onIntentionHover}
onIntentionMouseOut={this.onIntentionMouseOut}
validatorAddress={person.valname}
valinfo={person.valinfo}
totalinfo={this.state.kusamavaltotalinfo}
Expand Down
1 change: 1 addition & 0 deletions polkaviz-app/src/components/kusama/KusamaIntentions.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ class Validator extends React.Component {
intentions={this.props.intentions}
color={color}
onIntentionHover={this.props.onIntentionHover}
onIntentionMouseOut={this.props.onIntentionMouseOut}
/>
</React.Fragment>
);
Expand Down
12 changes: 7 additions & 5 deletions polkaviz-app/src/components/kusama/KusamaRectangle.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ class Rectangle extends React.Component {
<Rect
x={this.props.x}
y={this.props.y}
width={5}
height={10}
width={8}
height={12}
fill={this.props.color}
cornerRadius={4.69457}
rotation={this.props.angle}
Expand All @@ -111,10 +111,12 @@ class Rectangle extends React.Component {
}
}
}
onMouseOut={
!this.props.isMainWrapper ? this.handleOnMouseOut : undefined
onMouseOut={(e) =>{
if(!this.props.isMainWrapper){
this.props.onValidatorMouseOut(e);
}
}
}
// onClick={this.handleClick}
/>

{this.state.showValidatorAddress && !this.props.isMainWrapper && (
Expand Down
1 change: 1 addition & 0 deletions polkaviz-app/src/components/kusama/KusamaValidators.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ class Validator extends React.Component {
nominatorsStake={nominatorsStake}
accountIndex={this.props.accountIndex}
onValidatorHover={this.props.onValidatorHover}
onValidatorMouseOut={this.props.onValidatorMouseOut}
/>
</React.Fragment>
);
Expand Down

0 comments on commit 9e68f13

Please sign in to comment.