Bubble up days and search to caller

This commit is contained in:
Henrik Giesel 2020-12-22 22:25:47 +01:00
parent 008940026e
commit 5d117cf1a0
2 changed files with 12 additions and 3 deletions

View File

@ -11,6 +11,9 @@
export let nightMode: boolean;
export let graphs: any[];
export let search: string;
export let days: number;
let sourceData: pb.BackendProto.GraphsOut | null = null;
enum SearchRange {
@ -21,10 +24,8 @@
let searchRange: SearchRange = SearchRange.Deck;
let revlogRange: RevlogRange = RevlogRange.Year;
let days: number = 31;
let refreshing = false;
let search = "deck:current";
let displayedSearch = search;
const refresh = async () => {

View File

@ -16,7 +16,13 @@ export { default as FutureDue } from "./FutureDue.svelte";
export { default as ReviewsGraph } from "./ReviewsGraph.svelte";
export { default as CalendarGraph } from "./CalendarGraph.svelte";
export function graphs(target: HTMLDivElement, graphs: any[]): void {
export function graphs(
target: HTMLDivElement,
graphs: any[], {
search = "deck:current",
days = 31,
} = {},
): void {
const nightMode = checkNightMode();
setupI18n().then((i18n) => {
@ -26,6 +32,8 @@ export function graphs(target: HTMLDivElement, graphs: any[]): void {
i18n,
graphs,
nightMode,
search,
days,
},
});
});