diff --git a/svelte-ui/src/components/ProjectGroupMenu.svelte b/svelte-ui/src/components/ProjectGroupMenu.svelte index a9ef543..a5fd3f0 100644 --- a/svelte-ui/src/components/ProjectGroupMenu.svelte +++ b/svelte-ui/src/components/ProjectGroupMenu.svelte @@ -11,8 +11,6 @@ export let groups: ProjectGroupResult[] = []; export let selected: string; - let failedCount = 0; - function onClickAdd() { modalStore.set({name: "projectgroup.add"}); } @@ -21,12 +19,17 @@ if (group.projects.length === 0) { navigate(`/questlog/${group.id}`); } else { - const projetcs = [...group.projects].sort(sortProjects); + const preferredId = localStorage.getItem(`sl2.projectgroup.${group.id}.last_project_id`); + + const projects = [...group.projects].sort(sortProjects); + const project = projects.find(p => p.id === preferredId) || projects[0]; - navigate(`/questlog/${group.id}/${projetcs[0].id}`); + navigate(`/questlog/${group.id}/${project.id}`); // There's some weirdness with navigate. This hack will just do a // groups = [...groups] in the sttore to get the page to update. + // + // Edit: It doesn't seem to be needed anymore? Idk why, but I'll keep this in just in case. tick().then(() => { projectGroupStore.fakeRefresh(); }) diff --git a/svelte-ui/src/pages/QLPage.svelte b/svelte-ui/src/pages/QLPage.svelte index 4940e0a..6be3341 100644 --- a/svelte-ui/src/pages/QLPage.svelte +++ b/svelte-ui/src/pages/QLPage.svelte @@ -25,8 +25,8 @@ } $: { - const lastGroupId = localStorage.getItem("stufflog3.questlog.last_group_id") || ""; - const lastProjectId = localStorage.getItem("stufflog3.questlog.last_project_id") || ""; + const lastGroupId = localStorage.getItem("sl2.questlogpage.last_group_id") || ""; + const lastProjectId = localStorage.getItem("sl2.questlogpage.last_project_id") || ""; if ($projectGroupStore.groups.length > 0) { // Try to restore last selection @@ -60,8 +60,9 @@ navigate(`/questlog/${group.id}`); } } else { - localStorage.setItem("stufflog3.questlog.last_group_id", groupId); - localStorage.setItem("stufflog3.questlog.last_project_id", projectId); + localStorage.setItem("sl2.questlogpage.last_group_id", groupId); + localStorage.setItem("sl2.questlogpage.last_project_id", projectId); + localStorage.setItem(`sl2.projectgroup.${groupId}.last_project_id`, projectId); } } }