2020-06-26 02:42:10 +02:00
|
|
|
<script lang="typescript">
|
2020-11-01 05:26:58 +01:00
|
|
|
import { gatherData } from "./today";
|
|
|
|
import type { TodayData } from "./today";
|
2020-11-05 02:01:30 +01:00
|
|
|
import type pb from "anki/backend_proto";
|
|
|
|
import type { I18n } from "anki/i18n";
|
2020-06-26 02:42:10 +02:00
|
|
|
|
|
|
|
export let sourceData: pb.BackendProto.GraphsOut | null = null;
|
2020-06-27 11:24:49 +02:00
|
|
|
export let i18n: I18n;
|
2020-06-26 02:42:10 +02:00
|
|
|
|
|
|
|
let todayData: TodayData | null = null;
|
|
|
|
$: if (sourceData) {
|
2020-06-27 11:24:49 +02:00
|
|
|
todayData = gatherData(sourceData, i18n);
|
2020-06-26 02:42:10 +02:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2020-06-27 11:24:49 +02:00
|
|
|
{#if todayData}
|
2020-07-16 20:44:21 +02:00
|
|
|
<div class="graph" id="graph-today-stats">
|
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}
|