diff --git a/src/AppRoutes.tsx b/src/AppRoutes.tsx
index 0269bad..1e58496 100644
--- a/src/AppRoutes.tsx
+++ b/src/AppRoutes.tsx
@@ -5,7 +5,7 @@ import Login from "./pages/Login";
import Home from "./pages/Home";
import ForgotPasword from "./pages/ForgotPassword";
import { Courses } from "./pages/Courses";
-import CourseExercises from "./pages/CourseExercises";
+import { CourseExercises } from "./pages/CourseExercises";
import { Exercise } from "./pages/Exercise";
import Settings from "./pages/Settings";
import CourseComplete from "./pages/CourseComplete";
diff --git a/src/pages/CourseExercises.tsx b/src/pages/CourseExercises.tsx
index a3520e8..efebf37 100644
--- a/src/pages/CourseExercises.tsx
+++ b/src/pages/CourseExercises.tsx
@@ -1,6 +1,5 @@
"use client"
-import type React from "react"
import { useState } from "react"
import { useHistory } from "react-router-dom"
@@ -8,10 +7,10 @@ import HeaderNav from "../components/HeaderNav"
import BottomNavigation from "../components/BottomNavigation"
import video from "../assets/img/video.mov"
-
+import { connect } from '../confconnect';
import { getRouteExercise } from "../shared/consts/router"
-const CourseExercises: React.FC = () => {
+export const CourseExercises = () => {
const history = useHistory()
// const { id } = useParams<{ id: string }>();
const [currentSlide, setCurrentSlide] = useState(0)
@@ -220,4 +219,4 @@ const course = {
)
}
-export default CourseExercises
+
diff --git a/src/pages/Courses.tsx b/src/pages/Courses.tsx
index 1db36ae..7f152c1 100644
--- a/src/pages/Courses.tsx
+++ b/src/pages/Courses.tsx
@@ -2,9 +2,10 @@
import { useState, useEffect } from 'react';
import BottomNavigation from "../components/BottomNavigation"
-import { useHistory } from "react-router-dom" // для v5
+import { useHistory } from "react-router-dom"
import HeaderNav from "../components/HeaderNav"
import { connect } from '../confconnect';
+import { getRouteCourseExercises } from '../shared/consts/router';
interface Course {
ID: number;
@@ -13,6 +14,31 @@ interface Course {
url_file_img: string;
}
+const ProgressLine = () => {
+ return (
+
+ );
+}
+
+const AnalitcsCards = () => {
+ return (
+
+
+
+ {/* Прогрессная часть */}
+
+
+ {/* Текст поверх линии */}
+
Вы прошли реабилитацию на {85}%
+
+
+
+ )
+}
+
export const Courses = () => {
const history = useHistory();
@@ -21,6 +47,7 @@ export const Courses = () => {
const token = localStorage.getItem('authToken');
useEffect(() => {
+ console.log(token)
if (!token) {
setError('Токен не найден');
return;
@@ -71,27 +98,111 @@ export const Courses = () => {
});
}, [token]);
+ // Генерируем случайный прогресс для каждого курса
+ const getRandomProgress = () => Math.floor(Math.random() * 100);
+
+ // Цвета для прогресс-баров в оттенках cyan
+ const progressColors = [
+ "from-cyan-400 to-cyan-600",
+ "from-cyan-500 to-cyan-700",
+ "from-teal-400 to-cyan-500",
+ "from-cyan-300 to-teal-600",
+ "from-sky-400 to-cyan-600"
+ ];
+
return (
+
- {error &&
{error}
}
-
- {/* Выводим список курсов */}
-
- {courses.length > 0 ? (
- courses.map(course => (
-
-
{course.title}
-
{course.desc}
- {course.url_file_img && (
-

- )}
-
- ))
- ) : (
- !error &&
Нет назначенных курсов
+
+ {error && (
+
)}
+
+ {/* Заголовок секции */}
+
+
Мои курсы
+ {courses.length} курсов
+
+
+ {/* Выводим список курсов */}
+
+ {courses.length > 0 ? (
+ courses.map((course, index) => {
+ const progress = getRandomProgress();
+ const colorClass = progressColors[index % progressColors.length];
+
+ return (
+
history.push(getRouteCourseExercises(course.ID.toString()))}
+ className="bg-white/30 backdrop-blur-2xl rounded-3xl p-6 border border-white/20 shadow-xl cursor-pointer hover:shadow-2xl transition-all duration-300 transform hover:scale-[1.02]"
+ >
+
+ {/* Изображение курса */}
+ {course.url_file_img && (
+
+

{
+ e.currentTarget.src = "/placeholder.svg?height=64&width=64&text=Course"
+ }}
+ />
+
+ )}
+
+
+
{course.title}
+
+ {/* Описание курса */}
+ {course.desc && (
+
{course.desc}
+ )}
+
+ {/* Индикатор прогресса */}
+
+
+ {/* Информация о прогрессе */}
+
+
{progress}% завершено
+
{Math.floor(Math.random() * 15) + 5} упражнений
+
+
+
+ {/* Иконка стрелки */}
+
+
+
+ )
+ })
+ ) : (
+ !error && (
+
+
У вас пока нет назначенных курсов
+
+
+ )
+ )}
+
diff --git a/ответы сервера b/ответы сервера
index 5d92415..9cc9e20 100644
--- a/ответы сервера
+++ b/ответы сервера
@@ -67,4 +67,9 @@ curl -H "Authorization: Bearer YOUR_TOKEN" http://localhost:8093/pacient/courses
"Courses": []
}
],
- "sessionname": "krasnova@mail.ru"
\ No newline at end of file
+ "sessionname": "krasnova@mail.ru"
+
+
+ curl -X GET \
+ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NTYxMTEyNDQsInVzZXJfZW1haWwiOiJrcmFzbm92YUBtYWlsLnJ1IiwidXNlcl9pZCI6MjUsInVzZXJfbmFtZSI6ImtyYXNub3ZhQG1haWwucnUiLCJ1c2VyX3JvbGUiOiIifQ.3UyamwJrLVkdjKgUG16lYyKm1jiZAv6MRQW0Tj2Z3Tc" \
+ http://localhost:8093/pacient/courses/:course_id
\ No newline at end of file