diff --git a/webapp/src/app/shared/ui/score-bar/score-bar.component.html b/webapp/src/app/shared/ui/score-bar/score-bar.component.html index f54ebef2..5dbb1f99 100644 --- a/webapp/src/app/shared/ui/score-bar/score-bar.component.html +++ b/webapp/src/app/shared/ui/score-bar/score-bar.component.html @@ -2,7 +2,18 @@ class="score-bar" [class.score-bar--success]="variant() === 'success'" [class.score-bar--warn]="variant() === 'warn'"> - {{ label() }} + + {{ label() }} + @if (hint()) { + + } + @if (thresholdPct() !== null) { diff --git a/webapp/src/app/shared/ui/score-bar/score-bar.component.scss b/webapp/src/app/shared/ui/score-bar/score-bar.component.scss index e58d8169..4913fce1 100644 --- a/webapp/src/app/shared/ui/score-bar/score-bar.component.scss +++ b/webapp/src/app/shared/ui/score-bar/score-bar.component.scss @@ -1,6 +1,6 @@ .score-bar { display: grid; - grid-template-columns: 96px 1fr 48px; + grid-template-columns: minmax(0, 132px) 1fr 50px; gap: 10px; align-items: center; margin-bottom: 8px; @@ -9,12 +9,31 @@ } .score-bar__label { + display: inline-flex; + align-items: center; + gap: 3px; + min-width: 0; color: var(--sg-text-muted); + + &--hinted { + cursor: help; + } +} + +.score-bar__label-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.score-bar__hint { + flex: none; + font-size: 14px; + width: 14px; + height: 14px; + color: var(--sg-text-soft); +} + .score-bar__track { position: relative; display: block; diff --git a/webapp/src/app/shared/ui/score-bar/score-bar.component.ts b/webapp/src/app/shared/ui/score-bar/score-bar.component.ts index cfff13d9..8246bb61 100644 --- a/webapp/src/app/shared/ui/score-bar/score-bar.component.ts +++ b/webapp/src/app/shared/ui/score-bar/score-bar.component.ts @@ -1,4 +1,6 @@ import { Component, computed, input } from '@angular/core'; +import { MatIconModule } from '@angular/material/icon'; +import { MatTooltipModule } from '@angular/material/tooltip'; export type ScoreBarVariant = 'primary' | 'success' | 'warn'; @@ -10,6 +12,7 @@ export type ScoreBarVariant = 'primary' | 'success' | 'warn'; @Component({ selector: 'app-score-bar', standalone: true, + imports: [MatIconModule, MatTooltipModule], templateUrl: './score-bar.component.html', styleUrl: './score-bar.component.scss', }) @@ -23,6 +26,8 @@ export class ScoreBarComponent { readonly display = input(null); /** Optional threshold (same units as `value`), drawn as a dashed marker. */ readonly threshold = input(null); + /** Optional explanation, shown as a tooltip on the label. */ + readonly hint = input(null); readonly variant = input('primary'); readonly pct = computed(() => {