forked from MapComplete/MapComplete
		
	Chore: housekeeping: lint
This commit is contained in:
		
							parent
							
								
									2cbd709d71
								
							
						
					
					
						commit
						663b194247
					
				
					 334 changed files with 4675 additions and 1730 deletions
				
			
		|  | @ -1,30 +1,28 @@ | |||
| <script lang="ts"> | ||||
|   import { UIEventSource } from "../../Logic/UIEventSource"; | ||||
|   import { OsmConnection } from "../../Logic/Osm/OsmConnection"; | ||||
|   import Marker from "../Map/Marker.svelte"; | ||||
|   import NextButton from "../Base/NextButton.svelte"; | ||||
|   import { AllKnownLayouts } from "../../Customizations/AllKnownLayouts"; | ||||
|   import { AllSharedLayers } from "../../Customizations/AllSharedLayers"; | ||||
|   import { createEventDispatcher } from "svelte"; | ||||
|   import { UIEventSource } from "../../Logic/UIEventSource" | ||||
|   import { OsmConnection } from "../../Logic/Osm/OsmConnection" | ||||
|   import Marker from "../Map/Marker.svelte" | ||||
|   import NextButton from "../Base/NextButton.svelte" | ||||
|   import { AllKnownLayouts } from "../../Customizations/AllKnownLayouts" | ||||
|   import { AllSharedLayers } from "../../Customizations/AllSharedLayers" | ||||
|   import { createEventDispatcher } from "svelte" | ||||
| 
 | ||||
|   export let info: { id: string; owner: number }; | ||||
|   export let category: "layers" | "themes"; | ||||
|   export let osmConnection: OsmConnection; | ||||
|   const dispatch = createEventDispatcher<{ layerSelected: string }>(); | ||||
|   export let info: { id: string; owner: number } | ||||
|   export let category: "layers" | "themes" | ||||
|   export let osmConnection: OsmConnection | ||||
|   const dispatch = createEventDispatcher<{ layerSelected: string }>() | ||||
| 
 | ||||
|   let displayName = UIEventSource.FromPromise( | ||||
|     osmConnection.getInformationAboutUser(info.owner) | ||||
|   ).mapD((response) => response.display_name); | ||||
|   let selfId = osmConnection.userDetails.mapD((ud) => ud.uid); | ||||
| 
 | ||||
|   ).mapD((response) => response.display_name) | ||||
|   let selfId = osmConnection.userDetails.mapD((ud) => ud.uid) | ||||
| 
 | ||||
|   function fetchIconDescription(layerId): any { | ||||
|     if (category === "themes") { | ||||
|       return AllKnownLayouts.allKnownLayouts.get(layerId).icon; | ||||
|       return AllKnownLayouts.allKnownLayouts.get(layerId).icon | ||||
|     } | ||||
|     return AllSharedLayers.getSharedLayersConfigs().get(layerId)?._layerIcon; | ||||
|     return AllSharedLayers.getSharedLayersConfigs().get(layerId)?._layerIcon | ||||
|   } | ||||
| 
 | ||||
| </script> | ||||
| 
 | ||||
| <NextButton clss="small" on:click={() => dispatch("layerSelected", info)}> | ||||
|  | @ -39,7 +37,7 @@ | |||
|         - {info.owner} | ||||
|       {/if} | ||||
|       ) | ||||
|     {:else } | ||||
|     {:else} | ||||
|       ({info.owner}) | ||||
|     {/if} | ||||
|   {/if} | ||||
|  |  | |||
|  | @ -74,8 +74,8 @@ | |||
| 
 | ||||
|   let highlightedItem: UIEventSource<HighlightedTagRendering> = state.highlightedItem | ||||
|   function deleteLayer() { | ||||
|       state.delete() | ||||
|       backToStudio() | ||||
|     state.delete() | ||||
|     backToStudio() | ||||
|   } | ||||
| </script> | ||||
| 
 | ||||
|  | @ -119,10 +119,9 @@ | |||
|         <div class="flex flex-col" slot="content0"> | ||||
|           <Region {state} configs={perRegion["Basic"]} /> | ||||
|           <div class="mt-12"> | ||||
|              | ||||
|           <button on:click={() => deleteLayer()} class="small" > | ||||
|             <TrashIcon class="h-6 w-6"/> Delete this layer | ||||
|           </button> | ||||
|             <button on:click={() => deleteLayer()} class="small"> | ||||
|               <TrashIcon class="h-6 w-6" /> Delete this layer | ||||
|             </button> | ||||
|           </div> | ||||
|         </div> | ||||
| 
 | ||||
|  |  | |||
|  | @ -107,7 +107,7 @@ export abstract class EditJsonState<T> { | |||
|         return entry | ||||
|     } | ||||
| 
 | ||||
|     public async delete(){ | ||||
|     public async delete() { | ||||
|         await this.server.delete(this.getId().data, this.category) | ||||
|     } | ||||
|     public getStoreFor<T>(path: ReadonlyArray<string | number>): UIEventSource<T | undefined> { | ||||
|  | @ -297,9 +297,8 @@ export default class EditLayerState extends EditJsonState<LayerConfigJson> { | |||
| 
 | ||||
|         this.addMissingTagRenderingIds() | ||||
| 
 | ||||
| 
 | ||||
|         function cleanArray(data: object, key: string): boolean{ | ||||
|             if(!data){ | ||||
|         function cleanArray(data: object, key: string): boolean { | ||||
|             if (!data) { | ||||
|                 return false | ||||
|             } | ||||
|             if (data[key]) { | ||||
|  | @ -317,17 +316,17 @@ export default class EditLayerState extends EditJsonState<LayerConfigJson> { | |||
|         this.configuration.addCallbackAndRunD((layer) => { | ||||
|             let changed = cleanArray(layer, "tagRenderings") || cleanArray(layer, "pointRenderings") | ||||
|             for (const tr of layer.tagRenderings ?? []) { | ||||
|                 if(typeof tr === "string"){ | ||||
|                 if (typeof tr === "string") { | ||||
|                     continue | ||||
|                 } | ||||
| 
 | ||||
|                 const qtr = (<QuestionableTagRenderingConfigJson> tr) | ||||
|                 if(qtr.freeform && Object.keys(qtr.freeform ).length === 0){ | ||||
|                 const qtr = <QuestionableTagRenderingConfigJson>tr | ||||
|                 if (qtr.freeform && Object.keys(qtr.freeform).length === 0) { | ||||
|                     delete qtr.freeform | ||||
|                     changed = true | ||||
|                 } | ||||
|             } | ||||
|             if(changed){ | ||||
|             if (changed) { | ||||
|                 this.configuration.ping() | ||||
|             } | ||||
|         }) | ||||
|  |  | |||
|  | @ -63,7 +63,7 @@ export default class StudioServer { | |||
|             return | ||||
|         } | ||||
|         await fetch(this.urlFor(id, category), { | ||||
|             method: "DELETE" | ||||
|             method: "DELETE", | ||||
|         }) | ||||
|     } | ||||
|     async update(id: string, config: string, category: "layers" | "themes") { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue