2df3698e8c
* Add thousands comma separator for card counts graph * Fix Answer Buttons graph's tooltip Changes to the "times pressed" heading * Shows the percent of that button out of all the presses * Comma separates total on thousands * Update CONTRIBUTERS * Wider spacing for graph tables * Switch to locale-based stats numbers * Update CONTRIBUTORS Wrong email? * Fix counts graph on narrow devices Graph and table now align in a column when the device's screen is narrow. Columns widths are bounded to not get too wide * Rename toLocaleXXX functions * toLocaleNumber -> localizedNumber * toLocaleString -> localizedDate Also cleans up sketchy "card counts" table formatting * Localize more numbers Uses locale-based rounding for more numbers now * Localize graph axis ticks * Fix future-due graph tooltip * avoid div by zero (dae) Ignoring NaN in localizedNumber() could potentially mask a mistake in the future - better to explicitly handle the invalid case at the source instead.
40 lines
802 B
Svelte
40 lines
802 B
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 { TableDatum } from "./graph-helpers";
|
|
import { direction } from "../lib/i18n";
|
|
export let tableData: TableDatum[];
|
|
</script>
|
|
|
|
<div>
|
|
<table dir={direction()}>
|
|
{#each tableData as { label, value }}
|
|
<tr>
|
|
<td class="align-end">{label}:</td>
|
|
<td class="align-start">{value}</td>
|
|
</tr>
|
|
{/each}
|
|
</table>
|
|
</div>
|
|
|
|
<style lang="scss">
|
|
div {
|
|
display: flex;
|
|
justify-content: center;
|
|
}
|
|
|
|
td {
|
|
padding: 3px;
|
|
}
|
|
|
|
.align-end {
|
|
text-align: end;
|
|
}
|
|
|
|
.align-start {
|
|
text-align: start;
|
|
}
|
|
</style>
|