поправила страницу упражнения
This commit is contained in:
parent
26c2d5431e
commit
a1d945b854
@ -9,6 +9,7 @@ import BottomNavigation from "../components/BottomNavigation";
|
|||||||
import { connect } from '../confconnect';
|
import { connect } from '../confconnect';
|
||||||
|
|
||||||
import { getRouteExercise } from "../shared/consts/router";
|
import { getRouteExercise } from "../shared/consts/router";
|
||||||
|
import { ArrowIcon } from "../components/icons/ArrowIcon";
|
||||||
|
|
||||||
|
|
||||||
interface CourseExercises {
|
interface CourseExercises {
|
||||||
@ -18,11 +19,13 @@ interface CourseExercises {
|
|||||||
day: number;
|
day: number;
|
||||||
position: number;
|
position: number;
|
||||||
repeats: number;
|
repeats: number;
|
||||||
|
time: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Exercise {
|
interface Exercise {
|
||||||
id: number;
|
id: number;
|
||||||
title: string;
|
title: string;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,8 +105,8 @@ export const CourseExercises = () => {
|
|||||||
|
|
||||||
{/* Заголовок секции */}
|
{/* Заголовок секции */}
|
||||||
<div className="flex items-center justify-between mb-6">
|
<div className="flex items-center justify-between mb-6">
|
||||||
<h2 className="text-xl font-black text-[#5F5C5C]">Список упражнений</h2>
|
<h2 className="text-xl font-black text-[#5F5C5C]">Упражнения</h2>
|
||||||
<span className="text-sm text-gray-500">{course_exercises.length} Упражнения</span>
|
<span className="text-sm text-gray-500">Количество упражнений: {course_exercises.length}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Кнопки выбора дня */}
|
{/* Кнопки выбора дня */}
|
||||||
@ -146,25 +149,21 @@ export const CourseExercises = () => {
|
|||||||
className="p-4 mb-4 cursor-pointer hover:scale-105 transition duration-300 glass-morphism rounded-3xl border border-white/50 shadow-2xl overflow-hidden backdrop-blur-2xl relative">
|
className="p-4 mb-4 cursor-pointer hover:scale-105 transition duration-300 glass-morphism rounded-3xl border border-white/50 shadow-2xl overflow-hidden backdrop-blur-2xl relative">
|
||||||
<div className="flex justify-between items-center">
|
<div className="flex justify-between items-center">
|
||||||
<div>
|
<div>
|
||||||
<h3 className="text-sm">Упражнение {item.id_exercise}</h3>
|
<h3 className="text-sm font-semibold">Упражнение {item.position}</h3>
|
||||||
<h3 className="text-xl font-semibold text-gray-600">{item.exercise.title}</h3>
|
<h3 className="text-xl font-semibold text-gray-600">{item.exercise.title}</h3>
|
||||||
</div>
|
</div>
|
||||||
{/* Иконка стрелки */}
|
|
||||||
<div className="text-[#2BACBE] transform transition-transform duration-300 hover:translate-x-1">
|
<ArrowIcon className="text-cyan-600" />
|
||||||
<svg className="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
||||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 5l7 7-7 7" />
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="h-0.5 w-full bg-gray-200 my-5"></div>
|
<div className="h-0.5 w-full bg-gray-200 my-3"></div>
|
||||||
|
|
||||||
<div className="flex gap-4 text-xs">
|
<div className="flex gap-10 text-xs text-gray-500">
|
||||||
<p>День: {item.day}</p>
|
|
||||||
<span>·</span>
|
|
||||||
<p>Позиция: {item.position}</p>
|
|
||||||
<span>·</span>
|
|
||||||
<p>Повторений: {item.repeats}</p>
|
<p>Повторений: {item.repeats}</p>
|
||||||
|
|
||||||
|
<p>Время выполнения: {item.time}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))
|
))
|
||||||
|
@ -9,7 +9,7 @@ import HeaderNav from "../components/HeaderNav";
|
|||||||
import { connect } from '../confconnect';
|
import { connect } from '../confconnect';
|
||||||
import { getRouteCourseExercises } from '../shared/consts/router';
|
import { getRouteCourseExercises } from '../shared/consts/router';
|
||||||
|
|
||||||
interface Course {
|
export interface Course {
|
||||||
ID: number;
|
ID: number;
|
||||||
title: string;
|
title: string;
|
||||||
desc: string;
|
desc: string;
|
||||||
|
@ -119,7 +119,7 @@ export const Exercise = () => {
|
|||||||
if (prev >= totalTime) {
|
if (prev >= totalTime) {
|
||||||
setIsPlaying(false)
|
setIsPlaying(false)
|
||||||
// Отправляем результат на сервер при завершении
|
// Отправляем результат на сервер при завершении
|
||||||
submitProgress()
|
// submitProgress()
|
||||||
// Show completion animation
|
// Show completion animation
|
||||||
// history.push(getRouteCourseComplete())
|
// history.push(getRouteCourseComplete())
|
||||||
return totalTime
|
return totalTime
|
||||||
@ -143,21 +143,21 @@ export const Exercise = () => {
|
|||||||
|
|
||||||
|
|
||||||
// Функция для отправки прогресса на сервер
|
// Функция для отправки прогресса на сервер
|
||||||
const submitProgress = async () => {
|
// const submitProgress = async () => {
|
||||||
if (!courseId || !exerciseId) return
|
// if (!courseId || !exerciseId) return
|
||||||
|
|
||||||
try {
|
// try {
|
||||||
const timeUsers = formatTime(currentTime) // Отправляем время в формате MM:SS
|
// const timeUsers = formatTime(currentTime) // Отправляем время в формате MM:SS
|
||||||
|
|
||||||
await connect.post(`pacient/${courseId}/${exerciseId}`, {
|
// await connect.post(`pacient/${courseId}/${exerciseId}`, {
|
||||||
time_users: timeUsers,
|
// time_users: timeUsers,
|
||||||
})
|
// })
|
||||||
|
|
||||||
console.log("Прогресс отправлен на сервер:", timeUsers)
|
// console.log("Прогресс отправлен на сервер:", timeUsers)
|
||||||
} catch (error) {
|
// } catch (error) {
|
||||||
console.error("Ошибка при отправке прогресса:", error)
|
// console.error("Ошибка при отправке прогресса:", error)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
const formatTime = (seconds: number) => {
|
const formatTime = (seconds: number) => {
|
||||||
const mins = Math.floor(seconds / 60)
|
const mins = Math.floor(seconds / 60)
|
||||||
@ -263,7 +263,8 @@ export const Exercise = () => {
|
|||||||
return (
|
return (
|
||||||
<div className="bg-gray-50 w-full h-full overflow-auto">
|
<div className="bg-gray-50 w-full h-full overflow-auto">
|
||||||
<div className="mt-36 mb-90 min-h-screen max-w-4xl mx-auto">
|
<div className="mt-36 mb-90 min-h-screen max-w-4xl mx-auto">
|
||||||
<HeaderNav item={exercise.title} text={`День ${exercise.day}, упражнение ${exercise.position}`} />
|
<HeaderNav item={exercise.title} text={`упражнение ${exercise.position}`}
|
||||||
|
/>
|
||||||
|
|
||||||
<div className="px-4 sm:px-6 mt-10 mb-6">
|
<div className="px-4 sm:px-6 mt-10 mb-6">
|
||||||
<div className="glass-morphism rounded-3xl overflow-hidden shadow-2xl border border-white/20 backdrop-blur-2xl">
|
<div className="glass-morphism rounded-3xl overflow-hidden shadow-2xl border border-white/20 backdrop-blur-2xl">
|
||||||
@ -388,7 +389,7 @@ export const Exercise = () => {
|
|||||||
onTouchStart={() => setIsActive(true)}
|
onTouchStart={() => setIsActive(true)}
|
||||||
onTouchEnd={() => setIsActive(false)}
|
onTouchEnd={() => setIsActive(false)}
|
||||||
|
|
||||||
className={`cursor-pointer px-6 py-3 font-bold rounded-xl transition-all duration-500 hover:scale-105 hover:shadow-lg border border-gray-200 flex items-center justify-center ${!isActive ? "bg-white text-cyan-500" : "bg-orange-400 text-white"}`}
|
className={`cursor-pointer px-6 py-3 font-bold rounded-xl transition-all duration-700 hover:scale-105 hover:shadow-lg border border-gray-200 flex items-center justify-center ${!isActive ? "bg-white text-cyan-500" : "bg-orange-400 text-white"}`}
|
||||||
>
|
>
|
||||||
<CheckIcon
|
<CheckIcon
|
||||||
className="w-6 h-6"
|
className="w-6 h-6"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user