mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00

* Replace window.location in CardInfoDialog with load_sveltekit_page * Fix format * Fix ForgettingCurve's reactivity * Props' default args aren't reactive * Add global _updateCardId fn to card-info * Use _updateCardId to reactively update card-info * Fix format * Fix type * Use dummy form instead of window global for client-side nav * Fallback to window.location in case form hasn't been rendered * Use window.postMessage instead of dummy <form>
42 lines
1.3 KiB
Svelte
42 lines
1.3 KiB
Svelte
<!--
|
|
Copyright: Ankitects Pty Ltd and contributors
|
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
-->
|
|
<script lang="ts">
|
|
import type { CardStatsResponse } from "@generated/anki/stats_pb";
|
|
|
|
import Container from "$lib/components/Container.svelte";
|
|
import Row from "$lib/components/Row.svelte";
|
|
|
|
import CardInfoPlaceholder from "./CardInfoPlaceholder.svelte";
|
|
import CardStats from "./CardStats.svelte";
|
|
import Revlog from "./Revlog.svelte";
|
|
import ForgettingCurve from "./ForgettingCurve.svelte";
|
|
|
|
export let stats: CardStatsResponse | null = null;
|
|
export let showRevlog: boolean = true;
|
|
|
|
$: fsrsEnabled = stats?.memoryState != null;
|
|
$: desiredRetention = stats?.desiredRetention ?? 0.9;
|
|
</script>
|
|
|
|
<Container breakpoint="md" --gutter-inline="1rem" --gutter-block="0.5rem">
|
|
{#if stats}
|
|
<Row>
|
|
<CardStats {stats} />
|
|
</Row>
|
|
|
|
{#if showRevlog}
|
|
<Row>
|
|
<Revlog revlog={stats.revlog} {fsrsEnabled} />
|
|
</Row>
|
|
{/if}
|
|
{#if fsrsEnabled}
|
|
<Row>
|
|
<ForgettingCurve revlog={stats.revlog} {desiredRetention} />
|
|
</Row>
|
|
{/if}
|
|
{:else}
|
|
<CardInfoPlaceholder />
|
|
{/if}
|
|
</Container>
|