Add the ability to hide the forgetting curve from card info

This commit is contained in:
Damien Elmes 2025-05-05 17:03:57 +10:00
parent bcb28f0a85
commit c70e9d26c5
2 changed files with 5 additions and 3 deletions

View file

@ -15,6 +15,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
export let stats: CardStatsResponse | null = null; export let stats: CardStatsResponse | null = null;
export let showRevlog: boolean = true; export let showRevlog: boolean = true;
export let showCurve: boolean = true;
$: fsrsEnabled = stats?.memoryState != null; $: fsrsEnabled = stats?.memoryState != null;
$: desiredRetention = stats?.desiredRetention ?? 0.9; $: desiredRetention = stats?.desiredRetention ?? 0.9;
@ -41,7 +42,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
<Revlog revlog={stats.revlog} {fsrsEnabled} /> <Revlog revlog={stats.revlog} {fsrsEnabled} />
</Row> </Row>
{/if} {/if}
{#if fsrsEnabled} {#if fsrsEnabled && showCurve}
<Row> <Row>
<ForgettingCurve revlog={stats.revlog} {desiredRetention} {decay} /> <ForgettingCurve revlog={stats.revlog} {desiredRetention} {decay} />
</Row> </Row>

View file

@ -12,6 +12,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
export let data: PageData; export let data: PageData;
const showRevlog = $page.url.searchParams.get("revlog") !== "0"; const showRevlog = $page.url.searchParams.get("revlog") !== "0";
const showCurve = $page.url.searchParams.get("curve") !== "0";
globalThis.anki ||= {}; globalThis.anki ||= {};
globalThis.anki.updateCardInfos = async (card_id: string): Promise<void> => { globalThis.anki.updateCardInfos = async (card_id: string): Promise<void> => {
@ -25,11 +26,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
<center> <center>
{#if data.currentInfo} {#if data.currentInfo}
<h3>Current</h3> <h3>Current</h3>
<CardInfo stats={data.currentInfo} {showRevlog} /> <CardInfo stats={data.currentInfo} {showRevlog} {showCurve} />
{/if} {/if}
{#if data.previousInfo} {#if data.previousInfo}
<h3>Previous</h3> <h3>Previous</h3>
<CardInfo stats={data.previousInfo} {showRevlog} /> <CardInfo stats={data.previousInfo} {showRevlog} {showCurve} />
{/if} {/if}
</center> </center>