forked from MapComplete/MapComplete
		
	Chore: formatting
This commit is contained in:
		
							parent
							
								
									8ef9b48e2b
								
							
						
					
					
						commit
						8a3f7a012d
					
				
					 97 changed files with 3350 additions and 2136 deletions
				
			
		| 
						 | 
				
			
			@ -1,63 +1,63 @@
 | 
			
		|||
<script lang="ts">/**
 | 
			
		||||
 * Shows an 'upload'-button which will start the upload for this feature
 | 
			
		||||
 */
 | 
			
		||||
<script lang="ts">
 | 
			
		||||
  /**
 | 
			
		||||
   * Shows an 'upload'-button which will start the upload for this feature
 | 
			
		||||
   */
 | 
			
		||||
 | 
			
		||||
import type { SpecialVisualizationState } from "../SpecialVisualization";
 | 
			
		||||
import { Store } from "../../Logic/UIEventSource";
 | 
			
		||||
import type { OsmTags } from "../../Models/OsmFeature";
 | 
			
		||||
import LoginToggle from "../Base/LoginToggle.svelte";
 | 
			
		||||
import Translations from "../i18n/Translations";
 | 
			
		||||
import Tr from "../Base/Tr.svelte";
 | 
			
		||||
import UploadingImageCounter from "./UploadingImageCounter.svelte";
 | 
			
		||||
import FileSelector from "../Base/FileSelector.svelte";
 | 
			
		||||
import ToSvelte from "../Base/ToSvelte.svelte";
 | 
			
		||||
import Svg from "../../Svg";
 | 
			
		||||
  import type { SpecialVisualizationState } from "../SpecialVisualization"
 | 
			
		||||
  import { Store } from "../../Logic/UIEventSource"
 | 
			
		||||
  import type { OsmTags } from "../../Models/OsmFeature"
 | 
			
		||||
  import LoginToggle from "../Base/LoginToggle.svelte"
 | 
			
		||||
  import Translations from "../i18n/Translations"
 | 
			
		||||
  import Tr from "../Base/Tr.svelte"
 | 
			
		||||
  import UploadingImageCounter from "./UploadingImageCounter.svelte"
 | 
			
		||||
  import FileSelector from "../Base/FileSelector.svelte"
 | 
			
		||||
  import ToSvelte from "../Base/ToSvelte.svelte"
 | 
			
		||||
  import Svg from "../../Svg"
 | 
			
		||||
 | 
			
		||||
export let state: SpecialVisualizationState;
 | 
			
		||||
  export let state: SpecialVisualizationState
 | 
			
		||||
 | 
			
		||||
export let tags: Store<OsmTags>;
 | 
			
		||||
/**
 | 
			
		||||
 * Image to show in the button
 | 
			
		||||
 * NOT the image to upload!
 | 
			
		||||
 */
 | 
			
		||||
export let image: string = undefined;
 | 
			
		||||
if (image === "") {
 | 
			
		||||
  image = undefined;
 | 
			
		||||
}
 | 
			
		||||
export let labelText: string = undefined;
 | 
			
		||||
const t = Translations.t.image;
 | 
			
		||||
  export let tags: Store<OsmTags>
 | 
			
		||||
  /**
 | 
			
		||||
   * Image to show in the button
 | 
			
		||||
   * NOT the image to upload!
 | 
			
		||||
   */
 | 
			
		||||
  export let image: string = undefined
 | 
			
		||||
  if (image === "") {
 | 
			
		||||
    image = undefined
 | 
			
		||||
  }
 | 
			
		||||
  export let labelText: string = undefined
 | 
			
		||||
  const t = Translations.t.image
 | 
			
		||||
 | 
			
		||||
let licenseStore = state.userRelatedState.imageLicense;
 | 
			
		||||
  let licenseStore = state.userRelatedState.imageLicense
 | 
			
		||||
 | 
			
		||||
function handleFiles(files: FileList) {
 | 
			
		||||
  for (let i = 0; i < files.length; i++) {
 | 
			
		||||
    const file = files.item(i);
 | 
			
		||||
    console.log("Got file", file.name)
 | 
			
		||||
    try {
 | 
			
		||||
      state.imageUploadManager.uploadImageAndApply(file, tags);
 | 
			
		||||
    } catch (e) {
 | 
			
		||||
      alert(e);
 | 
			
		||||
  function handleFiles(files: FileList) {
 | 
			
		||||
    for (let i = 0; i < files.length; i++) {
 | 
			
		||||
      const file = files.item(i)
 | 
			
		||||
      console.log("Got file", file.name)
 | 
			
		||||
      try {
 | 
			
		||||
        state.imageUploadManager.uploadImageAndApply(file, tags)
 | 
			
		||||
      } catch (e) {
 | 
			
		||||
        alert(e)
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<LoginToggle {state}>
 | 
			
		||||
 | 
			
		||||
  <Tr slot="not-logged-in" t={t.pleaseLogin} />
 | 
			
		||||
  <div class="flex flex-col">
 | 
			
		||||
 | 
			
		||||
    <UploadingImageCounter {state} {tags} />
 | 
			
		||||
    <FileSelector accept="image/*" cls="button border-2 text-2xl" multiple={true}
 | 
			
		||||
                  on:submit={e => handleFiles(e.detail)}>
 | 
			
		||||
    <FileSelector
 | 
			
		||||
      accept="image/*"
 | 
			
		||||
      cls="button border-2 text-2xl"
 | 
			
		||||
      multiple={true}
 | 
			
		||||
      on:submit={(e) => handleFiles(e.detail)}
 | 
			
		||||
    >
 | 
			
		||||
      <div class="flex items-center">
 | 
			
		||||
 | 
			
		||||
        {#if image !== undefined}
 | 
			
		||||
          <img src={image} />
 | 
			
		||||
        {:else}
 | 
			
		||||
          <ToSvelte construct={ Svg.camera_plus_svg().SetClass("block w-12 h-12 p-1 text-4xl ")} />
 | 
			
		||||
          <ToSvelte construct={Svg.camera_plus_svg().SetClass("block w-12 h-12 p-1 text-4xl ")} />
 | 
			
		||||
        {/if}
 | 
			
		||||
        {#if labelText}
 | 
			
		||||
          {labelText}
 | 
			
		||||
| 
						 | 
				
			
			@ -68,10 +68,14 @@ function handleFiles(files: FileList) {
 | 
			
		|||
    </FileSelector>
 | 
			
		||||
    <div class="text-sm">
 | 
			
		||||
      <Tr t={t.respectPrivacy} />
 | 
			
		||||
      <a class="cursor-pointer" on:click={() => {state.guistate.openUsersettings("picture-license")}}>
 | 
			
		||||
        <Tr t={t.currentLicense.Subs({license: $licenseStore})} />
 | 
			
		||||
      <a
 | 
			
		||||
        class="cursor-pointer"
 | 
			
		||||
        on:click={() => {
 | 
			
		||||
          state.guistate.openUsersettings("picture-license")
 | 
			
		||||
        }}
 | 
			
		||||
      >
 | 
			
		||||
        <Tr t={t.currentLicense.Subs({ license: $licenseStore })} />
 | 
			
		||||
      </a>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
</LoginToggle>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,32 +1,28 @@
 | 
			
		|||
<script lang="ts">/**
 | 
			
		||||
 * Shows information about how much images are uploaded for the given feature
 | 
			
		||||
 */
 | 
			
		||||
<script lang="ts">
 | 
			
		||||
  /**
 | 
			
		||||
   * Shows information about how much images are uploaded for the given feature
 | 
			
		||||
   */
 | 
			
		||||
 | 
			
		||||
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";
 | 
			
		||||
 | 
			
		||||
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;
 | 
			
		||||
  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"
 | 
			
		||||
 | 
			
		||||
  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
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
{#if $uploadStarted == 1}
 | 
			
		||||
  {#if $uploadFinished == 1 }
 | 
			
		||||
  {#if $uploadFinished == 1}
 | 
			
		||||
    <Tr cls="thanks" t={t.upload.one.done} />
 | 
			
		||||
  {:else if $failed == 1}
 | 
			
		||||
    <div class="flex flex-col alert">
 | 
			
		||||
    <div class="alert flex flex-col">
 | 
			
		||||
      <Tr cls="self-center" t={t.upload.one.failed} />
 | 
			
		||||
      <Tr t={t.upload.failReasons} />
 | 
			
		||||
      <Tr t={t.upload.failReasonsAdvanced} />
 | 
			
		||||
| 
						 | 
				
			
			@ -35,30 +31,34 @@ const t = Translations.t.image;
 | 
			
		|||
    <Loading cls="alert">
 | 
			
		||||
      <Tr t={t.upload.one.retrying} />
 | 
			
		||||
    </Loading>
 | 
			
		||||
  {:else }
 | 
			
		||||
  {:else}
 | 
			
		||||
    <Loading cls="alert">
 | 
			
		||||
      <Tr t={t.upload.one.uploading} />
 | 
			
		||||
    </Loading>
 | 
			
		||||
  {/if}
 | 
			
		||||
{:else if $uploadStarted > 1}
 | 
			
		||||
  {#if ($uploadFinished + $failed) == $uploadStarted && $uploadFinished > 0}
 | 
			
		||||
    <Tr cls="thanks" t={t.upload.multiple.done.Subs({count: $uploadFinished})} />
 | 
			
		||||
  {#if $uploadFinished + $failed == $uploadStarted && $uploadFinished > 0}
 | 
			
		||||
    <Tr cls="thanks" t={t.upload.multiple.done.Subs({ count: $uploadFinished })} />
 | 
			
		||||
  {:else if $uploadFinished == 0}
 | 
			
		||||
    <Loading cls="alert">
 | 
			
		||||
      <Tr t={t.upload.multiple.uploading.Subs({count: $uploadStarted})} />
 | 
			
		||||
      <Tr t={t.upload.multiple.uploading.Subs({ count: $uploadStarted })} />
 | 
			
		||||
    </Loading>
 | 
			
		||||
  {:else if $uploadFinished > 0}
 | 
			
		||||
    <Loading cls="alert">
 | 
			
		||||
      <Tr t={t.upload.multiple.partiallyDone.Subs({count: $uploadStarted -  $uploadFinished, done: $uploadFinished})} />
 | 
			
		||||
      <Tr
 | 
			
		||||
        t={t.upload.multiple.partiallyDone.Subs({
 | 
			
		||||
          count: $uploadStarted - $uploadFinished,
 | 
			
		||||
          done: $uploadFinished,
 | 
			
		||||
        })}
 | 
			
		||||
      />
 | 
			
		||||
    </Loading>
 | 
			
		||||
  {/if}
 | 
			
		||||
  {#if $failed > 0}
 | 
			
		||||
    <div class="flex flex-col alert">
 | 
			
		||||
    <div class="alert flex flex-col">
 | 
			
		||||
      {#if failed === 1}
 | 
			
		||||
        <Tr cls="self-center" t={t.upload.one.failed} />
 | 
			
		||||
      {:else}
 | 
			
		||||
        <Tr cls="self-center" t={t.upload.multiple.someFailed.Subs({count: $failed})} />
 | 
			
		||||
 | 
			
		||||
        <Tr cls="self-center" t={t.upload.multiple.someFailed.Subs({ count: $failed })} />
 | 
			
		||||
      {/if}
 | 
			
		||||
      <Tr t={t.upload.failReasons} />
 | 
			
		||||
      <Tr t={t.upload.failReasonsAdvanced} />
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue