2023-09-28 23:50:27 +02:00
|
|
|
<script lang="ts">
|
|
|
|
/**
|
|
|
|
* Shows information about how much images are uploaded for the given feature
|
|
|
|
*/
|
2023-09-25 02:11:42 +02:00
|
|
|
|
2023-09-28 23:50:27 +02:00
|
|
|
import type { SpecialVisualizationState } from "../SpecialVisualization"
|
|
|
|
import { Store } from "../../Logic/UIEventSource"
|
|
|
|
import type { OsmTags } from "../../Models/OsmFeature"
|
|
|
|
import Translations from "../i18n/Translations"
|
|
|
|
import Tr from "../Base/Tr.svelte"
|
|
|
|
import Loading from "../Base/Loading.svelte"
|
2023-09-25 02:11:42 +02:00
|
|
|
|
2023-09-28 23:50:27 +02:00
|
|
|
export let state: SpecialVisualizationState
|
|
|
|
export let tags: Store<OsmTags>
|
|
|
|
const featureId = tags.data.id
|
|
|
|
const { uploadStarted, uploadFinished, retried, failed } =
|
|
|
|
state.imageUploadManager.getCountsFor(featureId)
|
|
|
|
const t = Translations.t.image
|
2023-09-25 02:11:42 +02:00
|
|
|
</script>
|
|
|
|
|
2023-09-25 02:13:24 +02:00
|
|
|
{#if $uploadStarted == 1}
|
2023-09-28 23:50:27 +02:00
|
|
|
{#if $uploadFinished == 1}
|
2023-09-25 02:13:24 +02:00
|
|
|
<Tr cls="thanks" t={t.upload.one.done} />
|
|
|
|
{:else if $failed == 1}
|
2023-09-28 23:50:27 +02:00
|
|
|
<div class="alert flex flex-col">
|
2023-09-25 02:13:24 +02:00
|
|
|
<Tr cls="self-center" t={t.upload.one.failed} />
|
|
|
|
<Tr t={t.upload.failReasons} />
|
|
|
|
<Tr t={t.upload.failReasonsAdvanced} />
|
|
|
|
</div>
|
|
|
|
{:else if $retried == 1}
|
|
|
|
<Loading cls="alert">
|
|
|
|
<Tr t={t.upload.one.retrying} />
|
|
|
|
</Loading>
|
2023-09-28 23:50:27 +02:00
|
|
|
{:else}
|
2023-09-25 02:13:24 +02:00
|
|
|
<Loading cls="alert">
|
|
|
|
<Tr t={t.upload.one.uploading} />
|
|
|
|
</Loading>
|
|
|
|
{/if}
|
|
|
|
{:else if $uploadStarted > 1}
|
2023-09-28 23:50:27 +02:00
|
|
|
{#if $uploadFinished + $failed == $uploadStarted && $uploadFinished > 0}
|
|
|
|
<Tr cls="thanks" t={t.upload.multiple.done.Subs({ count: $uploadFinished })} />
|
2023-09-25 02:13:24 +02:00
|
|
|
{:else if $uploadFinished == 0}
|
|
|
|
<Loading cls="alert">
|
2023-09-28 23:50:27 +02:00
|
|
|
<Tr t={t.upload.multiple.uploading.Subs({ count: $uploadStarted })} />
|
2023-09-25 02:13:24 +02:00
|
|
|
</Loading>
|
|
|
|
{:else if $uploadFinished > 0}
|
|
|
|
<Loading cls="alert">
|
2023-09-28 23:50:27 +02:00
|
|
|
<Tr
|
|
|
|
t={t.upload.multiple.partiallyDone.Subs({
|
|
|
|
count: $uploadStarted - $uploadFinished,
|
|
|
|
done: $uploadFinished,
|
|
|
|
})}
|
|
|
|
/>
|
2023-09-25 02:13:24 +02:00
|
|
|
</Loading>
|
|
|
|
{/if}
|
|
|
|
{#if $failed > 0}
|
2023-09-28 23:50:27 +02:00
|
|
|
<div class="alert flex flex-col">
|
2023-09-25 02:13:24 +02:00
|
|
|
{#if failed === 1}
|
|
|
|
<Tr cls="self-center" t={t.upload.one.failed} />
|
|
|
|
{:else}
|
2023-09-28 23:50:27 +02:00
|
|
|
<Tr cls="self-center" t={t.upload.multiple.someFailed.Subs({ count: $failed })} />
|
2023-09-25 02:13:24 +02:00
|
|
|
{/if}
|
|
|
|
<Tr t={t.upload.failReasons} />
|
|
|
|
<Tr t={t.upload.failReasonsAdvanced} />
|
|
|
|
</div>
|
|
|
|
{/if}
|
|
|
|
{/if}
|