add recalling of last project when navigating out from and into quest log.
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
<script lang="ts" context="module">
|
||||
let lastQuest = "";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import type { ProjectResult } from "../models/project";
|
||||
import selectionStore from "../stores/selection";
|
||||
@@ -26,12 +30,25 @@
|
||||
|
||||
$: {
|
||||
if (project === null && projects.length > 0) {
|
||||
project = expiringProjects[0] || activeProjects[0] || completedProjects[0] || null;
|
||||
if (lastQuest !== "") {
|
||||
project = projects.find(p => p.id === lastQuest) || null;
|
||||
}
|
||||
|
||||
if (project === null) {
|
||||
project = expiringProjects[0] || activeProjects[0] || completedProjects[0] || null;
|
||||
}
|
||||
|
||||
if (project !== null) {
|
||||
selectionStore.change("hash", project.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$: {
|
||||
if ($selectionStore.hash.startsWith("P")) {
|
||||
lastQuest = $selectionStore.hash;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="quest-log">
|
||||
|
||||
Reference in New Issue
Block a user