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:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "play-life-web",
|
||||
"version": "4.20.1",
|
||||
"version": "4.20.2",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user