Skip to content

Commit 6123bab

Browse files
Merge pull request #49 from pineapplestrikesback/codex/fix-modal-not-closing-after-swipe
2 parents 0caeb87 + eb622ad commit 6123bab

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

src/ui/components/mobile/MobileCarousel.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ export function MobileCarousel({
6868
<div className="flex touch-pan-y">
6969
{/* Slide 1: Body Heatmap (NAV-03: default view) */}
7070
<div className="flex-[0_0_100%] min-w-0 px-4">
71-
<MobileHeatmap profileId={profileId} daysBack={daysBack} />
71+
<MobileHeatmap
72+
profileId={profileId}
73+
daysBack={daysBack}
74+
isActive={selectedIndex === 0}
75+
/>
7276
</div>
7377

7478
{/* Slide 2: Muscle List */}

src/ui/components/mobile/MobileHeatmap.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { MuscleDetailModal } from './MuscleDetailModal';
2121
interface MobileHeatmapProps {
2222
profileId: string | null;
2323
daysBack?: number;
24+
isActive?: boolean;
2425
}
2526

2627
/**
@@ -130,7 +131,11 @@ interface MuscleStats {
130131
* Mobile heatmap component.
131132
* Displays a single body view with 3D flip animation between front and back.
132133
*/
133-
export function MobileHeatmap({ profileId, daysBack = 7 }: MobileHeatmapProps): React.ReactElement {
134+
export function MobileHeatmap({
135+
profileId,
136+
daysBack = 7,
137+
isActive = true,
138+
}: MobileHeatmapProps): React.ReactElement {
134139
const { stats, isLoading, error } = useScientificMuscleVolume(profileId, daysBack);
135140
const { config } = useEffectiveMuscleGroupConfig(profileId);
136141
const [view, setView] = useSessionState<'front' | 'back'>(
@@ -148,6 +153,13 @@ export function MobileHeatmap({ profileId, daysBack = 7 }: MobileHeatmapProps):
148153
}
149154
}, [tappedRegion]);
150155

156+
// Close modal when carousel navigates away from heatmap
157+
useEffect(() => {
158+
if (!isActive) {
159+
setSelectedRegion(null);
160+
}
161+
}, [isActive]);
162+
151163
// Create set of hidden muscles for quick lookup
152164
const hiddenMuscles = useMemo(
153165
() => new Set<ScientificMuscle>(config.hidden),

0 commit comments

Comments
 (0)