Unilateral exercises logging

This commit is contained in:
AG
2025-12-03 23:30:32 +02:00
parent 50f3d4d49b
commit a632de65ea
24 changed files with 1656 additions and 244 deletions

View File

@@ -17,6 +17,7 @@ const ExerciseModal: React.FC<ExerciseModalProps> = ({ isOpen, onClose, onSave,
const [newName, setNewName] = useState('');
const [newType, setNewType] = useState<ExerciseType>(ExerciseType.STRENGTH);
const [newBwPercentage, setNewBwPercentage] = useState<string>('100');
const [isUnilateral, setIsUnilateral] = useState(false);
const [error, setError] = useState<string>('');
const exerciseTypeLabels: Record<ExerciseType, string> = {
@@ -47,12 +48,14 @@ const ExerciseModal: React.FC<ExerciseModalProps> = ({ isOpen, onClose, onSave,
id: generateId(),
name: trimmedName,
type: newType,
isUnilateral,
...(newType === ExerciseType.BODYWEIGHT && { bodyWeightPercentage: parseFloat(newBwPercentage) || 100 })
};
await onSave(newEx);
setNewName('');
setNewType(ExerciseType.STRENGTH);
setNewBwPercentage('100');
setIsUnilateral(false);
setError('');
onClose();
};
@@ -120,6 +123,19 @@ const ExerciseModal: React.FC<ExerciseModalProps> = ({ isOpen, onClose, onSave,
/>
)}
<div className="flex items-center gap-3 px-1">
<input
type="checkbox"
id="isUnilateral"
checked={isUnilateral}
onChange={(e) => setIsUnilateral(e.target.checked)}
className="w-5 h-5 rounded border-2 border-outline bg-surface-container-high checked:bg-primary checked:border-primary cursor-pointer"
/>
<label htmlFor="isUnilateral" className="text-sm text-on-surface cursor-pointer">
{t('unilateral_exercise', lang) || 'Unilateral exercise (separate left/right tracking)'}
</label>
</div>
<div className="flex justify-end mt-4">
<button
onClick={handleCreateExercise}