| 
									
										
										
										
											2023-11-02 04:35:32 +01:00
										 |  |  | <script lang="ts"> | 
					
						
							| 
									
										
										
										
											2023-12-03 04:20:56 +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-12-03 04:20:56 +01:00
										 |  |  |   export let info: { id: string; owner: number }; | 
					
						
							|  |  |  |   export let category: "layers" | "themes"; | 
					
						
							|  |  |  |   export let osmConnection: OsmConnection; | 
					
						
							| 
									
										
										
										
											2023-12-03 04:44:59 +01:00
										 |  |  |   const dispatch = createEventDispatcher<{ layerSelected: string }>(); | 
					
						
							| 
									
										
										
										
											2023-11-02 04:35:32 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-09 16:30:26 +01:00
										 |  |  |   let displayName = UIEventSource.FromPromise( | 
					
						
							|  |  |  |     osmConnection.getInformationAboutUser(info.owner) | 
					
						
							| 
									
										
										
										
											2023-12-03 04:20:56 +01:00
										 |  |  |   ).mapD((response) => response.display_name); | 
					
						
							|  |  |  |   let selfId = osmConnection.userDetails.mapD((ud) => ud.uid); | 
					
						
							| 
									
										
										
										
											2023-11-02 04:35:32 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-03 03:33:02 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-02 04:35:32 +01:00
										 |  |  |   function fetchIconDescription(layerId): any { | 
					
						
							|  |  |  |     if (category === "themes") { | 
					
						
							| 
									
										
										
										
											2023-12-03 04:20:56 +01:00
										 |  |  |       return AllKnownLayouts.allKnownLayouts.get(layerId).icon; | 
					
						
							| 
									
										
										
										
											2023-11-02 04:35:32 +01:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-12-03 04:20:56 +01:00
										 |  |  |     return AllSharedLayers.getSharedLayersConfigs().get(layerId)?._layerIcon; | 
					
						
							| 
									
										
										
										
											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} | 
					
						
							| 
									
										
										
										
											2023-12-03 03:33:02 +01:00
										 |  |  |     {#if $displayName} | 
					
						
							| 
									
										
										
										
											2023-12-03 04:20:56 +01:00
										 |  |  |       (made by {$displayName} | 
					
						
							|  |  |  |       {#if window.location.host.startsWith("127.0.0.1")} | 
					
						
							|  |  |  |         - {info.owner} | 
					
						
							|  |  |  |       {/if} | 
					
						
							|  |  |  |       ) | 
					
						
							| 
									
										
										
										
											2023-12-03 03:33:02 +01:00
										 |  |  |     {:else } | 
					
						
							|  |  |  |       ({info.owner}) | 
					
						
							| 
									
										
										
										
											2023-12-03 04:20:56 +01:00
										 |  |  |     {/if} | 
					
						
							| 
									
										
										
										
											2023-11-02 04:35:32 +01:00
										 |  |  |   {/if} | 
					
						
							|  |  |  | </NextButton> |