| 
									
										
										
										
											2021-07-28 16:48:59 +02:00
										 |  |  | import Combine from "../Base/Combine"; | 
					
						
							|  |  |  | import ScrollableFullScreen from "../Base/ScrollableFullScreen"; | 
					
						
							|  |  |  | import Translations from "../i18n/Translations"; | 
					
						
							| 
									
										
										
										
											2021-10-30 01:55:32 +02:00
										 |  |  | import CopyrightPanel from "./CopyrightPanel"; | 
					
						
							| 
									
										
										
										
											2021-07-28 16:48:59 +02:00
										 |  |  | import ContributorCount from "../../Logic/ContributorCount"; | 
					
						
							|  |  |  | import Toggle from "../Input/Toggle"; | 
					
						
							|  |  |  | import MapControlButton from "../MapControlButton"; | 
					
						
							|  |  |  | import Svg from "../../Svg"; | 
					
						
							|  |  |  | import AllDownloads from "./AllDownloads"; | 
					
						
							|  |  |  | import FilterView from "./FilterView"; | 
					
						
							| 
									
										
										
										
											2021-09-21 02:10:42 +02:00
										 |  |  | import {UIEventSource} from "../../Logic/UIEventSource"; | 
					
						
							|  |  |  | import FeaturePipeline from "../../Logic/FeatureSource/FeaturePipeline"; | 
					
						
							|  |  |  | import Loc from "../../Models/Loc"; | 
					
						
							| 
									
										
										
										
											2021-09-28 17:30:48 +02:00
										 |  |  | import {BBox} from "../../Logic/BBox"; | 
					
						
							| 
									
										
										
										
											2021-10-15 05:20:02 +02:00
										 |  |  | import LayoutConfig from "../../Models/ThemeConfig/LayoutConfig"; | 
					
						
							|  |  |  | import FilteredLayer from "../../Models/FilteredLayer"; | 
					
						
							| 
									
										
										
										
											2021-07-28 16:48:59 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | export default class LeftControls extends Combine { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-15 05:20:02 +02:00
										 |  |  |     constructor(state: { | 
					
						
							|  |  |  |                     layoutToUse: LayoutConfig, | 
					
						
							|  |  |  |                     featurePipeline: FeaturePipeline, | 
					
						
							|  |  |  |                     currentBounds: UIEventSource<BBox>, | 
					
						
							|  |  |  |                     locationControl: UIEventSource<Loc>, | 
					
						
							|  |  |  |                     overlayToggles: any, | 
					
						
							|  |  |  |                     featureSwitchEnableExport: UIEventSource<boolean>, | 
					
						
							|  |  |  |                     featureSwitchExportAsPdf: UIEventSource<boolean>, | 
					
						
							|  |  |  |                     filteredLayers: UIEventSource<FilteredLayer[]>, | 
					
						
							| 
									
										
										
										
											2021-10-23 02:46:37 +02:00
										 |  |  |                     featureSwitchFilter: UIEventSource<boolean> | 
					
						
							| 
									
										
										
										
											2021-10-15 05:20:02 +02:00
										 |  |  |                 }, | 
					
						
							|  |  |  |                 guiState: { | 
					
						
							|  |  |  |                     downloadControlIsOpened: UIEventSource<boolean>, | 
					
						
							|  |  |  |                     filterViewIsOpened: UIEventSource<boolean>, | 
					
						
							| 
									
										
										
										
											2021-10-23 02:46:37 +02:00
										 |  |  |                     copyrightViewIsOpened: UIEventSource<boolean> | 
					
						
							| 
									
										
										
										
											2021-10-15 05:20:02 +02:00
										 |  |  |                 }) { | 
					
						
							| 
									
										
										
										
											2021-07-28 16:48:59 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         const toggledCopyright = new ScrollableFullScreen( | 
					
						
							|  |  |  |             () => Translations.t.general.attribution.attributionTitle.Clone(), | 
					
						
							|  |  |  |             () => | 
					
						
							| 
									
										
										
										
											2021-10-30 01:55:32 +02:00
										 |  |  |                 new CopyrightPanel( | 
					
						
							|  |  |  |                     state, | 
					
						
							| 
									
										
										
										
											2021-09-21 02:10:42 +02:00
										 |  |  |                     new ContributorCount(state).Contributors | 
					
						
							| 
									
										
										
										
											2021-07-28 16:48:59 +02:00
										 |  |  |                 ), | 
					
						
							| 
									
										
										
										
											2021-10-25 20:50:59 +02:00
										 |  |  |              "copyright", | 
					
						
							| 
									
										
										
										
											2021-10-23 02:46:37 +02:00
										 |  |  |              guiState.copyrightViewIsOpened | 
					
						
							| 
									
										
										
										
											2021-07-28 16:48:59 +02:00
										 |  |  |         ); | 
					
						
							| 
									
										
										
										
											2021-09-09 00:05:51 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-28 16:48:59 +02:00
										 |  |  |         const copyrightButton = new Toggle( | 
					
						
							|  |  |  |             toggledCopyright, | 
					
						
							| 
									
										
										
										
											2021-07-28 18:20:59 +02:00
										 |  |  |             new MapControlButton(Svg.copyright_svg()) | 
					
						
							|  |  |  |                 .onClick(() => toggledCopyright.isShown.setData(true)), | 
					
						
							| 
									
										
										
										
											2021-07-28 16:48:59 +02:00
										 |  |  |             toggledCopyright.isShown | 
					
						
							| 
									
										
										
										
											2021-10-23 02:46:37 +02:00
										 |  |  |         ).SetClass("p-0.5"); | 
					
						
							| 
									
										
										
										
											2021-07-28 16:48:59 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         const toggledDownload = new Toggle( | 
					
						
							|  |  |  |             new AllDownloads( | 
					
						
							| 
									
										
										
										
											2021-10-15 05:20:02 +02:00
										 |  |  |                 guiState.downloadControlIsOpened | 
					
						
							| 
									
										
										
										
											2021-07-28 16:48:59 +02:00
										 |  |  |             ).SetClass("block p-1 rounded-full"), | 
					
						
							| 
									
										
										
										
											2021-07-28 18:20:59 +02:00
										 |  |  |             new MapControlButton(Svg.download_svg()) | 
					
						
							| 
									
										
										
										
											2021-10-15 05:20:02 +02:00
										 |  |  |                 .onClick(() => guiState.downloadControlIsOpened.setData(true)), | 
					
						
							|  |  |  |             guiState.downloadControlIsOpened | 
					
						
							| 
									
										
										
										
											2021-07-28 18:20:59 +02:00
										 |  |  |         ) | 
					
						
							| 
									
										
										
										
											2021-07-28 16:48:59 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         const downloadButtonn = new Toggle( | 
					
						
							|  |  |  |             toggledDownload, | 
					
						
							|  |  |  |             undefined, | 
					
						
							| 
									
										
										
										
											2021-10-15 05:20:02 +02:00
										 |  |  |             state.featureSwitchEnableExport.map(downloadEnabled => downloadEnabled || state.featureSwitchExportAsPdf.data, | 
					
						
							|  |  |  |                 [state.featureSwitchExportAsPdf]) | 
					
						
							| 
									
										
										
										
											2021-07-28 16:48:59 +02:00
										 |  |  |         ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         const toggledFilter = new Toggle( | 
					
						
							|  |  |  |             new ScrollableFullScreen( | 
					
						
							|  |  |  |                 () => Translations.t.general.layerSelection.title.Clone(), | 
					
						
							|  |  |  |                 () => | 
					
						
							| 
									
										
										
										
											2021-10-15 05:20:02 +02:00
										 |  |  |                     new FilterView(state.filteredLayers, state.overlayToggles).SetClass( | 
					
						
							| 
									
										
										
										
											2021-10-23 02:46:37 +02:00
										 |  |  |                         "block p-1" | 
					
						
							| 
									
										
										
										
											2021-07-28 16:48:59 +02:00
										 |  |  |                     ), | 
					
						
							| 
									
										
										
										
											2021-10-25 20:50:59 +02:00
										 |  |  |                 "filters", | 
					
						
							| 
									
										
										
										
											2021-10-15 05:20:02 +02:00
										 |  |  |                 guiState.filterViewIsOpened | 
					
						
							| 
									
										
										
										
											2021-10-23 02:46:37 +02:00
										 |  |  |             ).SetClass("rounded-lg"), | 
					
						
							| 
									
										
										
										
											2021-07-28 18:20:59 +02:00
										 |  |  |             new MapControlButton(Svg.filter_svg()) | 
					
						
							| 
									
										
										
										
											2021-10-15 05:20:02 +02:00
										 |  |  |                 .onClick(() => guiState.filterViewIsOpened.setData(true)), | 
					
						
							|  |  |  |             guiState.filterViewIsOpened | 
					
						
							| 
									
										
										
										
											2021-07-28 18:20:59 +02:00
										 |  |  |         ) | 
					
						
							| 
									
										
										
										
											2021-07-28 16:48:59 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         const filterButton = new Toggle( | 
					
						
							|  |  |  |             toggledFilter, | 
					
						
							|  |  |  |             undefined, | 
					
						
							| 
									
										
										
										
											2021-10-15 05:20:02 +02:00
										 |  |  |             state.featureSwitchFilter | 
					
						
							| 
									
										
										
										
											2021-07-28 16:48:59 +02:00
										 |  |  |         ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         super([filterButton, | 
					
						
							|  |  |  |             downloadButtonn, | 
					
						
							|  |  |  |             copyrightButton]) | 
					
						
							| 
									
										
										
										
											2021-09-09 00:05:51 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-28 16:48:59 +02:00
										 |  |  |         this.SetClass("flex flex-col") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |