2020-06-22 11:11:50 +02:00
|
|
|
<script lang="typescript">
|
2021-03-21 13:47:52 +01:00
|
|
|
import "../sass/core.css";
|
|
|
|
|
2020-12-27 02:04:45 +01:00
|
|
|
import type { SvelteComponent } from "svelte/internal";
|
2021-03-22 02:44:08 +01:00
|
|
|
import { writable } from "svelte/store";
|
2021-03-26 11:23:43 +01:00
|
|
|
|
2021-03-22 02:44:08 +01:00
|
|
|
import { bridgeCommand } from "anki/bridgecommand";
|
2020-06-22 11:11:50 +02:00
|
|
|
|
2021-03-21 22:35:53 +01:00
|
|
|
import WithGraphData from "./WithGraphData.svelte";
|
|
|
|
|
2020-06-30 08:23:46 +02:00
|
|
|
export let nightMode: boolean;
|
2020-12-26 14:40:55 +01:00
|
|
|
export let graphs: SvelteComponent[];
|
2020-06-27 11:24:49 +02:00
|
|
|
|
2021-03-22 00:04:24 +01:00
|
|
|
export let initialSearch: string;
|
|
|
|
export let initialDays: number;
|
2020-12-29 06:19:21 +01:00
|
|
|
export let controller: SvelteComponent | null;
|
2020-12-22 22:25:47 +01:00
|
|
|
|
2021-03-22 02:44:08 +01:00
|
|
|
const search = writable(initialSearch);
|
|
|
|
const days = writable(initialDays);
|
2021-03-22 01:07:15 +01:00
|
|
|
|
2021-03-22 02:44:08 +01:00
|
|
|
function browserSearch(event: CustomEvent) {
|
|
|
|
bridgeCommand(`browserSearch: ${$search} ${event.detail.query}`);
|
|
|
|
}
|
2020-06-22 11:11:50 +02:00
|
|
|
</script>
|
|
|
|
|
2021-03-21 13:47:52 +01:00
|
|
|
<style lang="scss">
|
2021-03-22 01:07:15 +01:00
|
|
|
div {
|
|
|
|
@media only screen and (max-width: 600px) {
|
2021-03-21 13:47:52 +01:00
|
|
|
font-size: 12px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
2021-03-22 01:07:15 +01:00
|
|
|
<div>
|
2021-03-21 22:35:53 +01:00
|
|
|
<WithGraphData
|
2021-03-22 02:44:08 +01:00
|
|
|
{search}
|
|
|
|
{days}
|
2021-03-21 22:35:53 +01:00
|
|
|
let:loading
|
|
|
|
let:sourceData
|
|
|
|
let:preferences
|
|
|
|
let:revlogRange>
|
|
|
|
{#if controller}
|
2021-03-26 11:23:43 +01:00
|
|
|
<svelte:component this={controller} {search} {days} {loading} />
|
2021-03-21 22:35:53 +01:00
|
|
|
{/if}
|
|
|
|
|
2021-03-22 00:40:19 +01:00
|
|
|
{#if sourceData && preferences && revlogRange}
|
2021-03-21 22:35:53 +01:00
|
|
|
{#each graphs as graph}
|
|
|
|
<svelte:component
|
|
|
|
this={graph}
|
|
|
|
{sourceData}
|
|
|
|
{preferences}
|
|
|
|
{revlogRange}
|
|
|
|
{nightMode}
|
2021-03-22 02:44:08 +01:00
|
|
|
on:search={browserSearch} />
|
2021-03-21 22:35:53 +01:00
|
|
|
{/each}
|
|
|
|
{/if}
|
|
|
|
</WithGraphData>
|
2021-03-21 13:47:52 +01:00
|
|
|
</div>
|