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.

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