mirror of
https://github.com/ankitects/anki.git
synced 2025-12-06 11:27:11 -05:00
47 lines
1.5 KiB
Svelte
47 lines
1.5 KiB
Svelte
<script lang="typescript">
|
|
import { I18n } from "../i18n";
|
|
import { HistogramData } from "./histogram-graph";
|
|
import { GraphRange, RevlogRange } from "./graphs";
|
|
import { gatherData, GraphData, buildHistogram } from "./future-due";
|
|
import pb from "../backend/proto";
|
|
import HistogramGraph from "./HistogramGraph.svelte";
|
|
import GraphRangeRadios from "./GraphRangeRadios.svelte";
|
|
|
|
export let sourceData: pb.BackendProto.GraphsOut | null = null;
|
|
export let i18n: I18n;
|
|
|
|
let graphData = null as GraphData | null;
|
|
let histogramData = null as HistogramData | null;
|
|
let backlog: boolean = true;
|
|
let graphRange: GraphRange = GraphRange.Month;
|
|
|
|
$: if (sourceData) {
|
|
graphData = gatherData(sourceData);
|
|
}
|
|
|
|
$: if (graphData) {
|
|
histogramData = buildHistogram(graphData, graphRange, backlog, i18n);
|
|
}
|
|
|
|
const title = i18n.tr(i18n.TR.STATISTICS_FUTURE_DUE_TITLE);
|
|
const subtitle = i18n.tr(i18n.TR.STATISTICS_FUTURE_DUE_SUBTITLE);
|
|
const backlogLabel = i18n.tr(i18n.TR.STATISTICS_BACKLOG_CHECKBOX);
|
|
</script>
|
|
|
|
<div class="graph" id="graph-future-due">
|
|
<h1>{title}</h1>
|
|
|
|
<div class="range-box-inner">
|
|
<label>
|
|
<input type="checkbox" bind:checked={backlog} />
|
|
{backlogLabel}
|
|
</label>
|
|
|
|
<GraphRangeRadios bind:graphRange {i18n} revlogRange={RevlogRange.All} />
|
|
</div>
|
|
|
|
<div class="subtitle">{subtitle}</div>
|
|
|
|
<HistogramGraph data={histogramData} {i18n} />
|
|
|
|
</div>
|