diff --git a/VERSION b/VERSION index 2c9b9c3..f7e4d90 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.20.1 +4.20.2 diff --git a/play-life-backend/main.go b/play-life-backend/main.go index c20eee9..3a86311 100644 --- a/play-life-backend/main.go +++ b/play-life-backend/main.go @@ -10247,6 +10247,10 @@ func (a *App) getWishlistItemsWithConditions(userID int, includeCompleted bool) if taskName.Valid { condition.TaskName = &taskName.String } + if taskID.Valid { + taskIDVal := int(taskID.Int64) + condition.TaskID = &taskIDVal + } } else if scoreConditionID.Valid { condition.Type = "project_points" if projectName.Valid { @@ -11217,6 +11221,8 @@ func (a *App) getWishlistItemHandler(w http.ResponseWriter, r *http.Request) { condition.TaskName = &taskName.String } if taskID.Valid { + taskIDVal := int(taskID.Int64) + condition.TaskID = &taskIDVal var taskCompleted int err := a.DB.QueryRow(`SELECT completed FROM tasks WHERE id = $1 AND user_id = $2 AND deleted = FALSE`, taskID.Int64, conditionOwnerID).Scan(&taskCompleted) if err == nil { @@ -11594,6 +11600,8 @@ func (a *App) updateWishlistHandler(w http.ResponseWriter, r *http.Request) { condition.TaskName = &taskName.String } if taskID.Valid { + taskIDVal := int(taskID.Int64) + condition.TaskID = &taskIDVal var taskCompleted int err := a.DB.QueryRow(`SELECT completed FROM tasks WHERE id = $1 AND user_id = $2 AND deleted = FALSE`, taskID.Int64, conditionOwnerID).Scan(&taskCompleted) if err == nil { @@ -13654,6 +13662,8 @@ func (a *App) getWishlistItemsByBoard(boardID int, userID int) ([]WishlistItem, } // Проверяем выполнена ли задача для владельца условия if taskID.Valid { + taskIDVal := int(taskID.Int64) + condition.TaskID = &taskIDVal var taskCompleted int err := a.DB.QueryRow(`SELECT completed FROM tasks WHERE id = $1 AND user_id = $2 AND deleted = FALSE`, taskID.Int64, conditionOwnerID).Scan(&taskCompleted) if err == nil { diff --git a/play-life-web/package.json b/play-life-web/package.json index 2582cec..3af9f0f 100644 --- a/play-life-web/package.json +++ b/play-life-web/package.json @@ -1,6 +1,6 @@ { "name": "play-life-web", - "version": "4.20.1", + "version": "4.20.2", "type": "module", "scripts": { "dev": "vite", diff --git a/play-life-web/src/components/WishlistDetail.css b/play-life-web/src/components/WishlistDetail.css index 51e1367..d78711d 100644 --- a/play-life-web/src/components/WishlistDetail.css +++ b/play-life-web/src/components/WishlistDetail.css @@ -165,6 +165,15 @@ color: #888; } +.wishlist-detail-condition.clickable { + transition: background-color 0.2s, transform 0.1s; +} + +.wishlist-detail-condition.clickable:hover { + background-color: rgba(0, 0, 0, 0.05); + transform: translateX(2px); +} + .condition-header { display: flex; align-items: center; diff --git a/play-life-web/src/components/WishlistDetail.jsx b/play-life-web/src/components/WishlistDetail.jsx index 0d06e98..269ca36 100644 --- a/play-life-web/src/components/WishlistDetail.jsx +++ b/play-life-web/src/components/WishlistDetail.jsx @@ -157,6 +157,41 @@ function WishlistDetail({ wishlistId, onNavigate, onRefresh, boardId, onClose, p } } + const handleConditionTaskClick = async (condition) => { + if (condition.type !== 'task_completion' || !condition.task_id) { + return + } + + try { + // Загружаем информацию о задаче + const response = await authFetch(`/api/tasks/${condition.task_id}`) + if (!response.ok) { + throw new Error('Ошибка при загрузке задачи') + } + const taskDetail = await response.json() + + // Проверяем, является ли задача тестом + const isTest = taskDetail.task?.config_id != null + + if (isTest) { + // Для задач-тестов открываем экран прохождения теста + if (taskDetail.task.config_id) { + onNavigate?.('test', { + configId: taskDetail.task.config_id, + taskId: taskDetail.task.id, + maxCards: taskDetail.max_cards + }) + } + } else { + // Для обычных задач открываем модальное окно выполнения + setSelectedTaskForDetail(condition.task_id) + } + } catch (err) { + console.error('Failed to load task details:', err) + setToastMessage({ text: 'Ошибка при загрузке задачи', type: 'error' }) + } + } + const handleCloseDetail = () => { setSelectedTaskForDetail(null) } @@ -367,7 +402,9 @@ function WishlistDetail({ wishlistId, onNavigate, onRefresh, boardId, onClose, p return (