mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00

* Add gradient color for forgetting curve * Add desiredRetention prop for CardInfo * update CONTRIBUTORS * Formatting * Tweak range of gradient * Tweak: salmon -> tomato * Get desired retention of the card from backend * Add a reference line for desired retention * Fix: Corrected the steel blue's height & Hide desired retention line when yMin is higher than desiredRetentionY * Add y axis title * Show desired retention in the tooltip * I18n: improve translation and vertical text display * Revert rotatation&writing-mode of vertical title * Tweak font-size of y axis title * Fix: delete old desired retention line when changing duration * Update ftl/core/card-stats.ftl --------- Co-authored-by: Damien Elmes <dae@users.noreply.github.com>
41 lines
1.3 KiB
Svelte
41 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;
|
|
export let fsrsEnabled: boolean = stats?.memoryState != null;
|
|
export let desiredRetention: number = 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>
|