feat: Phase 0a - Minimal Goal System (Strategic + Tactical)
- Strategic Layer: Goal modes (weight_loss, strength, endurance, recomposition, health) - Tactical Layer: Concrete goal targets with progress tracking - Training phases (manual + auto-detection framework) - Fitness tests (standardized performance tracking) Backend: - Migration 022: goal_mode in profiles, goals, training_phases, fitness_tests tables - New router: routers/goals.py with full CRUD for goals, phases, tests - API endpoints: /api/goals/* (mode, list, create, update, delete) Frontend: - GoalsPage: Goal mode selector + goal management UI - Dashboard: Goals preview card with link - API integration: goal mode, CRUD operations, progress calculation Basis for 120+ placeholders and goal-aware analyses (Phase 0b) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
ae93b9d428
commit
337667fc07
8 files changed
+1813
No files matched your search
@@ -35,6 +35,7 @@ import SubscriptionPage from './pages/SubscriptionPage'
|
||||
import SleepPage from './pages/SleepPage'
|
||||
import RestDaysPage from './pages/RestDaysPage'
|
||||
import VitalsPage from './pages/VitalsPage'
|
||||
import GoalsPage from './pages/GoalsPage'
|
||||
import './app.css'
|
||||
|
||||
function Nav() {
|
||||
@@ -172,6 +173,7 @@ function AppShell() {
|
||||
<Route path="/sleep" element={<SleepPage/>}/>
|
||||
<Route path="/rest-days" element={<RestDaysPage/>}/>
|
||||
<Route path="/vitals" element={<VitalsPage/>}/>
|
||||
<Route path="/goals" element={<GoalsPage/>}/>
|
||||
<Route path="/nutrition" element={<NutritionPage/>}/>
|
||||
<Route path="/activity" element={<ActivityPage/>}/>
|
||||
<Route path="/analysis" element={<Analysis/>}/>
|
||||
|
||||
@@ -497,6 +497,21 @@ export default function Dashboard() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Goals Preview */}
|
||||
<div className="card section-gap" style={{marginBottom:16,cursor:'pointer'}}
|
||||
onClick={()=>nav('/goals')}>
|
||||
<div style={{display:'flex',justifyContent:'space-between',alignItems:'center',marginBottom:12}}>
|
||||
<div style={{fontWeight:600,fontSize:13}}>🎯 Ziele</div>
|
||||
<button style={{background:'none',border:'none',fontSize:12,color:'var(--accent)',cursor:'pointer'}}
|
||||
onClick={(e)=>{e.stopPropagation();nav('/goals')}}>
|
||||
Verwalten →
|
||||
</button>
|
||||
</div>
|
||||
<div style={{fontSize:12,color:'var(--text2)',padding:'8px 0'}}>
|
||||
Definiere deine Trainingsmodus und konkrete Ziele für bessere KI-Analysen
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Latest AI insight */}
|
||||
<div className="card section-gap">
|
||||
<div style={{display:'flex',alignItems:'center',justifyContent:'space-between',marginBottom:8}}>
|
||||
|
||||
@@ -0,0 +1,562 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import { Target, Plus, Pencil, Trash2, TrendingUp, Calendar } from 'lucide-react'
|
||||
import { api } from '../utils/api'
|
||||
import dayjs from 'dayjs'
|
||||
import 'dayjs/locale/de'
|
||||
dayjs.locale('de')
|
||||
|
||||
// Goal Mode Definitions
|
||||
const GOAL_MODES = [
|
||||
{
|
||||
id: 'weight_loss',
|
||||
icon: '📉',
|
||||
label: 'Gewichtsreduktion',
|
||||
description: 'Kaloriendefizit, Fettabbau',
|
||||
color: '#D85A30'
|
||||
},
|
||||
{
|
||||
id: 'strength',
|
||||
icon: '💪',
|
||||
label: 'Kraftaufbau',
|
||||
description: 'Muskelwachstum, progressive Belastung',
|
||||
color: '#378ADD'
|
||||
},
|
||||
{
|
||||
id: 'endurance',
|
||||
icon: '🏃',
|
||||
label: 'Ausdauer',
|
||||
description: 'VO2Max, aerobe Kapazität',
|
||||
color: '#1D9E75'
|
||||
},
|
||||
{
|
||||
id: 'recomposition',
|
||||
icon: '⚖️',
|
||||
label: 'Körperkomposition',
|
||||
description: 'Gleichzeitig Fett ab- & Muskeln aufbauen',
|
||||
color: '#7B68EE'
|
||||
},
|
||||
{
|
||||
id: 'health',
|
||||
icon: '❤️',
|
||||
label: 'Allgemeine Gesundheit',
|
||||
description: 'Ausgewogen, präventiv',
|
||||
color: '#E67E22'
|
||||
}
|
||||
]
|
||||
|
||||
// Goal Type Definitions
|
||||
const GOAL_TYPES = {
|
||||
weight: { label: 'Gewicht', unit: 'kg', icon: '⚖️' },
|
||||
body_fat: { label: 'Körperfett', unit: '%', icon: '📊' },
|
||||
lean_mass: { label: 'Muskelmasse', unit: 'kg', icon: '💪' },
|
||||
vo2max: { label: 'VO2Max', unit: 'ml/kg/min', icon: '🫁' },
|
||||
strength: { label: 'Kraft', unit: 'kg', icon: '🏋️' },
|
||||
flexibility: { label: 'Beweglichkeit', unit: 'cm', icon: '🤸' },
|
||||
bp: { label: 'Blutdruck', unit: 'mmHg', icon: '❤️' },
|
||||
rhr: { label: 'Ruhepuls', unit: 'bpm', icon: '💓' }
|
||||
}
|
||||
|
||||
export default function GoalsPage() {
|
||||
const [goalMode, setGoalMode] = useState(null)
|
||||
const [goals, setGoals] = useState([])
|
||||
const [showGoalForm, setShowGoalForm] = useState(false)
|
||||
const [editingGoal, setEditingGoal] = useState(null)
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [error, setError] = useState(null)
|
||||
const [toast, setToast] = useState(null)
|
||||
|
||||
// Form state
|
||||
const [formData, setFormData] = useState({
|
||||
goal_type: 'weight',
|
||||
is_primary: false,
|
||||
target_value: '',
|
||||
unit: 'kg',
|
||||
target_date: '',
|
||||
name: '',
|
||||
description: ''
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
loadData()
|
||||
}, [])
|
||||
|
||||
const loadData = async () => {
|
||||
setLoading(true)
|
||||
setError(null)
|
||||
try {
|
||||
const [modeData, goalsData] = await Promise.all([
|
||||
api.getGoalMode(),
|
||||
api.listGoals()
|
||||
])
|
||||
setGoalMode(modeData.goal_mode)
|
||||
setGoals(goalsData)
|
||||
} catch (err) {
|
||||
console.error('Failed to load goals:', err)
|
||||
setError('Fehler beim Laden der Ziele')
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
const showToast = (message, duration = 2000) => {
|
||||
setToast(message)
|
||||
setTimeout(() => setToast(null), duration)
|
||||
}
|
||||
|
||||
const handleGoalModeChange = async (newMode) => {
|
||||
try {
|
||||
await api.updateGoalMode(newMode)
|
||||
setGoalMode(newMode)
|
||||
showToast('✓ Trainingsmodus aktualisiert')
|
||||
} catch (err) {
|
||||
console.error('Failed to update goal mode:', err)
|
||||
setError('Fehler beim Aktualisieren des Trainingsmodus')
|
||||
}
|
||||
}
|
||||
|
||||
const handleCreateGoal = () => {
|
||||
setEditingGoal(null)
|
||||
setFormData({
|
||||
goal_type: 'weight',
|
||||
is_primary: goals.length === 0, // First goal is primary by default
|
||||
target_value: '',
|
||||
unit: GOAL_TYPES['weight'].unit,
|
||||
target_date: '',
|
||||
name: '',
|
||||
description: ''
|
||||
})
|
||||
setShowGoalForm(true)
|
||||
}
|
||||
|
||||
const handleEditGoal = (goal) => {
|
||||
setEditingGoal(goal.id)
|
||||
setFormData({
|
||||
goal_type: goal.goal_type,
|
||||
is_primary: goal.is_primary,
|
||||
target_value: goal.target_value,
|
||||
unit: goal.unit,
|
||||
target_date: goal.target_date || '',
|
||||
name: goal.name || '',
|
||||
description: goal.description || ''
|
||||
})
|
||||
setShowGoalForm(true)
|
||||
}
|
||||
|
||||
const handleGoalTypeChange = (type) => {
|
||||
setFormData(f => ({
|
||||
...f,
|
||||
goal_type: type,
|
||||
unit: GOAL_TYPES[type].unit
|
||||
}))
|
||||
}
|
||||
|
||||
const handleSaveGoal = async () => {
|
||||
if (!formData.target_value) {
|
||||
setError('Bitte Zielwert eingeben')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const data = {
|
||||
goal_type: formData.goal_type,
|
||||
is_primary: formData.is_primary,
|
||||
target_value: parseFloat(formData.target_value),
|
||||
unit: formData.unit,
|
||||
target_date: formData.target_date || null,
|
||||
name: formData.name || null,
|
||||
description: formData.description || null
|
||||
}
|
||||
|
||||
if (editingGoal) {
|
||||
await api.updateGoal(editingGoal, data)
|
||||
showToast('✓ Ziel aktualisiert')
|
||||
} else {
|
||||
await api.createGoal(data)
|
||||
showToast('✓ Ziel erstellt')
|
||||
}
|
||||
|
||||
await loadData()
|
||||
setShowGoalForm(false)
|
||||
setEditingGoal(null)
|
||||
} catch (err) {
|
||||
console.error('Failed to save goal:', err)
|
||||
setError(err.message || 'Fehler beim Speichern')
|
||||
}
|
||||
}
|
||||
|
||||
const handleDeleteGoal = async (goalId) => {
|
||||
if (!confirm('Ziel wirklich löschen?')) return
|
||||
|
||||
try {
|
||||
await api.deleteGoal(goalId)
|
||||
showToast('✓ Ziel gelöscht')
|
||||
await loadData()
|
||||
} catch (err) {
|
||||
console.error('Failed to delete goal:', err)
|
||||
setError('Fehler beim Löschen')
|
||||
}
|
||||
}
|
||||
|
||||
const getProgressColor = (progress) => {
|
||||
if (progress >= 100) return 'var(--accent)'
|
||||
if (progress >= 75) return '#1D9E75'
|
||||
if (progress >= 50) return '#378ADD'
|
||||
if (progress >= 25) return '#E67E22'
|
||||
return '#D85A30'
|
||||
}
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<div className="page">
|
||||
<div style={{ textAlign: 'center', padding: '40px' }}>
|
||||
<div className="spinner"></div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="page">
|
||||
<div className="page-header">
|
||||
<h1><Target size={24} /> Ziele</h1>
|
||||
</div>
|
||||
|
||||
{error && (
|
||||
<div className="card" style={{ background: '#FEF2F2', border: '1px solid #FCA5A5', marginBottom: 16 }}>
|
||||
<p style={{ color: '#DC2626', margin: 0 }}>{error}</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{toast && (
|
||||
<div style={{
|
||||
position: 'fixed',
|
||||
top: 16,
|
||||
right: 16,
|
||||
background: 'var(--accent)',
|
||||
color: 'white',
|
||||
padding: '12px 20px',
|
||||
borderRadius: 8,
|
||||
boxShadow: '0 4px 12px rgba(0,0,0,0.15)',
|
||||
zIndex: 1000
|
||||
}}>
|
||||
{toast}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Strategic Goal Mode Selection */}
|
||||
<div className="card" style={{ marginBottom: 16 }}>
|
||||
<h2 style={{ marginTop: 0 }}>🎯 Trainingsmodus</h2>
|
||||
<p style={{ color: 'var(--text2)', fontSize: 14, marginBottom: 16 }}>
|
||||
Wähle deine grundlegende Trainingsausrichtung. Dies beeinflusst die Gewichtung
|
||||
und Interpretation aller Analysen.
|
||||
</p>
|
||||
|
||||
<div style={{
|
||||
display: 'grid',
|
||||
gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))',
|
||||
gap: 12
|
||||
}}>
|
||||
{GOAL_MODES.map(mode => (
|
||||
<button
|
||||
key={mode.id}
|
||||
onClick={() => handleGoalModeChange(mode.id)}
|
||||
className={goalMode === mode.id ? 'btn-primary' : 'btn-secondary'}
|
||||
style={{
|
||||
padding: 16,
|
||||
textAlign: 'left',
|
||||
background: goalMode === mode.id ? mode.color : 'var(--surface)',
|
||||
borderColor: goalMode === mode.id ? mode.color : 'var(--border)',
|
||||
color: goalMode === mode.id ? 'white' : 'var(--text1)'
|
||||
}}
|
||||
>
|
||||
<div style={{ fontSize: 24, marginBottom: 8 }}>{mode.icon}</div>
|
||||
<div style={{ fontWeight: 600, marginBottom: 4 }}>{mode.label}</div>
|
||||
<div style={{
|
||||
fontSize: 12,
|
||||
opacity: goalMode === mode.id ? 0.9 : 0.7
|
||||
}}>
|
||||
{mode.description}
|
||||
</div>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Tactical Goals List */}
|
||||
<div className="card">
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 16 }}>
|
||||
<h2 style={{ margin: 0 }}>🎯 Konkrete Ziele</h2>
|
||||
<button className="btn-primary" onClick={handleCreateGoal}>
|
||||
<Plus size={16} /> Ziel hinzufügen
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{goals.length === 0 ? (
|
||||
<div style={{ textAlign: 'center', padding: '40px 20px', color: 'var(--text2)' }}>
|
||||
<Target size={48} style={{ opacity: 0.3, marginBottom: 16 }} />
|
||||
<p>Noch keine Ziele definiert</p>
|
||||
<button className="btn-primary" onClick={handleCreateGoal} style={{ marginTop: 16 }}>
|
||||
Erstes Ziel erstellen
|
||||
</button>
|
||||
</div>
|
||||
) : (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
|
||||
{goals.map(goal => {
|
||||
const typeInfo = GOAL_TYPES[goal.goal_type] || {}
|
||||
return (
|
||||
<div
|
||||
key={goal.id}
|
||||
className="card"
|
||||
style={{
|
||||
background: 'var(--surface2)',
|
||||
border: goal.is_primary ? '2px solid var(--accent)' : '1px solid var(--border)'
|
||||
}}
|
||||
>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start' }}>
|
||||
<div style={{ flex: 1 }}>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 8 }}>
|
||||
<span style={{ fontSize: 20 }}>{typeInfo.icon}</span>
|
||||
<span style={{ fontWeight: 600 }}>
|
||||
{goal.name || typeInfo.label}
|
||||
</span>
|
||||
{goal.is_primary && (
|
||||
<span style={{
|
||||
background: 'var(--accent)',
|
||||
color: 'white',
|
||||
fontSize: 11,
|
||||
padding: '2px 8px',
|
||||
borderRadius: 4
|
||||
}}>
|
||||
PRIMÄR
|
||||
</span>
|
||||
)}
|
||||
<span style={{
|
||||
background: goal.status === 'active' ? '#E6F4F1' : '#F3F4F6',
|
||||
color: goal.status === 'active' ? 'var(--accent)' : 'var(--text2)',
|
||||
fontSize: 11,
|
||||
padding: '2px 8px',
|
||||
borderRadius: 4
|
||||
}}>
|
||||
{goal.status === 'active' ? 'AKTIV' : goal.status?.toUpperCase()}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', gap: 24, marginBottom: 12, fontSize: 14 }}>
|
||||
<div>
|
||||
<span style={{ color: 'var(--text2)' }}>Start:</span>{' '}
|
||||
<strong>{goal.start_value} {goal.unit}</strong>
|
||||
</div>
|
||||
<div>
|
||||
<span style={{ color: 'var(--text2)' }}>Aktuell:</span>{' '}
|
||||
<strong>{goal.current_value || '—'} {goal.unit}</strong>
|
||||
</div>
|
||||
<div>
|
||||
<span style={{ color: 'var(--text2)' }}>Ziel:</span>{' '}
|
||||
<strong>{goal.target_value} {goal.unit}</strong>
|
||||
</div>
|
||||
{goal.target_date && (
|
||||
<div>
|
||||
<Calendar size={14} style={{ verticalAlign: 'middle', marginRight: 4 }} />
|
||||
{dayjs(goal.target_date).format('DD.MM.YYYY')}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{goal.progress_pct !== null && (
|
||||
<div>
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
fontSize: 12,
|
||||
marginBottom: 4
|
||||
}}>
|
||||
<span>Fortschritt</span>
|
||||
<span style={{ fontWeight: 600 }}>{goal.progress_pct}%</span>
|
||||
</div>
|
||||
<div style={{
|
||||
width: '100%',
|
||||
height: 6,
|
||||
background: 'var(--surface)',
|
||||
borderRadius: 3,
|
||||
overflow: 'hidden'
|
||||
}}>
|
||||
<div style={{
|
||||
width: `${Math.min(100, Math.max(0, goal.progress_pct))}%`,
|
||||
height: '100%',
|
||||
background: getProgressColor(goal.progress_pct),
|
||||
transition: 'width 0.3s ease'
|
||||
}} />
|
||||
</div>
|
||||
|
||||
{goal.on_track !== null && (
|
||||
<div style={{ marginTop: 8, fontSize: 12 }}>
|
||||
{goal.on_track ? (
|
||||
<span style={{ color: 'var(--accent)' }}>
|
||||
✓ Ziel voraussichtlich erreichbar bis {dayjs(goal.target_date).format('DD.MM.YYYY')}
|
||||
</span>
|
||||
) : (
|
||||
<span style={{ color: '#D85A30' }}>
|
||||
⚠ Prognose: {goal.projection_date ? dayjs(goal.projection_date).format('DD.MM.YYYY') : 'Offen'}
|
||||
{goal.target_date && ' (später als geplant)'}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', gap: 8 }}>
|
||||
<button
|
||||
className="btn-secondary"
|
||||
onClick={() => handleEditGoal(goal)}
|
||||
style={{ padding: '6px 12px' }}
|
||||
>
|
||||
<Pencil size={14} />
|
||||
</button>
|
||||
<button
|
||||
className="btn-secondary"
|
||||
onClick={() => handleDeleteGoal(goal.id)}
|
||||
style={{ padding: '6px 12px', color: '#DC2626' }}
|
||||
>
|
||||
<Trash2 size={14} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Goal Form Modal */}
|
||||
{showGoalForm && (
|
||||
<div style={{
|
||||
position: 'fixed',
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
background: 'rgba(0,0,0,0.5)',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
zIndex: 1000,
|
||||
padding: 16
|
||||
}}>
|
||||
<div className="card" style={{
|
||||
maxWidth: 500,
|
||||
width: '100%',
|
||||
maxHeight: '90vh',
|
||||
overflow: 'auto'
|
||||
}}>
|
||||
<h2 style={{ marginTop: 0 }}>
|
||||
{editingGoal ? 'Ziel bearbeiten' : 'Neues Ziel'}
|
||||
</h2>
|
||||
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
|
||||
<div>
|
||||
<label className="form-label">Zieltyp</label>
|
||||
<select
|
||||
className="form-input"
|
||||
value={formData.goal_type}
|
||||
onChange={e => handleGoalTypeChange(e.target.value)}
|
||||
>
|
||||
{Object.entries(GOAL_TYPES).map(([key, info]) => (
|
||||
<option key={key} value={key}>
|
||||
{info.icon} {info.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="form-label">Name (optional)</label>
|
||||
<input
|
||||
type="text"
|
||||
className="form-input"
|
||||
value={formData.name}
|
||||
onChange={e => setFormData(f => ({ ...f, name: e.target.value }))}
|
||||
placeholder="z.B. Sommerfigur 2026"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="form-label">Zielwert *</label>
|
||||
<div style={{ display: 'flex', gap: 8 }}>
|
||||
<input
|
||||
type="number"
|
||||
step="0.01"
|
||||
className="form-input"
|
||||
value={formData.target_value}
|
||||
onChange={e => setFormData(f => ({ ...f, target_value: e.target.value }))}
|
||||
placeholder="Zielwert"
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
className="form-input"
|
||||
value={formData.unit}
|
||||
readOnly
|
||||
style={{ width: 80 }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="form-label">Zieldatum (optional)</label>
|
||||
<input
|
||||
type="date"
|
||||
className="form-input"
|
||||
value={formData.target_date}
|
||||
onChange={e => setFormData(f => ({ ...f, target_date: e.target.value }))}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="form-label">Beschreibung (optional)</label>
|
||||
<textarea
|
||||
className="form-input"
|
||||
value={formData.description}
|
||||
onChange={e => setFormData(f => ({ ...f, description: e.target.value }))}
|
||||
rows={3}
|
||||
placeholder="Warum ist dir dieses Ziel wichtig?"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label style={{ display: 'flex', alignItems: 'center', gap: 8, cursor: 'pointer' }}>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={formData.is_primary}
|
||||
onChange={e => setFormData(f => ({ ...f, is_primary: e.target.checked }))}
|
||||
/>
|
||||
<span>Als Primärziel setzen</span>
|
||||
</label>
|
||||
<p style={{ fontSize: 12, color: 'var(--text2)', marginTop: 4, marginLeft: 24 }}>
|
||||
Dein Primärziel hat höchste Priorität in Analysen und Charts
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', gap: 12, marginTop: 24 }}>
|
||||
<button className="btn-primary" onClick={handleSaveGoal} style={{ flex: 1 }}>
|
||||
{editingGoal ? 'Aktualisieren' : 'Erstellen'}
|
||||
</button>
|
||||
<button
|
||||
className="btn-secondary"
|
||||
onClick={() => {
|
||||
setShowGoalForm(false)
|
||||
setEditingGoal(null)
|
||||
}}
|
||||
style={{ flex: 1 }}
|
||||
>
|
||||
Abbrechen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -330,4 +330,21 @@ export const api = {
|
||||
|
||||
// Placeholder Export
|
||||
exportPlaceholderValues: () => req('/prompts/placeholders/export-values'),
|
||||
|
||||
// v9e: Goals System (Strategic + Tactical)
|
||||
getGoalMode: () => req('/goals/mode'),
|
||||
updateGoalMode: (mode) => req('/goals/mode', jput({goal_mode: mode})),
|
||||
listGoals: () => req('/goals/list'),
|
||||
createGoal: (d) => req('/goals/create', json(d)),
|
||||
updateGoal: (id,d) => req(`/goals/${id}`, jput(d)),
|
||||
deleteGoal: (id) => req(`/goals/${id}`, {method:'DELETE'}),
|
||||
|
||||
// Training Phases
|
||||
listTrainingPhases: () => req('/goals/phases'),
|
||||
createTrainingPhase: (d) => req('/goals/phases', json(d)),
|
||||
updatePhaseStatus: (id,status) => req(`/goals/phases/${id}/status?status=${status}`, jput({})),
|
||||
|
||||
// Fitness Tests
|
||||
listFitnessTests: () => req('/goals/tests'),
|
||||
createFitnessTest: (d) => req('/goals/tests', json(d)),
|
||||
}
|
||||
Reference in new issue
Block a user