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
29 changes: 16 additions & 13 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import { estimateCalories, getSavedUserWeight } from "./utils/calorieEstimator";
import { CursorGlow } from "./components/CursorGlow";
import { PageErrorBoundary } from "./components/PageErrorBoundary";
import { ExitConfirmModal } from "./components/ExitConfirmModal";
import type { ActivePlan } from "./components/WorkoutPlansScreen";
const WelcomeScreen = lazy(() => import("./components/WelcomeScreen").then(m => ({ default: m.WelcomeScreen })));
const SummaryScreen = lazy(() => import("./components/SummaryScreen").then(m => ({ default: m.SummaryScreen })));
const TrophyRoom = lazy(() => import("./components/TrophyRoom").then(m => ({ default: m.TrophyRoom })));
Expand All @@ -39,8 +39,7 @@
const WorkoutScreen = lazy(() => import("./components/WorkoutScreen").then(m => ({ default: m.WorkoutScreen })));
const ReplayScreen = lazy(() => import("./components/ReplayScreen").then(m => ({ default: m.ReplayScreen })));
const AvatarCustomizationScreen = lazy(() => import("./components/AvatarCustomizationScreen").then(m => ({ default: m.AvatarCustomizationScreen })));
const TutorialsScreen = lazy(() => import("./components/TutorialsScreen").then(m => ({ default: m.TutorialsScreen })));

const WorkoutPlansScreen = lazy(() => import("./components/WorkoutPlansScreen").then(m => ({ default: m.WorkoutPlansScreen })));

type Screen =
| "welcome"
Expand All @@ -58,15 +57,12 @@
| "profile"
| "fitness"
| "avatar"
| "privacy"
| "terms&conditions"
| "tutorials";

| "workoutPlans";

type ScreenTransitionMap = Record<Screen, readonly Screen[]>;

const SCREEN_TRANSITIONS: ScreenTransitionMap = {
welcome: ["calibration", "history", "trophy", "profile", "login", "fitness", "about", "contact", "avatar", "tutorials", "privacy", "terms&conditions"],
welcome: ["calibration", "history", "trophy", "profile", "login", "fitness", "about", "contact", "avatar", "workoutPlans"],
calibration: ["workout", "welcome", "login"],
workout: ["summary", "welcome"],
summary: ["replay", "welcome"],
Expand All @@ -81,9 +77,7 @@
about: ["welcome"],
contact: ["welcome"],
avatar: ["welcome"],
privacy: ["welcome"],
"terms&conditions": ["welcome"],
tutorials: ["welcome", "calibration"],
workoutPlans: ["welcome"],
};


Expand Down Expand Up @@ -127,6 +121,7 @@
const { theme, setTheme } = useTheme();
const { user, loading: authLoading } = useAuth();
const [currentScreen, setCurrentScreen] = useState<Screen>("welcome");
const [activePlan, setActivePlan] = useState<ActivePlan | null>(null);

const streamRef = useRef<MediaStream | null>(null);

Expand Down Expand Up @@ -369,8 +364,7 @@
onViewProfile={() => navigateTo("profile")}
onViewFitnessCalculator={() => navigateTo("fitness")}
onViewAvatarCustomization={() => navigateTo("avatar")}
onViewWorkoutPlans={() => {}}
onViewTutorials={() => navigateTo("tutorials")}
onViewWorkoutPlans={() => navigateTo("workoutPlans")}
leveling={leveling}
/>
)}
Expand Down Expand Up @@ -402,7 +396,7 @@

{currentScreen === "battle" && (
<PageErrorBoundary fallbackMessage="Failed to load Battle Mode. Please try again.">
<BattleMode onBack={() => navigateTo("welcome")} />

Check failure on line 399 in src/App.tsx

View workflow job for this annotation

GitHub Actions / build-and-test (22.x)

'BattleMode' is not defined

Check failure on line 399 in src/App.tsx

View workflow job for this annotation

GitHub Actions / build-and-test (20.x)

'BattleMode' is not defined
</PageErrorBoundary>
)}
{currentScreen === "workout" && (
Expand Down Expand Up @@ -463,7 +457,7 @@

{currentScreen === "tutorials" && (
<Suspense fallback={<div className="loading-fallback">Loading Tutorials...</div>}>
<TutorialsScreen

Check failure on line 460 in src/App.tsx

View workflow job for this annotation

GitHub Actions / build-and-test (22.x)

'TutorialsScreen' is not defined

Check failure on line 460 in src/App.tsx

View workflow job for this annotation

GitHub Actions / build-and-test (20.x)

'TutorialsScreen' is not defined
onBack={() => navigateTo("welcome")}
onStartTryMode={(exerciseKey) => {
const config = exercises[exerciseKey];
Expand All @@ -480,6 +474,15 @@
<FitnessCalculator onBack={() => navigateTo("welcome")} />
)}

{currentScreen === "workoutPlans" && (
<PageErrorBoundary fallbackMessage="Failed to load workout plans. Please try again.">
<WorkoutPlansScreen
onBack={() => navigateTo("welcome")}
activePlan={activePlan}
setActivePlan={setActivePlan}
/>
</PageErrorBoundary>
)}
</Suspense>

{currentScreen === "about" && (
Expand Down Expand Up @@ -525,7 +528,7 @@
</div>
)}
{showExitModal && (
<ExitConfirmModal

Check failure on line 531 in src/App.tsx

View workflow job for this annotation

GitHub Actions / build-and-test (22.x)

'ExitConfirmModal' is not defined

Check failure on line 531 in src/App.tsx

View workflow job for this annotation

GitHub Actions / build-and-test (20.x)

'ExitConfirmModal' is not defined
message="Are you sure you want to end your session?"
onStay={() => setShowExitModal(false)}
onExit={() => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/WorkoutPlansScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from "lucide-react";
import { useTheme } from "../context/ThemeContext";

interface ActivePlan {
export interface ActivePlan {
id: string;
goal: string;
level: string;
Expand Down
Loading