|
|
@ -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))}` |
|
|
|
} |
|
|
|
</script> |
|
|
@ -68,15 +73,19 @@ |
|
|
|
<EveryMinute bind:now={now} /> |
|
|
|
<span title={titleTimeStr}> |
|
|
|
{#if (overdue)} |
|
|
|
<span class="overdue">{amountStr} {unit} ago</span> |
|
|
|
<span class="overdue">{amountStr}{compact ? "" : " "}{unit} {!compact ? "ago" : ""}</span> |
|
|
|
{:else if (started)} |
|
|
|
<span class:danger class="started">{amountStr} {unit} left</span> |
|
|
|
<span class:danger class="started">{amountStr}{compact ? "" : " "}{unit} {!compact ? "left" : ""}</span> |
|
|
|
{:else} |
|
|
|
<span class="pending">In {amountStr} {unit}</span> |
|
|
|
<span class="pending">In {amountStr}{compact ? "" : " "}{unit}</span> |
|
|
|
{/if} |
|
|
|
</span> |
|
|
|
|
|
|
|
<style> |
|
|
|
span { |
|
|
|
color: #ccc; |
|
|
|
} |
|
|
|
|
|
|
|
span.pending { |
|
|
|
color: #2797e2; |
|
|
|
} |
|
|
|