Workout finishing fixed
This commit is contained in:
6
App.tsx
6
App.tsx
@@ -73,12 +73,13 @@ function App() {
|
||||
setCurrentUser(updatedUser);
|
||||
};
|
||||
|
||||
const handleStartSession = (plan?: WorkoutPlan) => {
|
||||
const handleStartSession = (plan?: WorkoutPlan, startWeight?: number) => {
|
||||
if (!currentUser) return;
|
||||
|
||||
// Get latest weight from profile or default
|
||||
const profile = getCurrentUserProfile(currentUser.id);
|
||||
const currentWeight = profile?.weight || 70;
|
||||
// Use provided startWeight, or profile weight, or default 70
|
||||
const currentWeight = startWeight || profile?.weight || 70;
|
||||
|
||||
const newSession: WorkoutSession = {
|
||||
id: crypto.randomUUID(),
|
||||
@@ -155,6 +156,7 @@ function App() {
|
||||
{currentTab === 'TRACK' && (
|
||||
<Tracker
|
||||
userId={currentUser.id}
|
||||
userWeight={currentUser.profile?.weight}
|
||||
activeSession={activeSession}
|
||||
activePlan={activePlan}
|
||||
onSessionStart={handleStartSession}
|
||||
|
||||
Reference in New Issue
Block a user