mirror of
https://github.com/ankitects/anki.git
synced 2025-09-22 16:02:23 -04:00

* Add _bytes methods for all methods in the backend Expose get_note in qt/aqt/mediasrv.py * Satisfy formatter * Rename _bytes function to _raw and have them bytes as input * Fix backend generation * Use lib/proto/deckOptions in deck-options * Add exposed_backend to qt/aqt/mediasrv.py * Move some more backend methods to exposed_backend_list * Use protobufjs for congrats and i18n * Use protobufjs for completeTag * Use protobufjs services in change-notetype * Reorder post handlers in alphabetical manner * Satisfy tests * Remove unused collection methods * Rename access_backend to raw_backend_request * Use _vendor.stringcase instead of creating a new function * Remove SKIP_UNROLL_OUTPUT * Directly call _run_command in non _raw methods * Remove TranslateString, ChangeNotetype and CompleteTag from SKIP_UNROLL_INPUT * Remove UpdateDeckConfigs from SKIP_UNROLL_INPUT * Remove ChangeNotetype from SKIP_UNROLL_INPUT * Remove SKIP_UNROLL_INPUT * Fix typing issue with translate_string - Adds typing support for Protobuf maps in genbackend.py * Do not emit convenience method for protobuf TranslateString
56 lines
1.6 KiB
Svelte
56 lines
1.6 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 { Stats } from "../lib/proto";
|
|
import { stats as statsService } from "../lib/proto";
|
|
import Container from "../components/Container.svelte";
|
|
import Row from "../components/Row.svelte";
|
|
import CardStats from "./CardStats.svelte";
|
|
import CardInfoPlaceholder from "./CardInfoPlaceholder.svelte";
|
|
import Revlog from "./Revlog.svelte";
|
|
|
|
export let cardId: number | null = null;
|
|
export let includeRevlog: boolean = true;
|
|
|
|
let stats: Stats.CardStatsResponse | null = null;
|
|
let revlog: Stats.CardStatsResponse.StatsRevlogEntry[] | null = null;
|
|
|
|
async function updateStats(cardId: number): Promise<void> {
|
|
const requestedCardId = cardId;
|
|
const cardStats = await statsService.cardStats({ cid: requestedCardId });
|
|
|
|
/* Skip if another update has been triggered in the meantime. */
|
|
if (requestedCardId === cardId) {
|
|
stats = cardStats;
|
|
|
|
if (includeRevlog) {
|
|
revlog = stats.revlog as Stats.CardStatsResponse.StatsRevlogEntry[];
|
|
}
|
|
}
|
|
}
|
|
|
|
$: if (cardId) {
|
|
updateStats(cardId);
|
|
} else {
|
|
stats = null;
|
|
revlog = null;
|
|
}
|
|
</script>
|
|
|
|
<Container breakpoint="md" --gutter-inline="1rem" --gutter-block="0.5rem">
|
|
{#if stats}
|
|
<Row>
|
|
<CardStats {stats} />
|
|
</Row>
|
|
|
|
{#if revlog}
|
|
<Row>
|
|
<Revlog {revlog} />
|
|
</Row>
|
|
{/if}
|
|
{:else}
|
|
<CardInfoPlaceholder />
|
|
{/if}
|
|
</Container>
|