diff --git a/frontend/src/pages/GoalsPage.jsx b/frontend/src/pages/GoalsPage.jsx index 5ba8e00..ca998c4 100644 --- a/frontend/src/pages/GoalsPage.jsx +++ b/frontend/src/pages/GoalsPage.jsx @@ -46,6 +46,16 @@ const GOAL_MODES = [ export default function GoalsPage() { const [goalMode, setGoalMode] = useState(null) + const [focusAreas, setFocusAreas] = useState(null) + const [focusEditing, setFocusEditing] = useState(false) + const [focusTemp, setFocusTemp] = useState({ + weight_loss_pct: 0, + muscle_gain_pct: 0, + strength_pct: 0, + endurance_pct: 0, + flexibility_pct: 0, + health_pct: 0 + }) const [goals, setGoals] = useState([]) const [goalTypes, setGoalTypes] = useState([]) // Dynamic from DB (Phase 1.5) const [goalTypesMap, setGoalTypesMap] = useState({}) // For quick lookup @@ -74,13 +84,16 @@ export default function GoalsPage() { setLoading(true) setError(null) try { - const [modeData, goalsData, typesData] = await Promise.all([ + const [modeData, goalsData, typesData, focusData] = await Promise.all([ api.getGoalMode(), api.listGoals(), - api.listGoalTypeDefinitions() // Phase 1.5: Load from DB + api.listGoalTypeDefinitions(), // Phase 1.5: Load from DB + api.getFocusAreas() // v2.0: Load focus areas ]) setGoalMode(modeData.goal_mode) setGoals(goalsData) + setFocusAreas(focusData) + setFocusTemp(focusData) // Initialize temp state // Convert types array to map for quick lookup const typesMap = {} @@ -258,43 +271,189 @@ export default function GoalsPage() { )} - {/* Strategic Goal Mode Selection */} + {/* Focus Areas (v2.0) */}
-

๐ŸŽฏ Trainingsmodus

+
+

๐ŸŽฏ Fokus-Bereiche

+ {!focusEditing && focusAreas && ( + + )} +

- Wรคhle deine grundlegende Trainingsausrichtung. Dies beeinflusst die Gewichtung - und Interpretation aller Analysen. + Gewichte deine Trainingsziele individuell. Die Summe muss 100% ergeben. + {focusAreas && !focusAreas.custom && ( + + โ„น๏ธ Aktuell abgeleitet aus Trainingsmodus "{goalMode}" - klicke "Anpassen" fรผr individuelle Gewichtung + + )}

-
- {GOAL_MODES.map(mode => ( - - ))} -
+ {Object.values(focusTemp).reduce((a, b) => a + b, 0) !== 100 && ( +
+ โš ๏ธ Summe muss 100% ergeben +
+ )} +
+ + {/* Action Buttons */} +
+ + +
+ + ) : focusAreas && ( + /* Display Mode */ +
+ {[ + { key: 'weight_loss_pct', label: 'Fettabbau', icon: '๐Ÿ“‰', color: '#D85A30' }, + { key: 'muscle_gain_pct', label: 'Muskelaufbau', icon: '๐Ÿ’ช', color: '#378ADD' }, + { key: 'strength_pct', label: 'Kraftsteigerung', icon: '๐Ÿ‹๏ธ', color: '#7B68EE' }, + { key: 'endurance_pct', label: 'Ausdauer', icon: '๐Ÿƒ', color: '#1D9E75' }, + { key: 'flexibility_pct', label: 'Beweglichkeit', icon: '๐Ÿคธ', color: '#E67E22' }, + { key: 'health_pct', label: 'Gesundheit', icon: 'โค๏ธ', color: '#F59E0B' } + ].filter(area => focusAreas[area.key] > 0).map(area => ( +
+
{area.icon}
+
{area.label}
+
{focusAreas[area.key]}%
+
+ ))} +
+ )} {/* Tactical Goals List */}