Vašek Šraier
4 years ago
6 changed files with 130 additions and 54 deletions
@ -0,0 +1,18 @@ |
|||
<script lang="ts"> |
|||
import type { TaskDescriptor } from "./task-loader"; |
|||
import Hoverable from "./Hoverable.svelte"; |
|||
|
|||
export let task: TaskDescriptor; |
|||
|
|||
$: cx = task === undefined || task.x === undefined ? 0 : task.x + 6; |
|||
$: cy = task === undefined || task.y === undefined ? 0 : task.y - 6; |
|||
</script> |
|||
|
|||
<Hoverable let:hovering={focused}> |
|||
{#if !focused} |
|||
<circle r="20" style="fill: #69b3a2" {cx} {cy} /> |
|||
{:else} |
|||
<circle r="20" style="fill: #ffb3a2" {cx} {cy} /> |
|||
{/if} --> |
|||
<text x={cx} y={cy}>{task.id}</text> |
|||
</Hoverable> |
@ -0,0 +1,15 @@ |
|||
<script> |
|||
let hovering; |
|||
|
|||
function enter() { |
|||
hovering = true; |
|||
} |
|||
|
|||
function leave() { |
|||
hovering = false; |
|||
} |
|||
</script> |
|||
|
|||
<g on:mouseenter={enter} on:mouseleave={leave}> |
|||
<slot hovering={hovering}></slot> |
|||
</g> |
@ -0,0 +1,30 @@ |
|||
<script lang="ts"> |
|||
import type { TasksFile } from "./task-loader"; |
|||
|
|||
export let promise: Promise<TasksFile>; |
|||
|
|||
|
|||
let data: TasksFile | null = null; |
|||
let err: any | null = null; |
|||
promise.then( |
|||
(d) => { |
|||
data = d; |
|||
}, |
|||
(e) => { |
|||
err = e; |
|||
} |
|||
) |
|||
|
|||
</script> |
|||
|
|||
{#if data == null && err == null} |
|||
<div>Loading...</div> |
|||
{/if} |
|||
|
|||
{#if data != null } |
|||
<slot {data} /> |
|||
{/if} |
|||
|
|||
{#if err != null } |
|||
<div>Error - {err}</div> |
|||
{/if} |
Reference in new issue