feat: Update reference values and introduce pilot visualization module
Deploy Development / deploy (push) Successful in 47s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 23s

- Bumped version of reference_values module to 1.3.0.
- Added new imports and functionality for reference values in the backend, enhancing data retrieval.
- Introduced a new PilotVizPage in the frontend for visualizing data, linked from the SettingsPage for easy access.
- Updated routing in App.jsx to include the new pilot visualization route.
This commit is contained in:
Lars committed 2026-04-07 10:15:13 +02:00
1 parent 3e916c082c
commit 932bceb1e1
10 files changed
+428 -146

No files matched your search

@@ -0,0 +1,88 @@
import { useState, useEffect } from 'react'
import { Link } from 'react-router-dom'
import { api } from '../../utils/api'
function formatEntryValue(row) {
if (row.value_numeric != null && row.value_numeric !== '') {
const n = Number(row.value_numeric)
return Number.isFinite(n) ? String(n) : String(row.value_numeric)
}
return row.value_text != null ? String(row.value_text) : '–'
}
export default function ReferenceValuesSummaryWidget() {
const [tiles, setTiles] = useState([])
const [loading, setLoading] = useState(true)
const [err, setErr] = useState(null)
useEffect(() => {
let cancelled = false
;(async () => {
try {
const data = await api.listProfileReferenceValuesSummary()
if (!cancelled) {
setTiles(Array.isArray(data?.tiles) ? data.tiles : [])
setErr(null)
}
} catch (e) {
if (!cancelled) {
setErr(e.message || 'Laden fehlgeschlagen')
setTiles([])
}
} finally {
if (!cancelled) setLoading(false)
}
})()
return () => {
cancelled = true
}
}, [])
if (loading) {
return (
<div style={{ padding: 20, textAlign: 'center' }}>
<div className="spinner" />
</div>
)
}
if (err) {
return <div style={{ fontSize: 13, color: 'var(--danger)' }}>{err}</div>
}
if (tiles.length === 0) {
return (
<p style={{ fontSize: 13, color: 'var(--text2)', margin: 0 }}>
Noch keine Referenzwerte erfasst.{' '}
<Link to="/settings/reference-values" style={{ color: 'var(--accent)' }}>
Zur Erfassung
</Link>
</p>
)
}
return (
<div className="ref-value-tiles-grid">
{tiles
.filter((t) => t?.latest)
.map((tile) => (
<div
key={tile.type_key}
className="card"
style={{ margin: 0, padding: 14, boxSizing: 'border-box' }}
>
<div style={{ fontSize: 12, fontWeight: 600, color: 'var(--text2)' }}>{tile.type_label}</div>
<div style={{ fontSize: 20, fontWeight: 700, marginTop: 6 }}>
{formatEntryValue(tile.latest)}
{tile.latest.unit ? (
<span style={{ fontSize: 14, fontWeight: 600, color: 'var(--text2)', marginLeft: 6 }}>
{tile.latest.unit}
</span>
) : null}
</div>
<div style={{ fontSize: 11, color: 'var(--text3)', marginTop: 6 }}>
Stand {String(tile.latest.effective_date || '').slice(0, 10)}
</div>
</div>
))}
</div>
)
}