add project groups to frontend.
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-07-18 22:11:16 +02:00
parent ea01af1091
commit 83eb9862fc
29 changed files with 524 additions and 64 deletions
+1 -1
View File
@@ -7,7 +7,7 @@
import type { ModalData } from "../stores/modal";
import projectStore from "../stores/project";
const mdProjectAdd: ModalData = {name: "project.add"};
const mdProjectAdd: ModalData = {name: "project.add", groupId: null};
let showInactive = ($projectStore.filter.active === null);
$: {
+32 -4
View File
@@ -1,17 +1,45 @@
<script lang="ts">
import { tick } from "svelte";
import { navigate } from "svelte-routing";
import QuestLog from "../components/QuestLog.svelte";
import RefreshSelection from "../components/RefreshSelection.svelte";
import projectStore from "../stores/project";
import projectGroupStore from "../stores/projectGroup";
import { sortProjects } from "../utils/sorters";
export let groupId = "";
export let projectId = "";
$: {
if ($projectStore.stale && !$projectStore.loading) {
projectStore.load({});
if ($projectGroupStore.stale && !$projectGroupStore.loading) {
projectGroupStore.load();
}
}
$: {
if ($projectGroupStore.groups.length > 0 && groupId === "") {
const group = $projectGroupStore.groups[0];
if (group.projects.length > 0) {
const projects = [...group.projects].sort(sortProjects);
navigate(`/questlog/${group.id}/${projects[0].id}`, {replace: true});
// There's some weirdness with navigate. This hack will just do a
// groups = [...groups] in the sttore to get the page to update.
tick().then(() => {
projectGroupStore.fakeRefresh();
})
} else {
navigate(`/questlog/${group.id}`);
}
}
}
</script>
<div class="page">
<QuestLog projects={$projectStore.projects} />
<QuestLog groups={$projectGroupStore.groups} groupId={groupId} projectId={projectId} />
</div>
<RefreshSelection />