-
+ Home
+
+
Dashboard
Workouts
Plans
Rules
Routes
diff --git a/frontend/src/components/PlanTimeline.jsx b/frontend/src/components/PlanTimeline.jsx
index c349a62..e4791b0 100644
--- a/frontend/src/components/PlanTimeline.jsx
+++ b/frontend/src/components/PlanTimeline.jsx
@@ -1,5 +1,5 @@
import { useEffect, useState } from 'react'
-import { Link } from 'react-router-dom'
+import Link from 'next/link'
const PlanTimeline = ({ planId }) => {
const [planData, setPlanData] = useState(null)
@@ -120,7 +120,7 @@ const PlanTimeline = ({ planId }) => {
)}
View →
diff --git a/frontend/src/components/WorkoutAnalysis.jsx b/frontend/src/components/WorkoutAnalysis.jsx
index 027c75f..4538e2c 100644
--- a/frontend/src/components/WorkoutAnalysis.jsx
+++ b/frontend/src/components/WorkoutAnalysis.jsx
@@ -1,10 +1,10 @@
import { useState } from 'react';
-import { useNavigate } from 'react-router-dom';
+import { useRouter } from 'next/router';
const WorkoutAnalysis = ({ workout, analysis }) => {
const [approving, setApproving] = useState(false);
const [error, setError] = useState(null);
- const navigate = useNavigate();
+ const router = useRouter();
const approveAnalysis = async () => {
setApproving(true);
@@ -27,7 +27,7 @@ const WorkoutAnalysis = ({ workout, analysis }) => {
if (result.new_plan_id) {
// Navigate to the new plan
- navigate(`/plans/${result.new_plan_id}`);
+ router.push(`/plans/${result.new_plan_id}`);
} else {
// Show success message
setApproving(false);
@@ -157,45 +157,6 @@ const WorkoutAnalysis = ({ workout, analysis }) => {
)}
);
-
- useEffect(() => {
- const fetchMetrics = async () => {
- try {
- const response = await fetch(`/api/workouts/${workout.id}/metrics`);
- const data = await response.json();
- setMetrics(data);
- } catch (err) {
- console.error('Error fetching workout metrics:', err);
- } finally {
- setLoadingMetrics(false);
- }
- };
-
- if (workout?.id) {
- fetchMetrics();
- }
- }, [workout]);
-
- return (
-
- {/* Workout Summary */}
-
-
- {workout.activity_type || 'Cycling'} - {new Date(workout.start_time).toLocaleDateString()}
-
-
-
- {/* Existing metric cards */}
-
-
-
- {/* Metrics Charts */}
- {/* Existing chart implementation */}
-
- {/* Analysis Content */}
- {/* Existing analysis content */}
-
- );
};
export default WorkoutAnalysis;
\ No newline at end of file
diff --git a/frontend/src/pages/PlanDetails.jsx b/frontend/src/pages/PlanDetails.jsx
index 034a65d..8efd375 100644
--- a/frontend/src/pages/PlanDetails.jsx
+++ b/frontend/src/pages/PlanDetails.jsx
@@ -1,8 +1,30 @@
-import { useParams } from 'react-router-dom'
+import { useRouter } from 'next/router'
import PlanTimeline from '../components/PlanTimeline'
const PlanDetails = () => {
- const { planId } = useParams()
+ const router = useRouter()
+ const { planId } = router.query
+
+ // If the planId is not available yet (still loading), show a loading state
+ if (!planId) {
+ return (
+
diff --git a/frontend/src/pages/index.tsx b/frontend/src/pages/index.tsx
index 1158dc8..836b86d 100644
--- a/frontend/src/pages/index.tsx
+++ b/frontend/src/pages/index.tsx
@@ -1,4 +1,5 @@
import { useEffect, useState } from 'react';
+import Navigation from '../components/Navigation';
export default function Home() {
const [healthStatus, setHealthStatus] = useState
('checking...');
@@ -21,30 +22,33 @@ export default function Home() {
}, []);
return (
-
-
-
- Welcome to AI Cycling Coach
-
-
- Your AI-powered training companion for cyclists
-
-
-
-
- System Status
-
-
-
-
- Backend service: {healthStatus}
-
+
+
+
+
+
+ Welcome to AI Cycling Coach
+
+
+ Your AI-powered training companion for cyclists
+
+
+
+
+ System Status
+
+
+
+
+ Backend service: {healthStatus}
+
+
+
+
+ Development in progress - more features coming soon!
+
-
-
- Development in progress - more features coming soon!
-
);
diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json
new file mode 100644
index 0000000..d55eb30
--- /dev/null
+++ b/frontend/tsconfig.json
@@ -0,0 +1,28 @@
+{
+ "compilerOptions": {
+ "lib": [
+ "dom",
+ "dom.iterable",
+ "esnext"
+ ],
+ "allowJs": true,
+ "skipLibCheck": true,
+ "strict": false,
+ "noEmit": true,
+ "incremental": true,
+ "module": "esnext",
+ "esModuleInterop": true,
+ "moduleResolution": "node",
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "jsx": "preserve"
+ },
+ "include": [
+ "next-env.d.ts",
+ "**/*.ts",
+ "**/*.tsx"
+ ],
+ "exclude": [
+ "node_modules"
+ ]
+}