| 
									
										
										
										
											2023-11-02 04:35:32 +01:00
										 |  |  | <script lang="ts"> | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  |   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" | 
					
						
							| 
									
										
										
										
											2023-11-02 04:35:32 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  |   export let info: { id: string; owner: number } | 
					
						
							|  |  |  |   export let category: "layers" | "themes" | 
					
						
							|  |  |  |   export let osmConnection: OsmConnection | 
					
						
							| 
									
										
										
										
											2023-11-02 04:35:32 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  |   let displayName = UIEventSource.FromPromise( | 
					
						
							|  |  |  |     osmConnection.getInformationAboutUser(info.owner) | 
					
						
							|  |  |  |   ).mapD((response) => response.display_name) | 
					
						
							| 
									
										
										
										
											2023-11-02 04:35:32 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  |   let selfId = osmConnection.userDetails.mapD((ud) => ud.uid) | 
					
						
							| 
									
										
										
										
											2023-11-02 04:35:32 +01:00
										 |  |  |   function fetchIconDescription(layerId): any { | 
					
						
							|  |  |  |     if (category === "themes") { | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  |       return AllKnownLayouts.allKnownLayouts.get(layerId).icon | 
					
						
							| 
									
										
										
										
											2023-11-02 04:35:32 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  |     return AllSharedLayers.getSharedLayersConfigs().get(layerId)?._layerIcon | 
					
						
							| 
									
										
										
										
											2023-11-02 04:35:32 +01:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  |   const dispatch = createEventDispatcher<{ layerSelected: string }>() | 
					
						
							| 
									
										
										
										
											2023-11-02 04:35:32 +01:00
										 |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <NextButton clss="small" on:click={() => dispatch("layerSelected", info)}> | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  |   <div class="mr-1 h-4 w-4"> | 
					
						
							| 
									
										
										
										
											2023-11-02 04:35:32 +01:00
										 |  |  |     <Marker icons={fetchIconDescription(info.id)} /> | 
					
						
							|  |  |  |   </div> | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  |   <b class="px-1">{info.id}</b> | 
					
						
							| 
									
										
										
										
											2023-11-02 04:35:32 +01:00
										 |  |  |   {#if info.owner && info.owner !== $selfId} | 
					
						
							|  |  |  |     (made by {$displayName ?? info.owner}) | 
					
						
							|  |  |  |   {/if} | 
					
						
							|  |  |  | </NextButton> |