Minor History fix

This commit is contained in:
AG
2025-11-20 23:57:00 +02:00
parent e6a3a5b0ff
commit ada10d52e8
3 changed files with 312 additions and 305 deletions

View File

@@ -18,6 +18,24 @@ interface TrackerProps {
lang: Language;
}
const FilledInput = ({ label, value, onChange, type = "number", icon, autoFocus, step }: any) => (
<div className="relative group bg-surface-container-high rounded-t-lg border-b border-outline-variant hover:bg-white/5 focus-within:border-primary transition-colors">
<label className="absolute top-2 left-4 text-[10px] font-medium text-on-surface-variant flex items-center gap-1">
{icon} {label}
</label>
<input
type={type}
step={step}
inputMode="decimal"
autoFocus={autoFocus}
className="w-full pt-6 pb-2 px-4 bg-transparent text-2xl text-on-surface focus:outline-none placeholder-transparent"
placeholder="0"
value={value}
onChange={onChange}
/>
</div>
);
const Tracker: React.FC<TrackerProps> = ({ userId, userWeight, activeSession, activePlan, onSessionStart, onSessionEnd, onSetAdded, onRemoveSet, lang }) => {
const [exercises, setExercises] = useState<ExerciseDef[]>([]);
const [plans, setPlans] = useState<WorkoutPlan[]>([]);
@@ -107,11 +125,11 @@ const Tracker: React.FC<TrackerProps> = ({ userId, userWeight, activeSession, ac
setLastSet(set);
if (set) {
if (set.weight !== undefined) setWeight(set.weight.toString());
if (set.reps !== undefined) setReps(set.reps.toString());
if (set.durationSeconds !== undefined) setDuration(set.durationSeconds.toString());
if (set.distanceMeters !== undefined) setDistance(set.distanceMeters.toString());
if (set.height !== undefined) setHeight(set.height.toString());
if (set.weight != null) setWeight(set.weight.toString());
if (set.reps != null) setReps(set.reps.toString());
if (set.durationSeconds != null) setDuration(set.durationSeconds.toString());
if (set.distanceMeters != null) setDistance(set.distanceMeters.toString());
if (set.height != null) setHeight(set.height.toString());
} else {
setWeight(''); setReps(''); setDuration(''); setDistance(''); setHeight('');
}
@@ -189,24 +207,6 @@ const Tracker: React.FC<TrackerProps> = ({ userId, userWeight, activeSession, ac
const isPlanFinished = activePlan && currentStepIndex >= activePlan.steps.length;
const FilledInput = ({ label, value, onChange, type = "number", icon, autoFocus, step }: any) => (
<div className="relative group bg-surface-container-high rounded-t-lg border-b border-outline-variant hover:bg-white/5 focus-within:border-primary transition-colors">
<label className="absolute top-2 left-4 text-[10px] font-medium text-on-surface-variant flex items-center gap-1">
{icon} {label}
</label>
<input
type={type}
step={step}
inputMode="decimal"
autoFocus={autoFocus}
className="w-full pt-6 pb-2 px-4 bg-transparent text-2xl text-on-surface focus:outline-none placeholder-transparent"
placeholder="0"
value={value}
onChange={onChange}
/>
</div>
);
const exerciseTypeLabels: Record<ExerciseType, string> = {
[ExerciseType.STRENGTH]: t('type_strength', lang),
[ExerciseType.BODYWEIGHT]: t('type_bodyweight', lang),