add front page logs.

This commit is contained in:
2021-04-03 12:08:56 +02:00
parent 274923a496
commit 7cf808c13c
4 changed files with 63 additions and 3 deletions
+23
View File
@@ -1,12 +1,17 @@
<script lang="ts">
import EmptyList from "../components/EmptyList.svelte";
import EmptyParentEntry from "../components/EmptyParentEntry.svelte";
import GoalEntry from "../components/GoalEntry.svelte";
import LogEntry from "../components/LogEntry.svelte";
import ParentEntry from "../components/ParentEntry.svelte";
import ProjectEntry from "../components/ProjectEntry.svelte";
import RefreshSelection from "../components/RefreshSelection.svelte";
import type { ProjectResult } from "../models/project";
import { fpGoalStore } from "../stores/goal";
import { fpLogStore } from "../stores/logs";
import { fpProjectStore, fpProjectStore2 } from "../stores/project";
import { fpTaskStore } from "../stores/tasks";
import { endOfDay, startOfDay } from "../utils/time";
let fakeMap: {[projectId: string]: boolean} = {}
let fakeProjects: ProjectResult[]
@@ -47,6 +52,16 @@
}
}
$: {
if ($fpLogStore.stale && !$fpLogStore.loading) {
fpLogStore.load({
maxTime: endOfDay(new Date()),
minTime: startOfDay(new Date()),
})
}
}
$: {
const individualTasks = $fpTaskStore.tasks
.filter(t => $fpProjectStore.projects.find(p => p.id === t.projectId) == null)
@@ -94,6 +109,14 @@
{#if !$fpGoalStore.loading && $fpGoalStore.goals.length === 0}
<EmptyList icon="list" text="No goals." />
{/if}
{#if $fpLogStore.logs.length > 0}
<h1>Today's Logs</h1>
<EmptyParentEntry icon="list">
{#each $fpLogStore.logs as log (log.id)}
<LogEntry log={log} />
{/each}
</EmptyParentEntry>
{/if}
</div>
<div class="right">
{#if $fpProjectStore.projects.length > 0}