feat(tags): implement custom tag color merging and label support

This commit is contained in:
shay
2026-04-18 14:52:32 -04:00
parent 3e70e4b4ef
commit 3ecb6ad67b
6 changed files with 54 additions and 4 deletions
+2 -2
View File
@@ -5,7 +5,7 @@ import { THEMES, TAG_COLORS, GRADE_COLORS, FOCUS_COLORS, LANG_COLORS, type Theme
export type GradeData = {
grade: string; score: number
stats: Record<string, number>
tags: { tag: string; source: string; confidence: number }[]
tags: { tag: string; source: string; confidence: number; label?: string | null }[]
breakdown: Record<string, number>
}
export type ImpactWeek = { week_start: string; commits: number }
@@ -91,7 +91,7 @@ function renderGrade(data: GradeData, t: Theme, s?: { max_tags?: number }): stri
let tagsSvg = '', tx = 0, ty = 0
for (const tag of tags) {
const tc = TAG_COLORS[tag.tag] ?? t.accent
const label = formatTagLabel(tag.tag)
const label = tag.label || formatTagLabel(tag.tag)
const tw = Math.round(label.length * 6.6 + 18)
const po = tag.source === 'earned' ? 0.9 : 0.55
if (tx + tw > 340) { tx = 0; ty += 30 }