2020-06-26 02:42:10 +02:00
|
|
|
<script lang="typescript">
|
|
|
|
import { gatherData, CardCounts } from "./card-counts";
|
|
|
|
import pb from "../backend/proto";
|
2020-06-27 13:10:17 +02:00
|
|
|
import { I18n } from "../i18n";
|
2020-06-26 02:42:10 +02:00
|
|
|
|
|
|
|
export let sourceData: pb.BackendProto.GraphsOut | null = null;
|
2020-06-27 13:10:17 +02:00
|
|
|
export let i18n: I18n;
|
2020-06-26 02:42:10 +02:00
|
|
|
|
|
|
|
let cardCounts: CardCounts | null = null;
|
|
|
|
$: if (sourceData) {
|
2020-06-27 13:10:17 +02:00
|
|
|
cardCounts = gatherData(sourceData, i18n);
|
2020-06-26 02:42:10 +02:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2020-06-27 13:10:17 +02:00
|
|
|
<style>
|
|
|
|
.counts-outer {
|
|
|
|
display: flex;
|
|
|
|
flex-wrap: wrap;
|
2020-06-29 05:46:13 +02:00
|
|
|
justify-content: space-around;
|
2020-06-27 13:10:17 +02:00
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
|
|
{#if cardCounts}
|
|
|
|
<div class="graph">
|
|
|
|
<h1>{cardCounts.title}</h1>
|
|
|
|
<div class="counts-outer">
|
|
|
|
{#each cardCounts.counts as count}
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<b>{count[0]}</b>
|
|
|
|
</div>
|
|
|
|
<div>{count[1]}</div>
|
|
|
|
</div>
|
|
|
|
{/each}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{/if}
|