Refactoring: port "statisticsGUI" to svelte

This commit is contained in:
Pieter Vander Vennet 2024-11-17 02:03:16 +01:00
parent f807f43399
commit dc10a3fe56
8 changed files with 334 additions and 389 deletions

View file

@ -0,0 +1,30 @@
<script lang="ts">
import { UIEventSource } from "../../Logic/UIEventSource"
import { Utils } from "../../Utils"
import Loading from "../Base/Loading.svelte"
import AllStats from "./AllStats.svelte"
let homeUrl =
"https://raw.githubusercontent.com/pietervdvn/MapComplete-data/main/changeset-metadata/"
let stats_files = "file-overview.json"
let indexFile = UIEventSource.FromPromise(
Utils.downloadJson<string[]>(homeUrl + stats_files)
)
</script>
<div class="m-4">
<div class="flex justify-between">
<h2>Statistics of changes made with MapComplete</h2>
<a href="/" class="button">Back to index</a>
</div>
{#if $indexFile === undefined}
<Loading>Loading index file...</Loading>
{:else}
<AllStats paths={$indexFile.filter(p => p.startsWith("stats")).map(p => homeUrl+"/"+p)} />
{/if}
</div>