4.20.2: Клик по целям-задачам в желаниях
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m42s

This commit is contained in:
poignatov
2026-02-05 12:10:32 +03:00
parent 106defc3af
commit 736f08887a
5 changed files with 59 additions and 3 deletions

View File

@@ -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;

View File

@@ -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 (
<div
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">
<svg className="condition-icon" width="16" height="16" viewBox="0 0 24 24" fill="currentColor">