From ab35df9fe2dd6e3010267d5b3356de4f4d79fbfa Mon Sep 17 00:00:00 2001 From: Gisle Aune Date: Wed, 13 Jan 2021 20:26:28 +0100 Subject: [PATCH] refactor GoalEntry and add guiding lines to goal progress. --- svelte-ui/src/components/GoalEntry.svelte | 103 ++++++++-------------- svelte-ui/src/components/Progress.svelte | 17 +++- 2 files changed, 50 insertions(+), 70 deletions(-) diff --git a/svelte-ui/src/components/GoalEntry.svelte b/svelte-ui/src/components/GoalEntry.svelte index 838d3cc..bc95e07 100644 --- a/svelte-ui/src/components/GoalEntry.svelte +++ b/svelte-ui/src/components/GoalEntry.svelte @@ -1,93 +1,60 @@ -
-
-
-
-
{goal.name}
-
- -
-
- {#if showAllOptions} -
-

{goal.description}

-
- - - - - {/if} -
- -
-
-
+ $: { + const now = Date.now() + const start = Date.parse(goal.startTime) + const length = Date.parse(goal.endTime) - start; - \ No newline at end of file diff --git a/svelte-ui/src/components/Progress.svelte b/svelte-ui/src/components/Progress.svelte index 3356a70..8cfdf45 100644 --- a/svelte-ui/src/components/Progress.svelte +++ b/svelte-ui/src/components/Progress.svelte @@ -13,6 +13,8 @@ export let count = 0; export let green = false; export let thin = false; + export let thinner = false; + export let gray = false; let offClass = COLORS[0]; let onClass = COLORS[1]; @@ -42,6 +44,10 @@ onClass = "green" offClass = "none" } + if (gray) { + onClass = "gray" + offClass = "none" + } // Mark it non-segmented if the target is too high. This prevents a clunky progress bar, // or a browser freeze if you set the target very high. @@ -51,7 +57,7 @@ } -
+
{#if nonSegmented}
@@ -80,7 +86,7 @@ flex-basis: 0; display: inline-block; box-sizing: border-box; - border: 1px solid #000; + border: 1px solid #111; } div.non-segmented { @@ -94,6 +100,7 @@ div.gold { background-color: #ffd966; } div.diamond { background-color: #84f5ff; } div.green { background-color: #78ff78; } + div.gray { background-color: #777777; } div.on { opacity: 0.75; @@ -106,4 +113,10 @@ div.bar.thin { height: 0.25em; } + div.bar.thinner { + height: 0.125em; + } + div.bar.thinner div.none { + background-color: #111111; + } \ No newline at end of file