diff --git a/frontend/src/index.css b/frontend/src/index.css index edff504..68a32bb 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -437,4 +437,69 @@ body { background-color: #f0f0f0; color: var(--color-text-muted); text-decoration: line-through; +} + +.file-upload-wrapper { + position: relative; + display: flex; + align-items: center; + gap: 12px; + flex-wrap: wrap; +} + +.file-upload-button { + display: inline-flex; + align-items: center; + gap: 8px; + padding: 10px 18px; + background: var(--color-bg-secondary); + border: 1px dashed var(--color-border); + border-radius: 12px; + color: var(--color-text); + font-size: 14px; + font-weight: 500; + cursor: pointer; + transition: all 0.2s ease; +} + +.file-upload-button:hover { + border-color: var(--color-primary); + background: rgba(99, 102, 241, 0.08); + transform: translateY(-1px); +} + +.file-upload-button .icon { + font-size: 18px; +} + +.file-upload-input { + position: absolute; + opacity: 0; + width: 0; + height: 0; +} + +.file-selected-name { + font-size: 13px; + color: var(--color-text-muted); + max-width: 220px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + padding: 4px 0; +} + +.course-card-wrapper { + position: relative; + height: 100%; +} + +.course-card-wrapper .course-card { + width: 100%; + height: 100%; +} + +.course-card-wrapper button:hover { + background: rgba(99, 102, 241, 0.15) !important; + transform: scale(1.05); } \ No newline at end of file diff --git a/frontend/src/pages/CourseDetails.tsx b/frontend/src/pages/CourseDetails.tsx index cc7e34a..065d869 100644 --- a/frontend/src/pages/CourseDetails.tsx +++ b/frontend/src/pages/CourseDetails.tsx @@ -68,7 +68,7 @@ export default function CourseDetails() { .from('tasks') .select('*') .eq('course_id', id) - .order('created_at', { ascending: false }); + .order('deadline', { ascending: true, nullsFirst: false }); if (error) { console.error('Ошибка загрузки задач:', error); @@ -528,15 +528,27 @@ export default function CourseDetails() { }} /> - { - const file = e.target.files?.[0] || null; - setSelectedAttachmentFile(file); - }} - disabled={isAddingAttachment} - /> +
+ + {selectedAttachmentFile && ( + + {selectedAttachmentFile.name} + + )} +
{selectedAttachmentFile && (
diff --git a/frontend/src/pages/CoursesPage.tsx b/frontend/src/pages/CoursesPage.tsx index fd86063..ef3368e 100644 --- a/frontend/src/pages/CoursesPage.tsx +++ b/frontend/src/pages/CoursesPage.tsx @@ -7,6 +7,7 @@ interface Course { name: string; description: string | null; user_id: string; + is_complited: boolean; } export default function CoursesPage() { @@ -231,6 +232,23 @@ export default function CoursesPage() { setIsCreatingCourse(false); }; + const toggleCourseCompletion = async (courseId: string, currentStatus: boolean) => { + const { error } = await supabase + .from('courses') + .update({ is_complited: !currentStatus }) + .eq('id', courseId); + + if (error) { + setErrorMessage('Ошибка обновления курса: ' + error.message); + } else { + setCourses(courses.map(course => + course.id === courseId + ? { ...course, is_complited: !currentStatus } + : course + )); + } + }; + if (loading) { return (
@@ -337,15 +355,27 @@ export default function CoursesPage() { />
- { - const file = e.target.files?.[0] || null; - setSelectedFile(file); - }} - disabled={isCreatingCourse} - /> +
+ + {selectedFile && ( + + {selectedFile.name} + + )} +
{selectedFile && (
@@ -393,36 +423,71 @@ export default function CoursesPage() {
) : ( courses.map((course) => ( - -
-

- {course.name} -

- -

+ +

+
+

+ {course.name} +

+ {course.is_complited && ( + + )} +
+

+ {course.description?.trim() || 'Описание курса пока не добавлено.'} +

+
+
- {course.description?.trim() - ? course.description - : 'Описание курса пока не добавлено.'} -

-
- -
+ + +
- + {course.is_complited ? '✅' : '✔️'} + +
)) )}
diff --git a/frontend/src/pages/TaskDetails.tsx b/frontend/src/pages/TaskDetails.tsx index 29d6072..9d46008 100644 --- a/frontend/src/pages/TaskDetails.tsx +++ b/frontend/src/pages/TaskDetails.tsx @@ -658,15 +658,27 @@ export default function TaskDetails() { }} /> - { - const file = e.target.files?.[0] || null; - setSelectedAttachmentFile(file); - }} - disabled={isAddingAttachment} - /> +
+ + {selectedAttachmentFile && ( + + {selectedAttachmentFile.name} + + )} +
{selectedAttachmentFile && (
@@ -676,7 +688,7 @@ export default function TaskDetails() {