Skip to content

Commit

Permalink
style: function names
Browse files Browse the repository at this point in the history
  • Loading branch information
tuliomir committed Aug 19, 2024
1 parent e3ca898 commit f5a8b20
Showing 1 changed file with 11 additions and 29 deletions.
40 changes: 11 additions & 29 deletions src/components/DagComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,18 +228,10 @@ class DagComponent extends React.Component {
.append('g')
.attr('class', 'link')
.append('line')
.attr('x1', function(d) {
return d.source.x;
})
.attr('y1', function(d) {
return d.source.y;
})
.attr('x2', function(d) {
return d.target.x;
})
.attr('y2', function(d) {
return d.target.y;
});
.attr('x1', d => d.source.x)
.attr('y1', d => d.source.y)
.attr('x2', d => d.target.x)
.attr('y2', d => d.target.y);

this.link = this.gLinks.selectAll('line');
}
Expand All @@ -252,9 +244,7 @@ class DagComponent extends React.Component {
.selectAll()
.data(txs)
.enter()
.filter(function(d) {
return !d.isBlock;
})
.filter(d => !d.isBlock)
.append('g')
.attr('class', 'tx');

Expand Down Expand Up @@ -294,9 +284,7 @@ class DagComponent extends React.Component {
.attr('y', d => {
return d.y;
})
.text(function(d) {
return d.id.substring(0, 4);
});
.text(d => d.id.substring(0, 4));

this.tx = this.gTxs.selectAll('circle');
}
Expand All @@ -309,9 +297,7 @@ class DagComponent extends React.Component {
.selectAll()
.data(blocks)
.enter()
.filter(function(d) {
return d.isBlock;
})
.filter(d => d.isBlock)
.append('g')
.attr('class', 'block');

Expand Down Expand Up @@ -344,9 +330,7 @@ class DagComponent extends React.Component {

// Add text to show block info
block
.filter(function(d) {
return d.isBlock;
})
.filter(d => d.isBlock)
.append('text')
.append('tspan')
.attr('class', 'block-text')
Expand All @@ -358,9 +342,7 @@ class DagComponent extends React.Component {
.attr('y', d => {
return d.y + this.blockHeight / 2;
})
.text(function(d) {
return d.id.substring(0, 4);
});
.text(d => d.id.substring(0, 4));

this.block = this.gBlocks.selectAll('rect');
}
Expand Down Expand Up @@ -435,15 +417,15 @@ class DagComponent extends React.Component {
/** Data from the tx being hovered */
const d = mouseEvent.currentTarget.__data__;
if (this.tx) {
this.tx.style('stroke-opacity', function(o) {
this.tx.style('stroke-opacity', function changeStrokeOpacity(o) {
const thisOpacity = d.links.indexOf(o.id) > -1 || d.id === o.id ? 1 : opacity;
this.setAttribute('fill-opacity', thisOpacity);
return thisOpacity;
});
}

if (this.block) {
this.block.style('stroke-opacity', function(o) {
this.block.style('stroke-opacity', function changeStrokeOpacity(o) {
const thisOpacity = d.links.indexOf(o.id) > -1 || d.id === o.id ? 1 : opacity;
this.setAttribute('fill-opacity', thisOpacity);
return thisOpacity;
Expand Down

0 comments on commit f5a8b20

Please sign in to comment.