From 033abaa5bb2333f8d0f1cbb131fe312dc52a58b4 Mon Sep 17 00:00:00 2001 From: Gisle Aune Date: Sun, 17 Jan 2021 12:48:29 +0100 Subject: [PATCH] refactored Item, Task and Log entry to share code. TaskEntry is still a bit messy, but that's because of the weird icon stuffs. --- svelte-ui/src/components/ChildEntry.svelte | 111 ++++++++++++++++ svelte-ui/src/components/ItemEntry.svelte | 88 +------------ svelte-ui/src/components/ItemLink.svelte | 34 +++++ svelte-ui/src/components/LogEntry.svelte | 110 ++-------------- svelte-ui/src/components/TaskEntry.svelte | 144 ++++++--------------- 5 files changed, 199 insertions(+), 288 deletions(-) create mode 100644 svelte-ui/src/components/ChildEntry.svelte create mode 100644 svelte-ui/src/components/ItemLink.svelte diff --git a/svelte-ui/src/components/ChildEntry.svelte b/svelte-ui/src/components/ChildEntry.svelte new file mode 100644 index 0000000..3d37412 --- /dev/null +++ b/svelte-ui/src/components/ChildEntry.svelte @@ -0,0 +1,111 @@ + + +
+ +
+
+ +
+ +
+
+
{entry.name}
+ {#if (entry.endTime != null)} +
+ +
+ {/if} +
+
+

{entry.description}

+ +
+
+
+ + diff --git a/svelte-ui/src/components/ItemEntry.svelte b/svelte-ui/src/components/ItemEntry.svelte index bad51df..402e756 100644 --- a/svelte-ui/src/components/ItemEntry.svelte +++ b/svelte-ui/src/components/ItemEntry.svelte @@ -1,8 +1,8 @@ -
- -
-
-
- {item.groupWeight} -
-
{item.name}
-
-
-

{item.description}

- - - - - -
-
-
- - diff --git a/svelte-ui/src/components/ItemLink.svelte b/svelte-ui/src/components/ItemLink.svelte new file mode 100644 index 0000000..4a8fd58 --- /dev/null +++ b/svelte-ui/src/components/ItemLink.svelte @@ -0,0 +1,34 @@ + + +
+
+ +
+ +
+ + \ No newline at end of file diff --git a/svelte-ui/src/components/LogEntry.svelte b/svelte-ui/src/components/LogEntry.svelte index 18af3fd..36e4e50 100644 --- a/svelte-ui/src/components/LogEntry.svelte +++ b/svelte-ui/src/components/LogEntry.svelte @@ -2,8 +2,8 @@ import type { IconName } from "../external/icons"; import type { LogResult } from "../models/log"; import type { ModalData } from "../stores/modal"; - import { formatTime } from "../utils/time"; - import Icon from "./Icon.svelte"; + import ChildEntry from "./ChildEntry.svelte"; + import ItemLink from "./ItemLink.svelte"; import Option from "./Option.svelte"; import OptionRow from "./OptionRow.svelte"; @@ -20,102 +20,10 @@ $: mdLogDelete = {name: "log.delete", log}; -
-
-
-
- -
-
{log.task.name}
-
{formatTime(log.loggedTime)}
-
-
-

{log.description}

- - - - - -
-
-
- - + + + + + + + diff --git a/svelte-ui/src/components/TaskEntry.svelte b/svelte-ui/src/components/TaskEntry.svelte index 378eeb3..ed074a0 100644 --- a/svelte-ui/src/components/TaskEntry.svelte +++ b/svelte-ui/src/components/TaskEntry.svelte @@ -1,10 +1,9 @@ -
- -
-
- {#if !task.active} -
- - - {task.completedAmount} / {task.itemAmount} - -
- {:else} -
- {task.completedAmount} / {task.itemAmount} -
- {/if} -
{task.name}
- {#if (task.endTime != null)} -
- -
- {/if} + +
+ {#if !task.active} + + + {task.completedAmount} / {task.itemAmount} + + {:else} + {task.completedAmount} / {task.itemAmount} + {/if} +
+
+
+
-
-

{task.description}

- - - {#if task.logs.length > 0} - - {/if} - - {#if showAllOptions} - - - {/if} - - {#if showLogs && task.logs.length > 0} -
- {#each task.logs as log (log.id)} -
-
-
{log.description}
-
- {/each} -
- {/if} +
-
+ + {#if task.logs.length > 0} + + {/if} + + {#if showAllOptions} + + + {/if} + + {#if showLogs && task.logs.length > 0} +
+ {#each task.logs as log (log.id)} +
+
+
{log.description}
+
+ {/each} +
+ {/if} +