2021-04-13 11:02:41 +02:00
|
|
|
<!--
|
|
|
|
Copyright: Ankitects Pty Ltd and contributors
|
|
|
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
-->
|
2020-06-26 02:42:10 +02:00
|
|
|
<script lang="typescript">
|
2021-04-22 19:55:26 +02:00
|
|
|
import type pb from "lib/backend_proto";
|
2020-06-26 02:42:10 +02:00
|
|
|
|
2021-03-21 13:47:52 +01:00
|
|
|
import Graph from "./Graph.svelte";
|
|
|
|
|
|
|
|
import type { TodayData } from "./today";
|
|
|
|
import { gatherData } from "./today";
|
|
|
|
|
2021-06-20 07:49:20 +02:00
|
|
|
export let sourceData: pb.BackendProto.GraphsResponse | null = null;
|
2020-06-26 02:42:10 +02:00
|
|
|
|
|
|
|
let todayData: TodayData | null = null;
|
|
|
|
$: if (sourceData) {
|
2021-03-26 11:23:43 +01:00
|
|
|
todayData = gatherData(sourceData);
|
2020-06-26 02:42:10 +02:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2021-03-21 13:47:52 +01:00
|
|
|
{#if todayData}
|
|
|
|
<Graph title={todayData.title}>
|
|
|
|
<div class="legend">
|
2020-06-27 12:31:33 +02:00
|
|
|
{#each todayData.lines as line}
|
|
|
|
<div>{line}</div>
|
|
|
|
{/each}
|
|
|
|
</div>
|
2021-03-21 13:47:52 +01:00
|
|
|
</Graph>
|
2020-06-27 11:24:49 +02:00
|
|
|
{/if}
|
2021-05-26 01:21:33 +02:00
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
.legend {
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
</style>
|