Исправление создания желаний на досках
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m27s
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m27s
This commit is contained in:
@@ -653,7 +653,9 @@ function AppContent() {
|
||||
// Для task-form и wishlist-form явно удаляем параметры, только если нет никаких параметров
|
||||
// task-form может иметь taskId (редактирование), wishlistId (создание из желания), или returnTo (возврат после создания)
|
||||
const isTaskFormWithNoParams = tab === 'task-form' && params.taskId === undefined && params.wishlistId === undefined && params.returnTo === undefined
|
||||
const isWishlistFormWithNoParams = tab === 'wishlist-form' && params.wishlistId === undefined && params.newTaskId === undefined && params.boardId === undefined
|
||||
// Проверяем, что boardId не null и не undefined (null означает "нет доски", но это валидное значение)
|
||||
const hasBoardId = params.boardId !== null && params.boardId !== undefined
|
||||
const isWishlistFormWithNoParams = tab === 'wishlist-form' && params.wishlistId === undefined && params.newTaskId === undefined && !hasBoardId
|
||||
if (isTaskFormWithNoParams || isWishlistFormWithNoParams) {
|
||||
setTabParams({})
|
||||
if (isNewTabMain) {
|
||||
@@ -1041,7 +1043,22 @@ function AppContent() {
|
||||
{/* Кнопка добавления желания (только для таба wishlist) */}
|
||||
{!isFullscreenTab && activeTab === 'wishlist' && (
|
||||
<button
|
||||
onClick={() => handleNavigate('wishlist-form', { wishlistId: undefined })}
|
||||
onClick={() => {
|
||||
// Получаем boardId из tabParams или из localStorage (где его сохраняет компонент Wishlist)
|
||||
let boardId = tabParams.boardId
|
||||
if (!boardId) {
|
||||
try {
|
||||
const saved = localStorage.getItem('wishlist_selected_board_id')
|
||||
if (saved) {
|
||||
const parsed = parseInt(saved, 10)
|
||||
if (!isNaN(parsed)) boardId = parsed
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Error loading boardId from localStorage:', err)
|
||||
}
|
||||
}
|
||||
handleNavigate('wishlist-form', { wishlistId: undefined, boardId: boardId })
|
||||
}}
|
||||
className="fixed bottom-16 right-4 z-20 bg-gradient-to-r from-indigo-600 to-purple-600 hover:from-indigo-700 hover:to-purple-700 text-white w-[61px] h-[61px] rounded-2xl shadow-lg transition-all duration-200 hover:scale-105 flex items-center justify-center"
|
||||
title="Добавить желание"
|
||||
>
|
||||
|
||||
@@ -399,7 +399,10 @@ function Wishlist({ onNavigate, refreshTrigger = 0, isActive = false, initialBoa
|
||||
}
|
||||
|
||||
const handleAddClick = () => {
|
||||
onNavigate?.('wishlist-form', { wishlistId: undefined, boardId: selectedBoardId })
|
||||
// Если selectedBoardId равен null, но есть доски, используем первую доску
|
||||
// Если доски еще не загружены, используем initialBoardId
|
||||
const boardIdToUse = selectedBoardId || (boards.length > 0 ? boards[0].id : initialBoardId)
|
||||
onNavigate?.('wishlist-form', { wishlistId: undefined, boardId: boardIdToUse })
|
||||
}
|
||||
|
||||
const handleItemClick = (item) => {
|
||||
|
||||
@@ -851,17 +851,16 @@ function WishlistForm({ onNavigate, wishlistId, editConditionIndex, newTaskId, b
|
||||
/>
|
||||
)}
|
||||
|
||||
{toastMessage && (
|
||||
<Toast
|
||||
message={toastMessage.text}
|
||||
type={toastMessage.type}
|
||||
onClose={() => setToastMessage(null)}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
)}
|
||||
</div>
|
||||
{toastMessage && (
|
||||
<Toast
|
||||
message={toastMessage.text}
|
||||
type={toastMessage.type}
|
||||
onClose={() => setToastMessage(null)}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user