| 
									
										
										
										
											2023-02-03 22:28:11 +01:00
										 |  |  | <script lang="ts"> | 
					
						
							| 
									
										
										
										
											2023-05-24 01:55:41 +02:00
										 |  |  |     import {OsmConnection} from "../../Logic/Osm/OsmConnection" | 
					
						
							|  |  |  |     import {UIEventSource} from "../../Logic/UIEventSource" | 
					
						
							|  |  |  |     import * as themeOverview from "../../assets/generated/theme_overview.json" | 
					
						
							|  |  |  |     import {Utils} from "../../Utils" | 
					
						
							|  |  |  |     import ThemesList from "./ThemesList.svelte" | 
					
						
							|  |  |  |     import Translations from "../i18n/Translations" | 
					
						
							|  |  |  |     import {LayoutInformation} from "../../Models/ThemeConfig/LayoutConfig" | 
					
						
							|  |  |  |     import LoginToggle from "../Base/LoginToggle.svelte"; | 
					
						
							| 
									
										
										
										
											2023-02-03 22:28:11 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-24 01:55:41 +02:00
										 |  |  |     export let search: UIEventSource<string> | 
					
						
							| 
									
										
										
										
											2023-06-06 00:03:14 +02:00
										 |  |  |     export let state: { osmConnection: OsmConnection } | 
					
						
							| 
									
										
										
										
											2023-05-24 01:55:41 +02:00
										 |  |  |     export let onMainScreen: boolean = true | 
					
						
							| 
									
										
										
										
											2023-02-03 22:28:11 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-24 01:55:41 +02:00
										 |  |  |     const prefix = "mapcomplete-hidden-theme-" | 
					
						
							|  |  |  |     const hiddenThemes: LayoutInformation[] = (themeOverview["default"] ?? themeOverview)?.filter( | 
					
						
							|  |  |  |         (layout) => layout.hideFromOverview | 
					
						
							|  |  |  |     ) ?? [] | 
					
						
							|  |  |  |     const userPreferences = state.osmConnection.preferencesHandler.preferences | 
					
						
							|  |  |  |     const t = Translations.t.general.morescreen | 
					
						
							| 
									
										
										
										
											2023-02-03 22:28:11 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-24 01:55:41 +02:00
										 |  |  |     let knownThemesId: string[] | 
					
						
							|  |  |  |     $: knownThemesId = Utils.NoNull( | 
					
						
							|  |  |  |         Object.keys($userPreferences) | 
					
						
							|  |  |  |             .filter((key) => key.startsWith(prefix)) | 
					
						
							|  |  |  |             .map((key) => key.substring(prefix.length, key.length - "-enabled".length)) | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  |     $: console.log("Known theme ids:", knownThemesId) | 
					
						
							|  |  |  |     $: knownThemes = hiddenThemes.filter((theme) => knownThemesId.includes(theme.id)) | 
					
						
							| 
									
										
										
										
											2023-02-03 22:28:11 +01:00
										 |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-24 01:55:41 +02:00
										 |  |  | <LoginToggle {state}> | 
					
						
							| 
									
										
										
										
											2023-05-22 01:37:02 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-24 01:55:41 +02:00
										 |  |  |     <ThemesList | 
					
						
							|  |  |  |             hideThemes={false} | 
					
						
							|  |  |  |             isCustom={false} | 
					
						
							|  |  |  |             {onMainScreen} | 
					
						
							|  |  |  |             {search} | 
					
						
							|  |  |  |             {state} | 
					
						
							|  |  |  |             themes={knownThemes} | 
					
						
							|  |  |  |     > | 
					
						
							|  |  |  |         <svelte:fragment slot="title"> | 
					
						
							|  |  |  |             <h3>{t.previouslyHiddenTitle.toString()}</h3> | 
					
						
							|  |  |  |             <p> | 
					
						
							|  |  |  |                 {t.hiddenExplanation.Subs({ | 
					
						
							|  |  |  |                     hidden_discovered: knownThemes.length.toString(), | 
					
						
							|  |  |  |                     total_hidden: hiddenThemes.length.toString(), | 
					
						
							|  |  |  |                 })} | 
					
						
							|  |  |  |             </p> | 
					
						
							|  |  |  |         </svelte:fragment> | 
					
						
							|  |  |  |     </ThemesList> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | </LoginToggle> |