From c152721fe862a5739428fea51f3c819e598fcbfc Mon Sep 17 00:00:00 2001 From: Lars Date: Tue, 7 Apr 2026 06:24:47 +0200 Subject: [PATCH] feat: Refactor settings navigation and enhance profile reference values display - Introduced a new SettingsShell layout for improved navigation within the settings section. - Updated ProfileReferenceValuesPage to display the latest entry with enhanced styling and information. - Removed the direct link to settings from ProfileReferenceValuesPage for a cleaner UI. - Adjusted SettingsPage to streamline the layout and focus on essential settings options. --- frontend/src/App.jsx | 7 ++- frontend/src/app.css | 5 ++ frontend/src/config/settingsNav.js | 9 ++++ frontend/src/layouts/SettingsShell.jsx | 33 ++++++++++++ .../src/pages/ProfileReferenceValuesPage.jsx | 51 +++++++++++++++---- frontend/src/pages/SettingsPage.jsx | 19 +------ 6 files changed, 95 insertions(+), 29 deletions(-) create mode 100644 frontend/src/config/settingsNav.js create mode 100644 frontend/src/layouts/SettingsShell.jsx diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index aaae9db..a8f2f7f 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -22,6 +22,7 @@ import NutritionPage from './pages/NutritionPage' import ActivityPage from './pages/ActivityPage' import Analysis from './pages/Analysis' import SettingsPage from './pages/SettingsPage' +import SettingsShell from './layouts/SettingsShell' import ProfileReferenceValuesPage from './pages/ProfileReferenceValuesPage' import GuidePage from './pages/GuidePage' import AdminTierLimitsPage from './pages/AdminTierLimitsPage' @@ -226,8 +227,10 @@ function AppShell() { }/> }/> }/> - }/> - }/> + }> + } /> + } /> + }> }> } /> diff --git a/frontend/src/app.css b/frontend/src/app.css index 2ec9efb..8d2e007 100644 --- a/frontend/src/app.css +++ b/frontend/src/app.css @@ -552,6 +552,11 @@ a.analysis-split__nav-item { } } +/* Einstellungen: gleiche Split-Struktur wie Analyse/Admin */ +.settings-shell { + width: 100%; +} + /* Admin: Split-Layout wie .analysis-split (nur Gruppen in der Nav) */ .admin-shell { width: 100%; diff --git a/frontend/src/config/settingsNav.js b/frontend/src/config/settingsNav.js new file mode 100644 index 0000000..4e769c1 --- /dev/null +++ b/frontend/src/config/settingsNav.js @@ -0,0 +1,9 @@ +/** + * Einstellungen: Sub-Navigation (Mobil = Chip-Leiste, Desktop = linke Spalte). + * Pfade müssen mit den Routes unter SettingsShell in App.jsx übereinstimmen. + */ + +export const SETTINGS_SHELL_NAV_ITEMS = [ + { id: 'general', label: 'Allgemein', to: '/settings', end: true }, + { id: 'reference-values', label: 'Referenzwerte', to: '/settings/reference-values' }, +] diff --git a/frontend/src/layouts/SettingsShell.jsx b/frontend/src/layouts/SettingsShell.jsx new file mode 100644 index 0000000..10463f3 --- /dev/null +++ b/frontend/src/layouts/SettingsShell.jsx @@ -0,0 +1,33 @@ +import { Outlet, NavLink } from 'react-router-dom' +import { SETTINGS_SHELL_NAV_ITEMS } from '../config/settingsNav' + +/** + * Wie Admin / KI-Analyse: Chips horizontal (mobil) bzw. Seitenleiste (Desktop). + */ +export default function SettingsShell() { + return ( +
+
+
+ +
+
+ +
+
+
+ ) +} diff --git a/frontend/src/pages/ProfileReferenceValuesPage.jsx b/frontend/src/pages/ProfileReferenceValuesPage.jsx index c8723c0..93a85fc 100644 --- a/frontend/src/pages/ProfileReferenceValuesPage.jsx +++ b/frontend/src/pages/ProfileReferenceValuesPage.jsx @@ -1,6 +1,5 @@ import { useState, useEffect, useCallback } from 'react' -import { Link } from 'react-router-dom' -import { ArrowLeft, Gauge, Pencil, Trash2, Plus } from 'lucide-react' +import { Gauge, Pencil, Trash2, Plus } from 'lucide-react' import { api } from '../utils/api' import { labelSource, @@ -126,6 +125,9 @@ export default function ProfileReferenceValuesPage() { }) } + const latestEntry = + !listLoading && entries.length > 0 ? entries[0] : null + const rules = selectedType?.validation_rules && typeof selectedType.validation_rules === 'object' ? selectedType.validation_rules : {} @@ -299,13 +301,6 @@ export default function ProfileReferenceValuesPage() { return (
- - Zurück zu Einstellungen -

Referenzwerte @@ -378,6 +373,44 @@ export default function ProfileReferenceValuesPage() { )}

+ {latestEntry && selectedType && ( +
+
+ Aktueller Wert +
+

+ Stand {String(latestEntry.effective_date || '').slice(0, 10)} · zuletzt erfasst für{' '} + {selectedType.label} +

+
+ {formatEntryValue(latestEntry)} + {latestEntry.unit ? ( + + {latestEntry.unit} + + ) : null} +
+

+ {labelSource(latestEntry.source)} · {labelMethod(latestEntry.method)} ·{' '} + {labelConfidence(latestEntry.confidence)} +

+
+ )} +
diff --git a/frontend/src/pages/SettingsPage.jsx b/frontend/src/pages/SettingsPage.jsx index 9b6ea0c..a3d881c 100644 --- a/frontend/src/pages/SettingsPage.jsx +++ b/frontend/src/pages/SettingsPage.jsx @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react' -import { Save, Download, Upload, Check, LogOut, Key, BarChart3, Target, Gauge } from 'lucide-react' +import { Save, Download, Upload, Check, LogOut, Key, BarChart3, Target } from 'lucide-react' import { Link } from 'react-router-dom' import { useProfile } from '../context/ProfileContext' import { useAuth } from '../context/AuthContext' @@ -428,23 +428,6 @@ export default function SettingsPage() {
-
-
- Referenzwerte -
-

- Persönliche Kennwerte (z. B. HF-Schwellen, Trainingshäufigkeit) – historisch zum Profil gespeichert, - keine Admin-Konfiguration. -

- - Referenzwerte verwalten - -
-
Strategische Ziele