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";
|
2020-11-05 02:01:30 +01:00
|
|
|
import type { I18n } from "anki/i18n";
|
2020-06-22 11:11:50 +02:00
|
|
|
|
2021-03-21 22:35:53 +01:00
|
|
|
import WithGraphData from "./WithGraphData.svelte";
|
2021-03-22 01:07:15 +01:00
|
|
|
import BrowserSearch from "./BrowserSearch.svelte";
|
2021-03-21 22:35:53 +01:00
|
|
|
|
2020-06-27 11:24:49 +02:00
|
|
|
export let i18n: I18n;
|
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 01:07:15 +01:00
|
|
|
let query: string;
|
|
|
|
|
|
|
|
const activateBrowserSearch = (event: CustomEvent): void => {
|
|
|
|
query = event.detail.query;
|
2021-01-06 13:40:05 +01:00
|
|
|
};
|
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 00:04:24 +01:00
|
|
|
{initialSearch}
|
|
|
|
{initialDays}
|
|
|
|
let:search
|
|
|
|
let:days
|
2021-03-21 22:35:53 +01:00
|
|
|
let:loading
|
|
|
|
let:sourceData
|
|
|
|
let:preferences
|
|
|
|
let:revlogRange>
|
|
|
|
{#if controller}
|
2021-03-22 00:04:24 +01:00
|
|
|
<svelte:component this={controller} {i18n} {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}
|
|
|
|
{i18n}
|
|
|
|
{nightMode}
|
2021-03-22 01:07:15 +01:00
|
|
|
on:search={activateBrowserSearch} />
|
2021-03-21 22:35:53 +01:00
|
|
|
{/each}
|
|
|
|
{/if}
|
2021-03-22 01:07:15 +01:00
|
|
|
|
|
|
|
<BrowserSearch {search} {query} />
|
2021-03-21 22:35:53 +01:00
|
|
|
</WithGraphData>
|
2021-03-21 13:47:52 +01:00
|
|
|
</div>
|