2020-06-27 11:24:49 +02:00
|
|
|
// Copyright: Ankitects Pty Ltd and contributors
|
|
|
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
|
2022-02-04 09:36:34 +01:00
|
|
|
import "./graphs-base.css";
|
|
|
|
|
2022-01-16 06:05:35 +01:00
|
|
|
import type { SvelteComponentDev } from "svelte/internal";
|
2020-12-26 14:40:55 +01:00
|
|
|
|
2022-02-04 09:36:34 +01:00
|
|
|
import { ModuleName, setupI18n } from "../lib/i18n";
|
|
|
|
import { checkNightMode } from "../lib/nightmode";
|
2021-03-21 13:47:52 +01:00
|
|
|
import GraphsPage from "./GraphsPage.svelte";
|
2022-01-16 06:05:35 +01:00
|
|
|
|
|
|
|
const i18n = setupI18n({ modules: [ModuleName.STATISTICS, ModuleName.SCHEDULING] });
|
2021-03-21 13:47:52 +01:00
|
|
|
|
2022-01-16 06:05:35 +01:00
|
|
|
export async function setupGraphs(
|
|
|
|
graphs: typeof SvelteComponentDev[],
|
2021-03-21 13:47:52 +01:00
|
|
|
{
|
|
|
|
search = "deck:current",
|
|
|
|
days = 365,
|
2022-01-16 06:05:35 +01:00
|
|
|
controller = null as typeof SvelteComponentDev | null,
|
2021-10-19 01:06:00 +02:00
|
|
|
} = {},
|
2022-01-16 06:05:35 +01:00
|
|
|
): Promise<GraphsPage> {
|
2021-11-24 22:17:41 +01:00
|
|
|
checkNightMode();
|
2022-01-16 06:05:35 +01:00
|
|
|
await i18n;
|
|
|
|
|
|
|
|
return new GraphsPage({
|
|
|
|
target: document.body,
|
|
|
|
props: {
|
|
|
|
initialSearch: search,
|
|
|
|
initialDays: days,
|
|
|
|
graphs,
|
|
|
|
controller,
|
|
|
|
},
|
2020-06-27 11:24:49 +02:00
|
|
|
});
|
|
|
|
}
|
2022-01-16 06:05:35 +01:00
|
|
|
|
2022-02-04 09:36:34 +01:00
|
|
|
import AddedGraph from "./AddedGraph.svelte";
|
|
|
|
import ButtonsGraph from "./ButtonsGraph.svelte";
|
2022-01-16 06:05:35 +01:00
|
|
|
import CalendarGraph from "./CalendarGraph.svelte";
|
|
|
|
import CardCounts from "./CardCounts.svelte";
|
|
|
|
import EaseGraph from "./EaseGraph.svelte";
|
2022-02-04 09:36:34 +01:00
|
|
|
import FutureDue from "./FutureDue.svelte";
|
2022-01-16 06:05:35 +01:00
|
|
|
import { RevlogRange } from "./graph-helpers";
|
2022-02-04 09:36:34 +01:00
|
|
|
import HourGraph from "./HourGraph.svelte";
|
|
|
|
import IntervalsGraph from "./IntervalsGraph.svelte";
|
2022-01-16 06:05:35 +01:00
|
|
|
import RangeBox from "./RangeBox.svelte";
|
2022-02-04 09:36:34 +01:00
|
|
|
import ReviewsGraph from "./ReviewsGraph.svelte";
|
|
|
|
import TodayStats from "./TodayStats.svelte";
|
2022-01-16 06:05:35 +01:00
|
|
|
|
|
|
|
setupGraphs(
|
|
|
|
[
|
|
|
|
TodayStats,
|
|
|
|
FutureDue,
|
|
|
|
CalendarGraph,
|
|
|
|
ReviewsGraph,
|
|
|
|
CardCounts,
|
|
|
|
IntervalsGraph,
|
|
|
|
EaseGraph,
|
|
|
|
HourGraph,
|
|
|
|
ButtonsGraph,
|
|
|
|
AddedGraph,
|
|
|
|
],
|
|
|
|
{
|
|
|
|
controller: RangeBox,
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
export const graphComponents = {
|
|
|
|
TodayStats,
|
|
|
|
FutureDue,
|
|
|
|
CalendarGraph,
|
|
|
|
ReviewsGraph,
|
|
|
|
CardCounts,
|
|
|
|
IntervalsGraph,
|
|
|
|
EaseGraph,
|
|
|
|
HourGraph,
|
|
|
|
ButtonsGraph,
|
|
|
|
AddedGraph,
|
|
|
|
RangeBox,
|
|
|
|
RevlogRange,
|
|
|
|
};
|