адаптивность домашней страницы/правки в UX
This commit is contained in:
parent
89464a2cd1
commit
64d2b21cc0
@ -13,7 +13,7 @@ export const WorkoutCardHome: React.FC<WorkoutCardProps> = ({ onBackClick, onCar
|
||||
return (
|
||||
<div
|
||||
onClick={onCardClick}
|
||||
className="bg-gradient-to-r from-[#2BACBE] to-[#1E7F8C] rounded-3xl p-6 shadow-2xl text-white max-w-4xl mx-auto my-8 transition-transform transform hover:scale-105 duration-300 cursor-pointer"
|
||||
className="bg-gradient-to-r from-[#2BACBE] to-[#1E7F8C] rounded-3xl p-6 shadow-2xl text-white max-w-4xl mx-auto my-5 transition-transform transform hover:scale-105 duration-300 cursor-pointer"
|
||||
>
|
||||
{/* Заголовок и статус */}
|
||||
<div className="flex items-center justify-between flex-wrap mb-6 border-b-2 pb-4">
|
||||
@ -37,7 +37,7 @@ export const WorkoutCardHome: React.FC<WorkoutCardProps> = ({ onBackClick, onCar
|
||||
</div>
|
||||
|
||||
{/* Основной блок с иконками и прогрессом */}
|
||||
<div className="flex items-start flex-wrap space-x-4 mb-6">
|
||||
<div className="flex items-start flex-wrap space-x-4 mb-1">
|
||||
{/* Иконка часов */}
|
||||
<div className="relative flex-shrink-0 mr-6">
|
||||
<div className="w-20 h-20 bg-white/70 rounded-2xl flex items-center justify-center shadow-xl transition-transform hover:scale-105 duration-300">
|
||||
|
@ -38,6 +38,7 @@ export const CourseExercises = () => {
|
||||
const location = useLocation<{ course?: Course }>();
|
||||
const course = location.state?.course;
|
||||
|
||||
|
||||
const [course_exercises, setExercises] = useState<CourseExercises[]>([]);
|
||||
const [selectedDay, setSelectedDay] = useState<number | null>(null);
|
||||
|
||||
|
@ -9,11 +9,14 @@ import HeaderNav from "../components/HeaderNav";
|
||||
import { connect } from '../confconnect';
|
||||
import { getRouteCourseExercises } from '../shared/consts/router';
|
||||
|
||||
import type { CourseExercises } from './CourseExercises';
|
||||
|
||||
export interface Course {
|
||||
ID: number;
|
||||
title: string;
|
||||
desc: string;
|
||||
url_file_img: string;
|
||||
course_exercises: CourseExercises;
|
||||
}
|
||||
|
||||
|
||||
@ -54,6 +57,8 @@ export const Courses = () => {
|
||||
const [error, setError] = useState<string>('');
|
||||
const token = localStorage.getItem('authToken');
|
||||
|
||||
const [course_exercises, setExercises] = useState<CourseExercises[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log(token)
|
||||
if (!token) {
|
||||
@ -67,7 +72,8 @@ export const Courses = () => {
|
||||
},
|
||||
})
|
||||
.then(response => {
|
||||
console.log('Response status:', response.status);
|
||||
console.log('Response status:', response.data);
|
||||
setExercises(response.data.courses.course_exercises);
|
||||
|
||||
// Предполагаемая структура:
|
||||
// response.data.courses — массив пользователей
|
||||
@ -125,6 +131,7 @@ export const Courses = () => {
|
||||
<HeaderNav item='Курсы' text='все назначенные' />
|
||||
<AnalitcsCards />
|
||||
|
||||
|
||||
<div className="px-6 mb-8">
|
||||
{error && (
|
||||
<div className="bg-red-50 border border-red-200 rounded-lg p-4 mb-6">
|
||||
@ -185,7 +192,7 @@ export const Courses = () => {
|
||||
{/* Информация о прогрессе */}
|
||||
<div className="flex flex-col md:flex-row md:justify-between content-center">
|
||||
<p className="text-sm text-[#5F5C5C]/70 font-semibold">{progress}% завершено</p>
|
||||
<p className="text-xs text-[#5F5C5C]/50">{Math.floor(Math.random() * 15) + 5} упражнений</p>
|
||||
<p className="text-xs text-[#5F5C5C]/50">{course_exercises} упражнений</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -84,29 +84,25 @@ export default function Home() {
|
||||
return (
|
||||
<div className="bg-gray-50 w-full h-full overflow-auto">
|
||||
<div className="my-36 min-h-screen max-w-4xl mx-auto">
|
||||
<HeaderNav item="Результаты" text="главная" />
|
||||
<HeaderNav item="Прогресс" text={currentDate} />
|
||||
|
||||
<div className="bg-white rounded-3xl p-6 shadow-lg mx-4 sm:mx-6">
|
||||
<div className="flex content-center items-center justify-between ">
|
||||
|
||||
|
||||
<div className="bg-white rounded-3xl p-6 shadow-lg mb-6 mx-4 sm:mx-6">
|
||||
<div className="flex items-center justify-between mb-6 border-b-2 border-gray-400 pb-4">
|
||||
<div>
|
||||
<h1 className="text-xl font-bold text-gray-600 mb-2">Добрый день!</h1>
|
||||
</div>
|
||||
<div className="text-right">
|
||||
<p className="text-gray-600 font-medium text-sm sm:text-base">{currentDate}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex justify-between items-center">
|
||||
<div className="flex flex-col gap-6">
|
||||
<div className="text-left">
|
||||
<div className="text-base text-gray-800">Все курсы</div>
|
||||
<div className="text-sm sm:text-base text-gray-800">Все курсы</div>
|
||||
<div className="text-2xl font-bold text-cyan-500">{totalCourses}/1</div>
|
||||
</div>
|
||||
<div className="text-left">
|
||||
<div className="text-base text-gray-800">Все упражнения</div>
|
||||
<div className="text-sm sm:text-base text-gray-800">Все упражнения</div>
|
||||
<div className="text-2xl font-bold text-orange-400">{totalExercises}/4</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex justify-center items-center gap-8 mt-8">
|
||||
<div className="flex justify-center items-center gap-8">
|
||||
<CircularProgressDisplay
|
||||
overallProgress={overallProgress}
|
||||
totalCourses={totalCourses}
|
||||
@ -121,17 +117,17 @@ export default function Home() {
|
||||
<WorkoutCardHome onBackClick={handleBackClick} onCardClick={handleWorkoutClick} />
|
||||
|
||||
{/* Quick Stats (Total Exercises & Total Courses) */}
|
||||
<div className="grid grid-cols-2 gap-4 md:gap-10">
|
||||
<div className="grid grid-cols-2 gap-4 md:gap-5">
|
||||
<StatCardHome
|
||||
title="Курсы"
|
||||
subtitle="все назначенные"
|
||||
subtitle="назначенные"
|
||||
icon={CalendarIcon}
|
||||
fill="#2BACBE"
|
||||
onClick={handleCoursesClick}
|
||||
/>
|
||||
<StatCardHome
|
||||
title="Упражнения"
|
||||
subtitle="внутри текущего курса"
|
||||
subtitle="текущего курса"
|
||||
icon={DumbbellIcon}
|
||||
fill="#FF8D28"
|
||||
onClick={handleExercisesClick}
|
||||
|
Loading…
x
Reference in New Issue
Block a user