in src/GitHubOverview.js [32:57]
componentDidUpdate() {
const ref = this.canvas.current;
/** @type {CanvasRenderingContext2D} */
const ctx = ref.getContext("2d");
ctx.beginPath();
const colors = {
success: COLORS.green,
failure: COLORS.red,
error: COLORS.red,
neutral: COLORS.grey,
cancelled: COLORS.red,
pending: COLORS.yellow,
queued: COLORS.yellow,
unknown: COLORS.blank,
};
for (const [x, statuses] of this.state.statuses.entries()) {
for (const [y, status] of statuses.entries()) {
const fill = colors[status];
if (!fill) {
console.error("Unknown", status);
}
ctx.fillStyle = fill;
ctx.fillRect(y, x, 1, 1);
}
}
}