From 3085b8c025ae86cd0ffbb3c9c69686335d836790 Mon Sep 17 00:00:00 2001 From: Gisle Aune Date: Sun, 17 Jan 2021 17:08:05 +0100 Subject: [PATCH] add times left indicator to questlog. --- svelte-ui/src/components/DaysLeft.svelte | 15 ++++++++++++--- svelte-ui/src/components/QLListItem.svelte | 19 ++++++++++++++++++- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/svelte-ui/src/components/DaysLeft.svelte b/svelte-ui/src/components/DaysLeft.svelte index ad95810..9799daf 100644 --- a/svelte-ui/src/components/DaysLeft.svelte +++ b/svelte-ui/src/components/DaysLeft.svelte @@ -3,6 +3,7 @@ export let startTime: Date | string = new Date(); export let endTime: Date | string = new Date(); + export let compact: boolean = false; let started = false; let overdue = false; @@ -61,6 +62,10 @@ amountStr = amount.toString() } + if (compact) { + unit = unit.slice(0, 1); + } + titleTimeStr = `${formatTime(new Date(startTime))} – ${formatTime(new Date(endTime))}` } @@ -68,15 +73,19 @@ {#if (overdue)} - {amountStr} {unit} ago + {amountStr}{compact ? "" : " "}{unit} {!compact ? "ago" : ""} {:else if (started)} - {amountStr} {unit} left + {amountStr}{compact ? "" : " "}{unit} {!compact ? "left" : ""} {:else} - In {amountStr} {unit} + In {amountStr}{compact ? "" : " "}{unit} {/if} \ No newline at end of file