|
@ -11,8 +11,6 @@ |
|
|
export let groups: ProjectGroupResult[] = []; |
|
|
export let groups: ProjectGroupResult[] = []; |
|
|
export let selected: string; |
|
|
export let selected: string; |
|
|
|
|
|
|
|
|
let failedCount = 0; |
|
|
|
|
|
|
|
|
|
|
|
function onClickAdd() { |
|
|
function onClickAdd() { |
|
|
modalStore.set({name: "projectgroup.add"}); |
|
|
modalStore.set({name: "projectgroup.add"}); |
|
|
} |
|
|
} |
|
@ -21,12 +19,17 @@ |
|
|
if (group.projects.length === 0) { |
|
|
if (group.projects.length === 0) { |
|
|
navigate(`/questlog/${group.id}`); |
|
|
navigate(`/questlog/${group.id}`); |
|
|
} else { |
|
|
} 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 |
|
|
// There's some weirdness with navigate. This hack will just do a |
|
|
// groups = [...groups] in the sttore to get the page to update. |
|
|
// 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(() => { |
|
|
tick().then(() => { |
|
|
projectGroupStore.fakeRefresh(); |
|
|
projectGroupStore.fakeRefresh(); |
|
|
}) |
|
|
}) |
|
|