4.20.2: Клик по целям-задачам в желаниях
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m42s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m42s
This commit is contained in:
@@ -10247,6 +10247,10 @@ func (a *App) getWishlistItemsWithConditions(userID int, includeCompleted bool)
|
|||||||
if taskName.Valid {
|
if taskName.Valid {
|
||||||
condition.TaskName = &taskName.String
|
condition.TaskName = &taskName.String
|
||||||
}
|
}
|
||||||
|
if taskID.Valid {
|
||||||
|
taskIDVal := int(taskID.Int64)
|
||||||
|
condition.TaskID = &taskIDVal
|
||||||
|
}
|
||||||
} else if scoreConditionID.Valid {
|
} else if scoreConditionID.Valid {
|
||||||
condition.Type = "project_points"
|
condition.Type = "project_points"
|
||||||
if projectName.Valid {
|
if projectName.Valid {
|
||||||
@@ -11217,6 +11221,8 @@ func (a *App) getWishlistItemHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
condition.TaskName = &taskName.String
|
condition.TaskName = &taskName.String
|
||||||
}
|
}
|
||||||
if taskID.Valid {
|
if taskID.Valid {
|
||||||
|
taskIDVal := int(taskID.Int64)
|
||||||
|
condition.TaskID = &taskIDVal
|
||||||
var taskCompleted int
|
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)
|
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 {
|
if err == nil {
|
||||||
@@ -11594,6 +11600,8 @@ func (a *App) updateWishlistHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
condition.TaskName = &taskName.String
|
condition.TaskName = &taskName.String
|
||||||
}
|
}
|
||||||
if taskID.Valid {
|
if taskID.Valid {
|
||||||
|
taskIDVal := int(taskID.Int64)
|
||||||
|
condition.TaskID = &taskIDVal
|
||||||
var taskCompleted int
|
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)
|
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 {
|
if err == nil {
|
||||||
@@ -13654,6 +13662,8 @@ func (a *App) getWishlistItemsByBoard(boardID int, userID int) ([]WishlistItem,
|
|||||||
}
|
}
|
||||||
// Проверяем выполнена ли задача для владельца условия
|
// Проверяем выполнена ли задача для владельца условия
|
||||||
if taskID.Valid {
|
if taskID.Valid {
|
||||||
|
taskIDVal := int(taskID.Int64)
|
||||||
|
condition.TaskID = &taskIDVal
|
||||||
var taskCompleted int
|
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)
|
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 {
|
if err == nil {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "play-life-web",
|
"name": "play-life-web",
|
||||||
"version": "4.20.1",
|
"version": "4.20.2",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@@ -165,6 +165,15 @@
|
|||||||
color: #888;
|
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 {
|
.condition-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -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 = () => {
|
const handleCloseDetail = () => {
|
||||||
setSelectedTaskForDetail(null)
|
setSelectedTaskForDetail(null)
|
||||||
}
|
}
|
||||||
@@ -367,7 +402,9 @@ function WishlistDetail({ wishlistId, onNavigate, onRefresh, boardId, onClose, p
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={index}
|
key={index}
|
||||||
className={`wishlist-detail-condition ${isMet ? 'met' : 'not-met'}`}
|
className={`wishlist-detail-condition ${isMet ? 'met' : 'not-met'} ${condition.type === 'task_completion' && condition.task_id ? 'clickable' : ''}`}
|
||||||
|
onClick={condition.type === 'task_completion' && condition.task_id ? () => handleConditionTaskClick(condition) : undefined}
|
||||||
|
style={condition.type === 'task_completion' && condition.task_id ? { cursor: 'pointer' } : {}}
|
||||||
>
|
>
|
||||||
<div className="condition-header">
|
<div className="condition-header">
|
||||||
<svg className="condition-icon" width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
|
<svg className="condition-icon" width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
|
||||||
|
|||||||
Reference in New Issue
Block a user