mirror of
https://github.com/garraflavatra/rolens.git
synced 2025-01-18 21:17:59 +00:00
Copy collection stats as JSON
This commit is contained in:
parent
1a8cc2fe98
commit
b22734d6d1
@ -1,7 +1,17 @@
|
|||||||
<script>
|
<script>
|
||||||
|
import Icon from '$components/icon.svelte';
|
||||||
import ObjectGrid from '$components/objectgrid.svelte';
|
import ObjectGrid from '$components/objectgrid.svelte';
|
||||||
|
|
||||||
export let collection;
|
export let collection;
|
||||||
|
|
||||||
|
let copySucceeded = false;
|
||||||
|
|
||||||
|
async function copy() {
|
||||||
|
const json = JSON.stringify(collection.stats, undefined, '\t');
|
||||||
|
await navigator.clipboard.writeText(json);
|
||||||
|
copySucceeded = true;
|
||||||
|
setTimeout(() => copySucceeded = false, 1500);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="stats">
|
<div class="stats">
|
||||||
@ -10,13 +20,20 @@
|
|||||||
<div class="grid">
|
<div class="grid">
|
||||||
<ObjectGrid data={collection.stats} />
|
<ObjectGrid data={collection.stats} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="buttons">
|
||||||
|
<button class="btn secondary" on:click={copy}>
|
||||||
|
<Icon name={copySucceeded ? 'check' : 'clipboard'} />
|
||||||
|
Copy JSON
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.stats {
|
.stats {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
grid-template: auto / 1fr;
|
grid-template: 1fr auto / 1fr;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stats .grid {
|
.stats .grid {
|
||||||
|
Loading…
Reference in New Issue
Block a user