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.

98 lines
2.1 KiB

  1. <script lang="ts">
  2. import type { ProjectResult } from "../models/project";
  3. import selectionStore from "../stores/selection";
  4. import DaysLeft from "./DaysLeft.svelte";
  5. import Icon from "./Icon.svelte";
  6. import ProjectProgress from "./ProjectProgress.svelte";
  7. import TimeProgress from "./TimeProgress.svelte";
  8. export let project: ProjectResult;
  9. let selected: boolean;
  10. let completed: boolean;
  11. function handleClick() {
  12. window.location.hash = "#" + project.id;
  13. selectionStore.change("hash", project.id);
  14. }
  15. $: selected = $selectionStore.hash === project.id;
  16. $: completed = !project.active;
  17. </script>
  18. <div class="ql-list-item" on:click={handleClick} class:selected>
  19. <div class="icon" class:completed>
  20. <Icon block name={project.icon} />
  21. </div>
  22. <div class="header">
  23. <div class="name">
  24. <div class="content">{project.name}</div>
  25. {#if project.endTime}
  26. <div class="times">
  27. <DaysLeft compact startTime={project.createdTime} endTime={project.endTime} />
  28. </div>
  29. {/if}
  30. </div>
  31. <ProjectProgress project={project} />
  32. {#if project.endTime}
  33. <TimeProgress startTime={project.createdTime} endTime={project.endTime} />
  34. {/if}
  35. </div>
  36. </div>
  37. <style>
  38. div.ql-list-item {
  39. display: flex;
  40. flex-direction: row;
  41. -webkit-user-select: none;
  42. -moz-user-select: none;
  43. color: #777;
  44. padding: 0.2em;
  45. padding-bottom: 0.05em;
  46. cursor: pointer;
  47. }
  48. div.ql-list-item:hover {
  49. color: #ccc;
  50. background-color: #191919;
  51. }
  52. div.ql-list-item.selected {
  53. background-color: #222;
  54. }
  55. div.icon {
  56. color: #444;
  57. padding: 0.3em 0.5ch;
  58. padding-right: 1ch;
  59. padding-top: 0.4em;
  60. }
  61. div.ql-list-item.selected div.icon {
  62. color: #666;
  63. }
  64. div.icon.completed {
  65. color: #484;
  66. }
  67. div.ql-list-item.selected div.icon.completed {
  68. color: #78ff78;
  69. }
  70. div.ql-list-item:hover div.icon {
  71. color: #ccc;
  72. }
  73. div.header {
  74. flex-grow: 1;
  75. flex-shrink: 0;
  76. padding-right: 0.5ch;
  77. }
  78. div.name {
  79. display: flex;
  80. flex-direction: row;
  81. }
  82. div.name > div.times {
  83. margin-left: auto;
  84. }
  85. </style>