diff --git a/src/diagrams/git/gitGraphRenderer.js b/src/diagrams/git/gitGraphRenderer.js index d918f927da..20e581c448 100644 --- a/src/diagrams/git/gitGraphRenderer.js +++ b/src/diagrams/git/gitGraphRenderer.js @@ -121,13 +121,9 @@ const drawCommits = (svg, commits, modifyGraph) => { circle.attr('width', 20); circle.attr( 'class', - 'commit ' + - commit.id + - ' commit-highlight' + - (branchPos[commit.branch].index % THEME_COLOR_LIMIT) + - ' ' + - typeClass + - '-outer' + `commit ${commit.id} commit-highlight${ + branchPos[commit.branch].index % THEME_COLOR_LIMIT + } ${typeClass}-outer` ); gBullets .append('rect') @@ -137,13 +133,9 @@ const drawCommits = (svg, commits, modifyGraph) => { .attr('width', 12) .attr( 'class', - 'commit ' + - commit.id + - ' commit' + - (branchPos[commit.branch].index % THEME_COLOR_LIMIT) + - ' ' + - typeClass + - '-inner' + `commit ${commit.id} commit${ + branchPos[commit.branch].index % THEME_COLOR_LIMIT + } ${typeClass}-inner` ); } else if (commit.type === commitType.CHERRY_PICK) { gBullets @@ -151,21 +143,21 @@ const drawCommits = (svg, commits, modifyGraph) => { .attr('cx', x) .attr('cy', y) .attr('r', 10) - .attr('class', 'commit ' + commit.id + ' ' + typeClass); + .attr('class', `commit ${commit.id} ${typeClass}`); gBullets .append('circle') .attr('cx', x - 3) .attr('cy', y + 2) .attr('r', 2.75) .attr('fill', '#fff') - .attr('class', 'commit ' + commit.id + ' ' + typeClass); + .attr('class', `commit ${commit.id} ${typeClass}`); gBullets .append('circle') .attr('cx', x + 3) .attr('cy', y + 2) .attr('r', 2.75) .attr('fill', '#fff') - .attr('class', 'commit ' + commit.id + ' ' + typeClass); + .attr('class', `commit ${commit.id} ${typeClass}`); gBullets .append('line') .attr('x1', x + 3) @@ -173,7 +165,7 @@ const drawCommits = (svg, commits, modifyGraph) => { .attr('x2', x) .attr('y2', y - 5) .attr('stroke', '#fff') - .attr('class', 'commit ' + commit.id + ' ' + typeClass); + .attr('class', `commit ${commit.id} ${typeClass}`); gBullets .append('line') .attr('x1', x - 3) @@ -181,7 +173,7 @@ const drawCommits = (svg, commits, modifyGraph) => { .attr('x2', x) .attr('y2', y - 5) .attr('stroke', '#fff') - .attr('class', 'commit ' + commit.id + ' ' + typeClass); + .attr('class', `commit ${commit.id} ${typeClass}`); } else { const circle = gBullets.append('circle'); circle.attr('cx', x); @@ -189,7 +181,7 @@ const drawCommits = (svg, commits, modifyGraph) => { circle.attr('r', commit.type === commitType.MERGE ? 9 : 10); circle.attr( 'class', - 'commit ' + commit.id + ' commit' + (branchPos[commit.branch].index % THEME_COLOR_LIMIT) + `commit ${commit.id} commit${branchPos[commit.branch].index % THEME_COLOR_LIMIT}` ); if (commit.type === commitType.MERGE) { const circle2 = gBullets.append('circle'); @@ -198,12 +190,9 @@ const drawCommits = (svg, commits, modifyGraph) => { circle2.attr('r', 6); circle2.attr( 'class', - 'commit ' + - typeClass + - ' ' + - commit.id + - ' commit' + - (branchPos[commit.branch].index % THEME_COLOR_LIMIT) + `commit ${typeClass} ${commit.id} commit${ + branchPos[commit.branch].index % THEME_COLOR_LIMIT + }` ); } if (commit.type === commitType.REVERSE) { @@ -212,12 +201,9 @@ const drawCommits = (svg, commits, modifyGraph) => { .attr('d', `M ${x - 5},${y - 5}L${x + 5},${y + 5}M${x - 5},${y + 5}L${x + 5},${y - 5}`) .attr( 'class', - 'commit ' + - typeClass + - ' ' + - commit.id + - ' commit' + - (branchPos[commit.branch].index % THEME_COLOR_LIMIT) + `commit ${typeClass} ${commit.id} commit${ + branchPos[commit.branch].index % THEME_COLOR_LIMIT + }` ); } } @@ -477,7 +463,7 @@ const drawBranches = (svg, branches) => { const gitGraphConfig = getConfig().gitGraph; const g = svg.append('g'); branches.forEach((branch, index) => { - let adjustIndexForTheme = index % THEME_COLOR_LIMIT; + const adjustIndexForTheme = index % THEME_COLOR_LIMIT; const pos = branchPos[branch.name].pos; const line = g.append('line');