Browse Source

add project link on task links.

main
Gisle Aune 4 years ago
parent
commit
642a0d8eff
  1. 42
      svelte-ui/src/components/ChildEntry.svelte
  2. 6
      svelte-ui/src/components/TaskEntry.svelte
  3. 7
      svelte-ui/src/components/TaskList.svelte

42
svelte-ui/src/components/ChildEntry.svelte

@ -6,6 +6,11 @@ import { formatTime } from "../utils/time";
import LinkHook from "./LinkHook.svelte";
import Markdown from "./Markdown.svelte";
interface ActualParent {
id: string
name: string
}
interface EntryCommon {
id: string
name?: string
@ -29,6 +34,8 @@ import { formatTime } from "../utils/time";
}
export let entry: EntryCommon = null;
export let actualParent: ActualParent = null;
export let hideParentName: boolean = false;
let iconName: IconName;
let displayName: string;
@ -48,6 +55,16 @@ import { formatTime } from "../utils/time";
<Icon name={iconName} />
</div>
</slot>
{#if (actualParent != null)}
{#if !hideParentName}
<div class="actual-parent-icon">
<Icon block name="link" />
</div>
<div class="actual-parent">
<a href={`/questlog#${actualParent.id}`}>{actualParent.name}</a>
</div>
{/if}
{/if}
<div class="name">{displayName}</div>
{#if (entry.endTime != null)}
<div class="times">
@ -95,6 +112,31 @@ import { formatTime } from "../utils/time";
background: #333;
}
div.actual-parent-icon {
display: flex;
flex-direction: column;
font-size: 1em;
padding: 0.3em 0;
padding-bottom: 0.1em;
margin-right: 0.5em;
color: #555;
}
div.actual-parent {
font-size: 1em;
font-weight: 100;
margin: auto 0;
vertical-align: middle;
padding: 0.125em 0;
padding-right: 1ch;
display: flex;
flex-direction: row;
}
div.actual-parent :global(div.icon) {
display: none !important;
}
div.name {
font-size: 1em;
font-weight: 100;

6
svelte-ui/src/components/TaskEntry.svelte

@ -17,8 +17,11 @@
export let task: TaskResult = null;
export let project: Project = null;
export let actualProject: Project | null = null;
export let showAllOptions: boolean = false;
export let actualParent: Project | null = null;
let showLogs = false;
let mdLogAdd: ModalData;
let mdTaskEdit: ModalData;
@ -72,10 +75,11 @@
$: mdTaskLink = {name: "tasklink.add", task};
$: mdTaskUnlink = {name: "tasklink.delete", task, project};
$: isLinked = task.projectId !== project.id;
$: actualParent = (actualProject != null && actualProject.id !== project.id) ? actualProject : null;
</script>
<StatusColor affects="task" entry={task}>
<ChildEntry entry={task}>
<ChildEntry entry={task} actualParent={actualParent} hideParentName={!showAllOptions}>
<div slot="icon">
<TaskIcon task={task} />
</div>

7
svelte-ui/src/components/TaskList.svelte

@ -2,6 +2,7 @@
import type Project from "../models/project";
import type { TaskResult } from "../models/task";
import TaskEntry from "./TaskEntry.svelte";
import projectStore from "../stores/project";
export let project: Project;
export let tasks: TaskResult[];
@ -12,7 +13,11 @@
{#if tasks.length > 0}
<h3>{header}</h3>
{#each tasks as task (task.id)}
<TaskEntry showAllOptions={showAllOptions} task={task} project={project} />
<TaskEntry
showAllOptions={showAllOptions}
task={task} project={project}
actualProject={$projectStore.projects.find(p => p.id === task.projectId)}
/>
{/each}
{/if}

Loading…
Cancel
Save