Anki/ts/routes/graphs/TrueRetention.svelte
Damien Elmes 85f034b144 Split true retention into multiple tables; display vertically
This prevents the page scrolling off screen on small devices. This is
a quick fix, and further tweaks to the layout are welcome.
2024-10-04 17:04:22 +10:00

39 lines
1 KiB
Svelte

<!--
Copyright: Ankitects Pty Ltd and contributors
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-->
<script lang="ts">
import type { GraphsResponse } from "@generated/anki/stats_pb";
import * as tr from "@generated/ftl";
import { renderTrueRetention } from "./true-retention";
import Graph from "./Graph.svelte";
import type { RevlogRange } from "./graph-helpers";
export let revlogRange: RevlogRange;
export let sourceData: GraphsResponse | null = null;
let trueRetentionHtml: string;
$: if (sourceData) {
trueRetentionHtml = renderTrueRetention(sourceData, revlogRange);
}
const title = tr.statisticsTrueRetentionTitle();
const subtitle = tr.statisticsTrueRetentionSubtitle();
</script>
<Graph {title} {subtitle}>
{#if trueRetentionHtml}
<div class="true-retention-table">
{@html trueRetentionHtml}
</div>
{/if}
</Graph>
<style>
.true-retention-table {
overflow-x: auto;
margin-top: 1rem;
}
</style>