mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00

* Update TrueRetention.svelte adding description * Update statistics.ftl to add additional info * Swap TR with DR * Change string to 'Is expected to' * Add help modal to TR table * Add tooltip slot to Graph.svelte (thanks @Luc-Mcgrady) * Fix lint warning and failing test * Remove unused code * removedd on:mount to make eslint happy * ADD back on:mount * ADD back code needed for on:mount * REMOVE openHelpModal() as I couldn't figure out how to make the title clickable * attempt to ADD clickable title (BROKEN\!) * Update ts/lib/components/TitledContainer.svelte Co-authored-by: Luc Mcgrady <lucmcgrady@gmail.com> * Update ts/routes/graphs/Graph.svelte Co-authored-by: Luc Mcgrady <lucmcgrady@gmail.com> * Update ts/routes/graphs/TrueRetention.svelte Co-authored-by: Luc Mcgrady <lucmcgrady@gmail.com> * ADD exported onTitleClick as @Luc-Mcgrady suggested * REMOVE vite.config.ts file --------- Co-authored-by: Luc Mcgrady <lucmcgrady@gmail.com>
79 lines
2.3 KiB
Svelte
79 lines
2.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 TitledContainer from "$lib/components/TitledContainer.svelte";
|
|
|
|
// When title is null (default), the graph is inlined, not having TitledContainer wrapper.
|
|
export let title: string | null = null;
|
|
export let subtitle: string | null = null;
|
|
export let onTitleClick: ((_e: MouseEvent | KeyboardEvent) => void) | null = null;
|
|
</script>
|
|
|
|
{#if title == null}
|
|
<div class="graph d-flex flex-grow-1 flex-column justify-content-center">
|
|
{#if subtitle}
|
|
<div class="subtitle">{subtitle}</div>
|
|
{/if}
|
|
<slot />
|
|
</div>
|
|
{:else}
|
|
<TitledContainer class="d-flex flex-column" {title} {onTitleClick}>
|
|
<slot slot="tooltip" name="tooltip"></slot>
|
|
<div class="graph d-flex flex-grow-1 flex-column justify-content-center">
|
|
{#if subtitle}
|
|
<div class="subtitle">{subtitle}</div>
|
|
{/if}
|
|
<slot />
|
|
</div>
|
|
</TitledContainer>
|
|
{/if}
|
|
|
|
<style lang="scss">
|
|
@use "$lib/sass/elevation" as *;
|
|
.graph {
|
|
/* See graph-styles.ts for constants referencing global styles */
|
|
:global(.graph-element-clickable) {
|
|
cursor: pointer;
|
|
}
|
|
|
|
/* Customizing the standard x and y tick markers and text on the graphs.
|
|
* The `tick` class is automatically added by d3. */
|
|
:global(.tick) {
|
|
:global(line) {
|
|
opacity: 0.1;
|
|
}
|
|
|
|
:global(text) {
|
|
opacity: 0.5;
|
|
font-size: 10px;
|
|
|
|
@media only screen and (max-width: 800px) {
|
|
font-size: 13px;
|
|
}
|
|
|
|
@media only screen and (max-width: 600px) {
|
|
font-size: 16px;
|
|
}
|
|
}
|
|
}
|
|
|
|
:global(.tick-odd) {
|
|
@media only screen and (max-width: 600px) {
|
|
/* on small screens, hide every second row on graphs that have
|
|
* marked the ticks as odd */
|
|
display: none;
|
|
}
|
|
}
|
|
|
|
&:focus {
|
|
outline: 0;
|
|
}
|
|
}
|
|
|
|
.subtitle {
|
|
text-align: center;
|
|
margin-bottom: 1em;
|
|
}
|
|
</style>
|