You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.6 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <script lang="ts">
  2. import Boi from "../components/Boi.svelte";
  3. import Checkbox from "../components/Checkbox.svelte";
  4. import ProjectEntry from "../components/ProjectEntry.svelte";
  5. import RefreshSelection from "../components/RefreshSelection.svelte";
  6. import TableOfContent from "../components/TableOfContent.svelte";
  7. import type { ModalData } from "../stores/modal";
  8. import projectStore from "../stores/project";
  9. const mdProjectAdd: ModalData = {name: "project.add", groupId: null};
  10. let showInactive = ($projectStore.filter.active === null);
  11. $: {
  12. if (showInactive && $projectStore.filter.active === true) {
  13. projectStore.markStale();
  14. }
  15. if (!showInactive && $projectStore.filter.active == null) {
  16. projectStore.markStale();
  17. }
  18. }
  19. $: {
  20. if ($projectStore.stale && !$projectStore.loading) {
  21. projectStore.load({
  22. active: showInactive ? null : true,
  23. });
  24. }
  25. }
  26. </script>
  27. <div class="page">
  28. <div class="options">
  29. <Checkbox centered bind:checked={showInactive} label="Show completed tasks and projects." />
  30. </div>
  31. <TableOfContent hideInactive={!showInactive} projects={$projectStore.projects} />
  32. {#each $projectStore.projects as project (project.id)}
  33. <ProjectEntry hideInactive={!showInactive} showAllOptions project={project} />
  34. {/each}
  35. <Boi open={mdProjectAdd}>Add Project</Boi>
  36. </div>
  37. <RefreshSelection />
  38. <style>
  39. div.page {
  40. display: block;
  41. margin: auto;
  42. max-width: 100%;
  43. width: 640px;
  44. margin-top: 0;
  45. box-sizing: border-box;
  46. }
  47. div.options {
  48. display: flex;
  49. margin: 1em auto;
  50. }
  51. </style>