| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  | import { VariableUiElement } from "../Base/VariableUIElement" | 
					
						
							| 
									
										
										
										
											2023-01-06 03:43:24 +01:00
										 |  |  | import { Store } from "../../Logic/UIEventSource" | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  | import Loc from "../../Models/Loc" | 
					
						
							|  |  |  | import Translations from "../i18n/Translations" | 
					
						
							|  |  |  | import { SubtleButton } from "../Base/SubtleButton" | 
					
						
							|  |  |  | import Svg from "../../Svg" | 
					
						
							|  |  |  | import Combine from "../Base/Combine" | 
					
						
							| 
									
										
										
										
											2022-05-06 12:41:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | export class MapillaryLink extends VariableUiElement { | 
					
						
							| 
									
										
										
										
											2023-01-06 03:43:24 +01:00
										 |  |  |     constructor(state: { readonly locationControl: Store<Loc> }, iconStyle?: string) { | 
					
						
							| 
									
										
										
										
											2022-05-06 12:41:24 +02:00
										 |  |  |         const t = Translations.t.general.attribution | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  |         super( | 
					
						
							|  |  |  |             state.locationControl.map((location) => { | 
					
						
							|  |  |  |                 const mapillaryLink = `https://www.mapillary.com/app/?focus=map&lat=${ | 
					
						
							|  |  |  |                     location?.lat ?? 0 | 
					
						
							|  |  |  |                 }&lng=${location?.lon ?? 0}&z=${Math.max((location?.zoom ?? 2) - 1, 1)}`
 | 
					
						
							|  |  |  |                 return new SubtleButton( | 
					
						
							|  |  |  |                     Svg.mapillary_black_ui().SetStyle(iconStyle), | 
					
						
							| 
									
										
										
										
											2023-01-06 03:43:24 +01:00
										 |  |  |                     new Combine([t.openMapillary.SetClass("font-bold"), t.mapillaryHelp]).SetClass( | 
					
						
							|  |  |  |                         "flex flex-col link-no-underline" | 
					
						
							|  |  |  |                     ), | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  |                     { | 
					
						
							|  |  |  |                         url: mapillaryLink, | 
					
						
							|  |  |  |                         newTab: true, | 
					
						
							|  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2023-01-06 03:43:24 +01:00
										 |  |  |                 ) | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  |             }) | 
					
						
							|  |  |  |         ) | 
					
						
							| 
									
										
										
										
											2022-05-06 12:41:24 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  | } |