Skip to content

Commit

Permalink
feat: add streak indicator for lightning
Browse files Browse the repository at this point in the history
  • Loading branch information
khui0 committed Jun 9, 2024
1 parent a1872cd commit 96d051a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib/components/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import Streak from "./Streak.svelte";
import DailyStreak from "./DailyStreak.svelte";
import LightningStreak from "./LightningStreak.svelte";
import GameModes from "./GameModes.svelte";
import BiGearFill from "~icons/bi/gear-fill";
Expand All @@ -15,6 +16,8 @@
<Streak></Streak>
{:else if $page.url.pathname === base + "/daily"}
<DailyStreak></DailyStreak>
{:else if $page.url.pathname === base + "/lightning"}
<LightningStreak></LightningStreak>
{/if}
<slot></slot>
</div>
Expand Down
12 changes: 12 additions & 0 deletions src/lib/components/LightningStreak.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<script lang="ts">
import { db } from "$lib/db";
import { liveQuery } from "dexie";
const streak = liveQuery(() => db.stats.get("lightning-streak"));
</script>

{#if $streak?.value || 0 > 0}
<div class="bg-base-300 px-3 self-stretch rounded-btn flex items-center">
<p class="font-bold">{$streak?.value} 🔥</p>
</div>
{/if}

0 comments on commit 96d051a

Please sign in to comment.