Enhance task navigation and progress tracking across components. Update TaskWorkspace to improve task completion handling and button interactions. Refactor ChainsPage to select the furthest accessible task based on user progress. Implement storage functions for managing furthest task indices, ensuring users can only navigate to available tasks. Update TaskPage to check task accessibility and redirect users appropriately, improving overall user experience.
Some checks failed
platform/bro-js/challenge-pl/pipeline/head There was a failure building this commit

This commit is contained in:
2025-12-14 14:06:18 +03:00
parent c9bbe83bbb
commit 1a52901b90
4 changed files with 135 additions and 28 deletions

View File

@@ -26,10 +26,20 @@ export const ChainsPage = () => {
const handleSelectChain = (chain: ChallengeChain) => {
storage.setSelectedChainId(chain.id)
// Переходим к первому заданию цепочки
if (chain.tasks.length > 0) {
storage.setSelectedTaskId(chain.tasks[0].id)
navigate(URLs.task(chain.id, chain.tasks[0].id))
// Получаем самый дальний достигнутый индекс
const furthestIndex = storage.getFurthestTaskIndex(chain.id)
// Если нет прогресса, инициализируем с первого задания
const targetIndex = furthestIndex >= 0 ? furthestIndex : 0
const targetTask = chain.tasks[targetIndex] || chain.tasks[0]
storage.setSelectedTaskId(targetTask.id)
// Убеждаемся, что прогресс установлен
storage.setFurthestTaskIndex(chain.id, targetIndex)
navigate(URLs.task(chain.id, targetTask.id))
}
}