add front page logs.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<script lang="ts">
|
||||
import type { IconName } from "../external/icons";
|
||||
import ParentEntry from "./ParentEntry.svelte";
|
||||
|
||||
export let name = "";
|
||||
export let description = "";
|
||||
export let headerLink = "";
|
||||
export let hideIcon: boolean = false;
|
||||
export let icon: IconName = "anchor";
|
||||
|
||||
let entry;
|
||||
|
||||
$: {
|
||||
entry = {
|
||||
id: "__empty",
|
||||
name: name,
|
||||
description: description,
|
||||
icon: icon,
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
<ParentEntry
|
||||
entry={entry}
|
||||
full={false}
|
||||
headerLink={headerLink}
|
||||
hideProgress={true}
|
||||
hideIcon={hideIcon}
|
||||
showTimeProgress={true}
|
||||
annotations={[]}
|
||||
removeHook={true}
|
||||
>
|
||||
<slot></slot>
|
||||
</ParentEntry>
|
||||
@@ -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}
|
||||
|
||||
@@ -9,7 +9,7 @@ interface ProjectStoreData {
|
||||
filter: LogFilter
|
||||
}
|
||||
|
||||
function createProjectStore() {
|
||||
function createLogStore() {
|
||||
const {update, subscribe} = writable<ProjectStoreData>({
|
||||
loading: false,
|
||||
stale: true,
|
||||
@@ -52,6 +52,8 @@ function createProjectStore() {
|
||||
}
|
||||
}
|
||||
|
||||
const logStore = createProjectStore();
|
||||
const logStore = createLogStore();
|
||||
|
||||
export const fpLogStore = createLogStore();
|
||||
|
||||
export default logStore;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import goalStore, { fpGoalStore } from "./goal";
|
||||
import groupStore from "./group";
|
||||
import logStore from "./logs";
|
||||
import logStore, { fpLogStore } from "./logs";
|
||||
import projectStore, { fpProjectStore, fpProjectStore2 } from "./project";
|
||||
import taskStore, { fpTaskStore } from "./tasks";
|
||||
|
||||
@@ -30,5 +30,6 @@ export default function markStale(...models: ModelName[]) {
|
||||
}
|
||||
if (markAll || models.includes("log")) {
|
||||
logStore.markStale();
|
||||
fpLogStore.markStale();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user