mirror of
https://github.com/garraflavatra/rolens.git
synced 2025-01-18 13:07:58 +00:00
Copy collection stats as JSON
This commit is contained in:
parent
1a8cc2fe98
commit
b22734d6d1
@ -1,7 +1,17 @@
|
||||
<script>
|
||||
import Icon from '$components/icon.svelte';
|
||||
import ObjectGrid from '$components/objectgrid.svelte';
|
||||
|
||||
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>
|
||||
|
||||
<div class="stats">
|
||||
@ -10,13 +20,20 @@
|
||||
<div class="grid">
|
||||
<ObjectGrid data={collection.stats} />
|
||||
</div>
|
||||
|
||||
<div class="buttons">
|
||||
<button class="btn secondary" on:click={copy}>
|
||||
<Icon name={copySucceeded ? 'check' : 'clipboard'} />
|
||||
Copy JSON
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.stats {
|
||||
display: grid;
|
||||
gap: 0.5rem;
|
||||
grid-template: auto / 1fr;
|
||||
grid-template: 1fr auto / 1fr;
|
||||
}
|
||||
|
||||
.stats .grid {
|
||||
|
Loading…
Reference in New Issue
Block a user