Browse Source
hide completed tasks in projects, and add individual deadline tasks to front page.
main
hide completed tasks in projects, and add individual deadline tasks to front page.
main
Gisle Aune
4 years ago
13 changed files with 116 additions and 22 deletions
-
8api/task.go
-
7database/postgres/tasks.go
-
1models/task.go
-
14svelte-ui/src/clients/stufflog.ts
-
8svelte-ui/src/components/ProjectEntry.svelte
-
3svelte-ui/src/models/group.ts
-
3svelte-ui/src/models/item.ts
-
5svelte-ui/src/models/project.ts
-
9svelte-ui/src/models/task.ts
-
37svelte-ui/src/pages/FrontPage.svelte
-
4svelte-ui/src/pages/ProjectPage.svelte
-
1svelte-ui/src/stores/project.ts
-
38svelte-ui/src/stores/tasks.ts
@ -0,0 +1,38 @@ |
|||
import { writable } from "svelte/store"; |
|||
import stuffLogClient from "../clients/stufflog"; |
|||
import type { TaskFilter, TaskResult } from "../models/task"; |
|||
|
|||
interface TaskStoreData { |
|||
loading: boolean |
|||
stale: boolean |
|||
filter: TaskFilter |
|||
tasks: TaskResult[] |
|||
} |
|||
|
|||
function createTaskStore() { |
|||
const {update, subscribe} = writable<TaskStoreData>({ |
|||
loading: false, |
|||
stale: true, |
|||
filter: {}, |
|||
tasks: [], |
|||
}); |
|||
|
|||
return { |
|||
subscribe, |
|||
|
|||
markStale() { |
|||
update(v => ({...v, stale: true})); |
|||
}, |
|||
|
|||
async load(filter: TaskFilter) { |
|||
update(v => ({...v, loading: true, stale: false, filter})); |
|||
const tasks = await stuffLogClient.listTasks(filter); |
|||
update(v => ({...v, loading: false, tasks: [...tasks]})); |
|||
}, |
|||
} |
|||
} |
|||
|
|||
const taskStore = createTaskStore(); |
|||
|
|||
export default taskStore; |
|||
export const fpTaskStore = createTaskStore(); |
Write
Preview
Loading…
Cancel
Save
Reference in new issue