Skip to content

Commit

Permalink
[Fix] Don't display next arrow if hint is unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastienTainon committed Jul 31, 2023
1 parent 1245756 commit 2a919ae
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions frontend/task/hints/TaskHints.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function TaskHints(props: TaskHintProps) {
const displayedHintIndex = null === displayedHintId ? unlockedHintIds.length : unlockedHintIds.indexOf(displayedHintId);
const displayedHint = availableHints.find(hint => displayedHintId === hint.id);
const nextAvailableHint = availableHints.find(hint => -1 === unlockedHintIds.indexOf(hint.id));
const canAskMoreHints = undefined !== nextAvailableHint && !displayedHint?.question && !displayedHint?.disableNext;
let canAskMoreHints = undefined !== nextAvailableHint && !displayedHint?.question && !displayedHint?.disableNext;

const dispatch = useDispatch();

Expand All @@ -42,7 +42,11 @@ export function TaskHints(props: TaskHintProps) {
if (displayedHint) {
if (!displayedHint.disableNext && !displayedHint.question) {
if (displayedHint.nextHintId) {
currentHintNextId = displayedHint.nextHintId;
if (availableHints.find(hint => displayedHint.nextHintId === hint.id)) {
currentHintNextId = displayedHint.nextHintId;
} else {
canAskMoreHints = false;
}
}
}

Expand Down

0 comments on commit 2a919ae

Please sign in to comment.