anki/ts/graphs/index.ts
Henrik Giesel 30bbbaf00b
Use eslint for sorting our imports (#1637)
* Make eslint sort our imports

* fix missing deps in eslint rule (dae)

Caught on Linux due to the stricter sandboxing

* Remove exports-last eslint rule (for now?)

* Adjust browserslist settings

- We use ResizeObserver which is not supported in browsers like KaiOS,
  Baidu or Android UC

* Raise minimum iOS version 13.4

- It's the first version that supports ResizeObserver

* Apply new eslint rules to sort imports
2022-02-04 18:36:34 +10:00

81 lines
2.0 KiB
TypeScript

// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import "./graphs-base.css";
import type { SvelteComponentDev } from "svelte/internal";
import { ModuleName, setupI18n } from "../lib/i18n";
import { checkNightMode } from "../lib/nightmode";
import GraphsPage from "./GraphsPage.svelte";
const i18n = setupI18n({ modules: [ModuleName.STATISTICS, ModuleName.SCHEDULING] });
export async function setupGraphs(
graphs: typeof SvelteComponentDev[],
{
search = "deck:current",
days = 365,
controller = null as typeof SvelteComponentDev | null,
} = {},
): Promise<GraphsPage> {
checkNightMode();
await i18n;
return new GraphsPage({
target: document.body,
props: {
initialSearch: search,
initialDays: days,
graphs,
controller,
},
});
}
import AddedGraph from "./AddedGraph.svelte";
import ButtonsGraph from "./ButtonsGraph.svelte";
import CalendarGraph from "./CalendarGraph.svelte";
import CardCounts from "./CardCounts.svelte";
import EaseGraph from "./EaseGraph.svelte";
import FutureDue from "./FutureDue.svelte";
import { RevlogRange } from "./graph-helpers";
import HourGraph from "./HourGraph.svelte";
import IntervalsGraph from "./IntervalsGraph.svelte";
import RangeBox from "./RangeBox.svelte";
import ReviewsGraph from "./ReviewsGraph.svelte";
import TodayStats from "./TodayStats.svelte";
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,
};