feat(insights): PR badge on metric trend tiles when achieved in last 30 days

Adds a small text-only PR pill that consumers can compose next to
a metric label. The badge pulls /api/personal-records?metricType=
and renders only when the most recent record landed in the last
30 days — older PRs are still visible on the dedicated /insights
PR list but the dashboard surface keeps a fresh-only filter so the
pill is a noticeable signal rather than a permanent fixture.

i18n keys insights.personalRecord.badge and insights.personalRecord.tooltip
ship in all six locales. The badge component is locale-aware
through the standard useTranslations / useFormatters hooks and
exposes a withTooltip prop so standalone uses (doctor report,
correlation cards) can skip the Tooltip provider.
This commit is contained in:
Marc-André Bombeck committed 2026-05-14 18:59:14 +02:00
1 parent 87853eb2ac
commit e51a4f53bb
8 files changed
+283 -8

No files matched your search

+4
View File
@@ -879,6 +879,10 @@
"heroFindingWarning": "Wichtigster Alarm",
"correlationsTitle": "Zusammenhänge",
"recommendationsTitle": "Empfehlungen",
"personalRecord": {
"badge": "PR",
"tooltip": "Persönlicher Rekord: {value} {unit} am {date}"
},
"recommendation": {
"source": "Quelle",
"viewSource": "Leitlinie in neuem Tab öffnen",
+4
View File
@@ -879,6 +879,10 @@
"heroFindingWarning": "Top alert",
"correlationsTitle": "Correlations",
"recommendationsTitle": "Recommendations",
"personalRecord": {
"badge": "PR",
"tooltip": "Personal record: {value} {unit} on {date}"
},
"recommendation": {
"source": "Source",
"viewSource": "Open guideline in a new tab",
+6 -2
View File
@@ -877,8 +877,12 @@
"heroFindingNeutral": "Top finding",
"heroFindingAttention": "Worth attention",
"heroFindingWarning": "Top alert",
"correlationsTitle": "Correlations",
"recommendationsTitle": "Recommendations",
"correlationsTitle": "Correlaciones",
"recommendationsTitle": "Recomendaciones",
"personalRecord": {
"badge": "PR",
"tooltip": "Récord personal: {value} {unit} el {date}"
},
"recommendation": {
"source": "Source",
"viewSource": "Open guideline in a new tab",
+6 -2
View File
@@ -877,8 +877,12 @@
"heroFindingNeutral": "Top finding",
"heroFindingAttention": "Worth attention",
"heroFindingWarning": "Top alert",
"correlationsTitle": "Correlations",
"recommendationsTitle": "Recommendations",
"correlationsTitle": "Corrélations",
"recommendationsTitle": "Recommandations",
"personalRecord": {
"badge": "PR",
"tooltip": "Record personnel : {value} {unit} le {date}"
},
"recommendation": {
"source": "Source",
"viewSource": "Open guideline in a new tab",
+6 -2
View File
@@ -877,8 +877,12 @@
"heroFindingNeutral": "Top finding",
"heroFindingAttention": "Worth attention",
"heroFindingWarning": "Top alert",
"correlationsTitle": "Correlations",
"recommendationsTitle": "Recommendations",
"correlationsTitle": "Correlazioni",
"recommendationsTitle": "Raccomandazioni",
"personalRecord": {
"badge": "PR",
"tooltip": "Record personale: {value} {unit} il {date}"
},
"recommendation": {
"source": "Source",
"viewSource": "Open guideline in a new tab",
+6 -2
View File
@@ -877,8 +877,12 @@
"heroFindingNeutral": "Top finding",
"heroFindingAttention": "Worth attention",
"heroFindingWarning": "Top alert",
"correlationsTitle": "Correlations",
"recommendationsTitle": "Recommendations",
"correlationsTitle": "Korelacje",
"recommendationsTitle": "Rekomendacje",
"personalRecord": {
"badge": "PR",
"tooltip": "Rekord osobisty: {value} {unit} dnia {date}"
},
"recommendation": {
"source": "Source",
"viewSource": "Open guideline in a new tab",