|
|
@ -1,31 +1,32 @@ |
|
|
|
<script lang="ts"> |
|
|
|
import type { IconName } from "../external/icons"; |
|
|
|
import TaskAddForm from "../forms/TaskAddForm.svelte"; |
|
|
|
import type { ProjectResult } from "../models/project"; |
|
|
|
import type { ModalData } from "../stores/modal"; |
|
|
|
import DaysLeft from "./DaysLeft.svelte"; |
|
|
|
import Icon from "./Icon.svelte"; |
|
|
|
import Option from "./Option.svelte"; |
|
|
|
import OptionRow from "./OptionRow.svelte"; |
|
|
|
import Progress from "./Progress.svelte"; |
|
|
|
import TaskEntry from "./TaskEntry.svelte"; |
|
|
|
|
|
|
|
export let project: ProjectResult = null; |
|
|
|
export let showAllOptions: boolean = false; |
|
|
|
export let hideInactive: boolean = false; |
|
|
|
|
|
|
|
let iconName: IconName = "question"; |
|
|
|
let mdAddTask: ModalData; |
|
|
|
let mdProjectEdit: ModalData; |
|
|
|
let mdProjectDelete: ModalData; |
|
|
|
let progressAmount: number; |
|
|
|
let progressTarget: number; |
|
|
|
|
|
|
|
$: iconName = project.icon as IconName; |
|
|
|
$: mdAddTask = {name:"task.add", project}; |
|
|
|
$: mdProjectEdit = {name:"project.edit", project}; |
|
|
|
$: mdProjectDelete = {name:"project.delete", project}; |
|
|
|
$: progressAmount = project.tasks.map(t => Math.min(t.completedAmount, t.itemAmount) * t.item.groupWeight).reduce((n,m) => n+m, 0); |
|
|
|
$: progressTarget = Math.max(project.tasks.map(t => t.itemAmount * t.item.groupWeight).reduce((n,m) => n+m, 0), 1); |
|
|
|
</script> |
|
|
|
|
|
|
|
<div class="project"> |
|
|
|
<div class="icon" class:inactive={!project.active}><Icon block name={iconName} /></div> |
|
|
|
<div class="icon" class:inactive={!project.active}><Icon block name={project.icon} /></div> |
|
|
|
<div class="body"> |
|
|
|
<div class="header"> |
|
|
|
<div class="name">{project.name}</div> |
|
|
@ -35,6 +36,7 @@ import TaskAddForm from "../forms/TaskAddForm.svelte"; |
|
|
|
</div> |
|
|
|
{/if} |
|
|
|
</div> |
|
|
|
<Progress thin green count={progressAmount} target={progressTarget} /> |
|
|
|
{#if showAllOptions} |
|
|
|
<div class="description"> |
|
|
|
<p>{project.description}</p> |
|
|
|