Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/components/mesocycles/SplitProgressTracker.css
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,16 @@
-webkit-tap-highlight-color: transparent;
font-family: inherit;
width: 100%;
/* Reset default button styles so clickable cards render consistently */
border: none;
background: none;
padding: 0;
color: inherit;
text-align: inherit;
appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
outline: none;
}

.split-card.clickable:hover {
Expand Down
21 changes: 13 additions & 8 deletions src/components/mesocycles/SplitProgressTracker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,20 @@ export default function SplitProgressTracker({
activeWorkout.splitDayId === info.splitDay.id;

const handleCardClick = () => {
if (isInProgress && onResumeWorkout) {
// Resume the active workout for this split
onResumeWorkout();
if (isInProgress) {
if (onResumeWorkout) {
onResumeWorkout();
} else {
console.warn(
'Resume workout callback not provided - workout cannot be resumed'
);
}
} else if (onStartWorkout) {
// Start (or re-do) this split day
onStartWorkout(info.splitDay.id);
} else {
console.warn(
'Start workout callback not provided - workout cannot be started'
);
}
};

Expand Down Expand Up @@ -206,10 +214,7 @@ export default function SplitProgressTracker({
<div className="completion-message">
<span className="completion-icon">🎉</span>
<p className="completion-text">All done this week!</p>
<p className="completion-subtext">
Tap any split above to repeat it or start next week&apos;s
training
</p>
<p className="completion-subtext">Tap any split above to redo it</p>
</div>
)}
</div>
Expand Down
11 changes: 9 additions & 2 deletions src/components/workouts/WorkoutSession.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Handles active workout logging and tracking
*/

import { useState, useMemo, useEffect } from 'react';
import { useState, useMemo, useEffect, useRef } from 'react';
import { useWorkoutSession } from '../../hooks/useWorkoutSession';
import {
useExercises,
Expand Down Expand Up @@ -103,9 +103,16 @@ export default function WorkoutSession({ onNavigate }: WorkoutSessionProps) {
}, [activeMesocycle, completedWorkouts]);

// Auto-start workout if coming from mesocycle dashboard with a selected split
const autoStartProcessedRef = useRef(false);
useEffect(() => {
const selectedSplitDayId = localStorage.getItem('selectedSplitDayId');
if (selectedSplitDayId && activeMesocycle) {
if (
selectedSplitDayId &&
activeMesocycle &&
!autoStartProcessedRef.current
) {
// Mark as processed to prevent re-execution
autoStartProcessedRef.current = true;
// Clear immediately to prevent re-triggering
localStorage.removeItem('selectedSplitDayId');

Expand Down