mirror of
https://github.com/System-End/hackatime.git
synced 2026-04-19 22:15:14 +00:00
* Add 'today' to dashboard logged time sentence * Add comma :P --------- Co-authored-by: Mahad Kalam <55807755+skyfallwastaken@users.noreply.github.com>
48 lines
1.3 KiB
Svelte
48 lines
1.3 KiB
Svelte
<script lang="ts">
|
|
import { pluralize, toSentence } from "./utils";
|
|
|
|
let {
|
|
show_logged_time_sentence,
|
|
todays_duration_display,
|
|
todays_languages,
|
|
todays_editors,
|
|
}: {
|
|
show_logged_time_sentence: boolean;
|
|
todays_duration_display: string;
|
|
todays_languages: string[];
|
|
todays_editors: string[];
|
|
} = $props();
|
|
</script>
|
|
|
|
<p>
|
|
{#if show_logged_time_sentence}
|
|
Today, you've logged
|
|
{todays_duration_display}
|
|
{#if todays_languages.length > 0 || todays_editors.length > 0}
|
|
across
|
|
{#if todays_languages.length > 0}
|
|
{#if todays_languages.length >= 4}
|
|
{todays_languages.slice(0, 2).join(", ")}
|
|
<span title={todays_languages.slice(2).join(", ")}>
|
|
(& {todays_languages.length - 2}
|
|
{pluralize(
|
|
todays_languages.length - 2,
|
|
"other language",
|
|
"other languages",
|
|
)})
|
|
</span>
|
|
{:else}
|
|
{toSentence(todays_languages)}
|
|
{/if}
|
|
{/if}
|
|
{#if todays_languages.length > 0 && todays_editors.length > 0}
|
|
using
|
|
{/if}
|
|
{#if todays_editors.length > 0}
|
|
{toSentence(todays_editors)}
|
|
{/if}
|
|
{/if}
|
|
{:else}
|
|
No time logged today... but you can change that!
|
|
{/if}
|
|
</p>
|