feat: Refactor PilotVizPage and widget registry for improved layout and rendering
- Replaced the previous widget retrieval method with a new layout-based approach in PilotVizPage. - Introduced a PilotVizAdminCard for layout configuration and management. - Updated widget definitions in the registry to include new components and default order. - Enhanced user feedback for widget visibility with a message when no widgets are active.
This commit is contained in:
1 parent
932bceb1e1
commit
8c8f595385
6 files changed
+398
-26
No files matched your search
@@ -1,13 +1,16 @@
|
||||
import { useState } from 'react'
|
||||
import { FlaskConical } from 'lucide-react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { getPilotWidgetsInOrder } from '../pilot/widgetRegistry'
|
||||
import { resolvePilotWidgetsForRender } from '../pilot/widgetRegistry'
|
||||
import { loadPilotLayout } from '../pilot/pilotLayoutStorage'
|
||||
import PilotVizAdminCard from '../components/pilot/PilotVizAdminCard'
|
||||
|
||||
/**
|
||||
* Pilot: Widget-Schicht (Layer 3b) parallel zum produktiven Dashboard.
|
||||
* Daten für Referenzwerte: Layer 1 (backend/data_layer/reference_values.py) → API.
|
||||
*/
|
||||
export default function PilotVizPage() {
|
||||
const widgets = getPilotWidgetsInOrder()
|
||||
const [layout, setLayout] = useState(() => loadPilotLayout())
|
||||
const widgets = resolvePilotWidgetsForRender(layout)
|
||||
|
||||
return (
|
||||
<div style={{ paddingBottom: 96, textAlign: 'left', maxWidth: 900, margin: '0 auto' }}>
|
||||
@@ -24,26 +27,34 @@ export default function PilotVizPage() {
|
||||
Pilot: Visualisierungs-Module
|
||||
</h1>
|
||||
<p style={{ fontSize: 14, color: 'var(--text2)', lineHeight: 1.6, marginTop: 8 }}>
|
||||
Testumgebung für die zukünftige Widget-Registry. Die produktive Übersicht und der Verlauf bleiben
|
||||
unverändert. Referenzwerte-Summary wird über die gleiche API geladen wie in der Erfassungs-UI, angeboten
|
||||
durch den Data Layer (Layer 1).
|
||||
Testumgebung für die Widget-Registry. Konfiguration unten; produktive Übersicht und Verlauf sind unverändert.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{widgets.map((def) => {
|
||||
const { Component } = def
|
||||
return (
|
||||
<section key={def.id} className="card section-gap" style={{ overflow: 'hidden' }}>
|
||||
<div className="card-title">{def.title}</div>
|
||||
{def.description && (
|
||||
<p style={{ fontSize: 13, color: 'var(--text2)', marginTop: 4, marginBottom: 14, lineHeight: 1.5 }}>
|
||||
{def.description}
|
||||
</p>
|
||||
)}
|
||||
<Component />
|
||||
</section>
|
||||
)
|
||||
})}
|
||||
<PilotVizAdminCard layout={layout} onLayoutChange={setLayout} />
|
||||
|
||||
{widgets.length === 0 ? (
|
||||
<div className="card section-gap" style={{ textAlign: 'center', padding: 24 }}>
|
||||
<p style={{ fontSize: 14, color: 'var(--text2)', margin: 0 }}>
|
||||
Keine Widgets sichtbar. Aktiviere mindestens eines in der <strong>Widget-Konfiguration</strong> oben.
|
||||
</p>
|
||||
</div>
|
||||
) : (
|
||||
widgets.map((def) => {
|
||||
const { Component } = def
|
||||
return (
|
||||
<section key={def.id} className="card section-gap" style={{ overflow: 'hidden' }}>
|
||||
<div className="card-title">{def.title}</div>
|
||||
{def.description && (
|
||||
<p style={{ fontSize: 13, color: 'var(--text2)', marginTop: 4, marginBottom: 14, lineHeight: 1.5 }}>
|
||||
{def.description}
|
||||
</p>
|
||||
)}
|
||||
<Component />
|
||||
</section>
|
||||
)
|
||||
})
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user