Skip to content

Commit

Permalink
Lint and format JS
Browse files Browse the repository at this point in the history
  • Loading branch information
mathjazz committed Aug 18, 2023
1 parent 36958e1 commit ae6623d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
24 changes: 12 additions & 12 deletions pontoon/insights/static/js/insights_charts.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@ var Pontoon = (function (my) {
// Legend configuration doesn't allow for enough flexibility,
// so we build our own legend
// eslint-disable-next-line no-unused-vars
customLegend: (chart) => (chart) => (chart) => chart.data.datasets
.map(function (dataset) {
var disabled = dataset.hidden ? 'disabled' : '';
var color = dataset.borderColor || dataset.backgroundColor;
customLegend: (chart) => (chart) => {
const renderLabels = (chart) => {
return chart.data.datasets
.map((dataset) => {
var disabled = dataset.hidden ? 'disabled' : '';
var color = dataset.borderColor || dataset.backgroundColor;

return (
`<li class="${disabled}"><i class="icon" style="background-color:${color}"></i><span class="label">${dataset.label}</span></li>`
);
})
.join('');
}

return '<ul>' + renderLabels(chart) + '</ul>';
return `<li class="${disabled}"><i class="icon" style="background-color:${color}"></i><span class="label">${dataset.label}</span></li>`;
})
.join('');
};

const labels = renderLabels(chart);
return `<ul>${labels}</ul>`;
},
// Custom legend item event handler
attachCustomLegendHandler: function (chart, selector) {
Expand Down
8 changes: 4 additions & 4 deletions pontoon/insights/static/js/insights_tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ var Pontoon = (function (my) {

switch (label) {
case 'Completion':
return pf.format(value/100);
return pf.format(value / 100);
case 'Human translations':
case 'Machinery translations': {
const pct = Pontoon.insights.getPercent(
Expand Down Expand Up @@ -511,7 +511,7 @@ var Pontoon = (function (my) {
max: 100,
stepSize: 20,
callback: function (value) {
return pf.format(value/100);
return pf.format(value / 100);
},
},
},
Expand Down Expand Up @@ -863,7 +863,7 @@ var Pontoon = (function (my) {

switch (label) {
case 'Approval rate':
return pf.format(value/100);
return pf.format(value / 100);
default:
return base;
}
Expand Down Expand Up @@ -908,7 +908,7 @@ var Pontoon = (function (my) {
max: 100,
stepSize: 20,
callback: function (value) {
return pf.format(value/100);
return pf.format(value / 100);
},
},
},
Expand Down

0 comments on commit ae6623d

Please sign in to comment.