anki/ts/src/stats/TodayStats.svelte

27 lines
673 B
Svelte
Raw Normal View History

<script lang="typescript">
import { gatherData, TodayData } from "./today";
2020-06-27 11:24:49 +02:00
import { studiedToday } from "../time";
import pb from "../backend/proto";
2020-06-27 11:24:49 +02:00
import { I18n } from "../i18n";
export let sourceData: pb.BackendProto.GraphsOut | null = null;
2020-06-27 11:24:49 +02:00
export let i18n: I18n;
let todayData: TodayData | null = null;
$: if (sourceData) {
2020-06-27 11:24:49 +02:00
todayData = gatherData(sourceData, i18n);
}
</script>
2020-06-27 11:24:49 +02:00
{#if todayData}
<div class="graph">
2020-06-27 12:31:33 +02:00
<h1>{todayData.title}</h1>
2020-06-27 11:24:49 +02:00
2020-06-27 12:31:33 +02:00
<div class="legend-outer">
{#each todayData.lines as line}
<div>{line}</div>
{/each}
</div>
2020-06-27 11:24:49 +02:00
</div>
{/if}