Files
radicle-explorer/src/BlockTimer.svelte
T
Sebastian Martinez 286cb1cd21 Improve testing suite
Signed-off-by: Sebastian Martinez <sebastinez@me.com>
2022-03-24 15:05:15 +01:00

34 lines
783 B
Svelte

<script lang="ts">
import type { Config } from "@app/config";
export let config: Config;
export let startBlock: number;
export let duration: number;
let currentBlock: number = startBlock;
config.provider.on("block", (latestBlock: number) => {
if (startBlock + duration > currentBlock) currentBlock = latestBlock;
});
</script>
<style>
.parent {
text-align: center;
height: 0.5rem;
width: 100%;
border-radius: 0.25rem;
background-color: var(--color-secondary-background);
}
.loader {
height: 0.5rem;
width: 0px;
border-radius: 0.25rem;
background-color: var(--color-secondary);
}
</style>
<div class="parent">
<div class="loader" style="width: {(currentBlock - startBlock) * Math.floor(100 / duration)}%" />
</div>