diff --git a/src/lib/components/counters.svelte b/src/lib/components/counters.svelte new file mode 100644 index 0000000..ff39076 --- /dev/null +++ b/src/lib/components/counters.svelte @@ -0,0 +1,56 @@ + + +
+ {#if $awakeMinutes !== null && $awakeMinutes < $asleepMinutes}

Awake for {$awakeMinutes} minutes

{/if} + {#if $asleepMinutes !== null && $asleepMinutes < $awakeMinutes}

Sleeping for {$asleepMinutes} minutes

{/if} + {#if $foodMinutes !== null}

Ate {$foodMinutes} minutes ago

{/if} + {#if $diaperMinutes !== null}

Diaper changed {$diaperMinutes} minutes ago

{/if} + {#if $poopDays === 0}

Pooped today

{:else if $poopDays !== null}

Pooped {$poopDays} days ago

{/if} +
+ \ No newline at end of file diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 73ccefe..ea15697 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -18,12 +18,23 @@

Coover Tracker

diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 77fb1a9..79f125c 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,7 +1,7 @@ {#if $currentUser} -
- - - - - + -

Today

- -
+
+

Today

+
+
+
    + {#each actions as action} +
  • {action.type} at {new Date(action.created).toLocaleTimeString('en-NL', { hour: '2-digit', minute: '2-digit' })}
  • + {/each} +
+ +
+
+
{/if} \ No newline at end of file diff --git a/src/routes/calendar/+page.svelte b/src/routes/calendar/+page.svelte index 62bc777..113c929 100644 --- a/src/routes/calendar/+page.svelte +++ b/src/routes/calendar/+page.svelte @@ -34,20 +34,26 @@ import { onMount } from 'svelte'; // Generate hours for the grid const hours = Array.from({ length: 24 }, (_, i) => i); + + // Function to format hour in HH:mm format + const formatHour = (hour: number) => { + return `${hour.toString().padStart(2, '0')}:00`; + };
+ +
+ {#each daysOfWeek as day}
{day}
{/each} - + {#each hours as hour} +
{formatHour(hour)}
{#each daysOfWeek as _, dayIndex}
{#each actions as action} {#if getDayOfWeek(action.created) === dayIndex && getHourOfDay(action.created) === hour} -
{action.type}
+
{action.type}
{/if} {/each}
diff --git a/src/routes/stats/+page.svelte b/src/routes/stats/+page.svelte index 62210f9..a2b1fff 100644 --- a/src/routes/stats/+page.svelte +++ b/src/routes/stats/+page.svelte @@ -152,7 +152,7 @@ totalDays += interval; } - return totalDays / (poopDates.length - 1); + return parseFloat((totalDays / (poopDates.length - 1)).toFixed(2)); } function calculateAvgMealsPerDay(actions: Action[]): number { @@ -174,14 +174,14 @@ } -
+

Stats

    -
  • Average Sleep per Nap: {stats.avgSleepPerNap} minutes
  • -
  • Average Naps per Day: {stats.avgNapsPerDay} naps
  • -
  • Average Sleep per Day: {stats.avgSleepPerDay} minutes
  • -
  • Average Diaper Changes per Day: {stats.avgDiaperChanges}
  • -
  • Average Days Between Poops: {stats.avgPoops}
  • -
  • Average Number of Meals per Day: {stats.avgEatingTimes}
  • +
  • {stats.avgSleepPerNap} min / nap
  • +
  • {stats.avgNapsPerDay} naps / day
  • +
  • {stats.avgSleepPerDay} min of sleep / day
  • +
  • {stats.avgDiaperChanges} diapers / day
  • +
  • {stats.avgPoops} days between poops
  • +
  • {stats.avgEatingTimes} meals / day
-
+ diff --git a/src/styles/app.css b/src/styles/app.css index 7f1b5f4..d110b7f 100644 --- a/src/styles/app.css +++ b/src/styles/app.css @@ -15,4 +15,20 @@ button, input[type="submit"] { background-color: var(--c-primary); border-color: var(--c-primary); +} + +nav ul { + list-style: circle inside; + display: flex; + list-style: none; + gap: 1em; + justify-content: end; +} + +header { + padding-top: 2rem; +} + +section { + margin-top: 4rem; } \ No newline at end of file