Fix clearing 3-stage achievements

This commit is contained in:
Brian Lai 2021-07-27 19:27:34 -07:00
parent 0ec40e02eb
commit f4a26fa541
2 changed files with 9 additions and 1 deletions

View file

@ -6,7 +6,7 @@
</script>
<label
class="checkbox-wrapper flex flex-1 pl-4 items-center rounded-2xl h-14 cursor-pointer {inverted
class="checkbox-wrapper flex flex-1 pl-4 items-center rounded-2xl h-14 {disabled ? 'cursor-not-allowed' : 'cursor-pointer'} {inverted
? 'bg-item'
: 'bg-background'} {className}"
style="--bg: {inverted ? '#202442' : '#2D325A'};"

View file

@ -147,6 +147,13 @@
val = !list[index][subindex].checked;
list[index][subindex].checked = val;
checkList[active][list[index][subindex].id] = val;
// If unchecked, recursively uncheck subsequent achievements
if (subindex < list[index].length - 1 &&
!list[index][subindex].checked &&
list[index][subindex + 1].checked) {
toggle({ index, subindex: subindex + 1, primogem: list[index][subindex + 1].reward});
}
} else {
val = !list[index].checked;
list[index].checked = val;
@ -284,6 +291,7 @@
checked={list[index][i].checked}
on:change={() => toggle({ index, subindex: i, primogem: it.reward })}
inverted
disabled={i > 0 && !el[i - 1].checked}
/>
</div>
</div>