| 
									
										
										
										
											2023-02-03 22:28:11 +01:00
										 |  |  | <script lang="ts"> | 
					
						
							|  |  |  |   import NoThemeResultButton from "./NoThemeResultButton.svelte" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   import { OsmConnection } from "../../Logic/Osm/OsmConnection" | 
					
						
							|  |  |  |   import { UIEventSource } from "../../Logic/UIEventSource" | 
					
						
							|  |  |  |   import type Loc from "../../Models/Loc" | 
					
						
							|  |  |  |   import Locale from "../i18n/Locale" | 
					
						
							|  |  |  |   import CustomGeneratorButton from "./CustomGeneratorButton.svelte" | 
					
						
							|  |  |  |   import ProfessionalServicesButton from "./ProfessionalServicesButton.svelte" | 
					
						
							|  |  |  |   import ThemeButton from "./ThemeButton.svelte" | 
					
						
							| 
									
										
										
										
											2023-03-09 20:54:12 +01:00
										 |  |  |   import { LayoutInformation } from "../../Models/ThemeConfig/LayoutConfig" | 
					
						
							| 
									
										
										
										
											2023-05-07 23:54:31 +02:00
										 |  |  |   import MoreScreen from "./MoreScreen" | 
					
						
							| 
									
										
										
										
											2023-02-03 22:28:11 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   export let search: UIEventSource<string> | 
					
						
							| 
									
										
										
										
											2023-02-11 15:04:20 +01:00
										 |  |  |   export let themes: LayoutInformation[] | 
					
						
							| 
									
										
										
										
											2023-02-03 22:28:11 +01:00
										 |  |  |   export let state: { osmConnection: OsmConnection; locationControl?: UIEventSource<Loc> } | 
					
						
							|  |  |  |   export let isCustom: boolean = false | 
					
						
							|  |  |  |   export let onMainScreen: boolean = true | 
					
						
							|  |  |  |   export let hideThemes: boolean = true | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // Filter theme based on search value | 
					
						
							| 
									
										
										
										
											2023-04-23 13:22:57 +02:00
										 |  |  |   $: filteredThemes = themes.filter((theme) => MoreScreen.MatchesLayout(theme, $search)) | 
					
						
							| 
									
										
										
										
											2023-02-03 22:28:11 +01:00
										 |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <section> | 
					
						
							|  |  |  |   <slot name="title" /> | 
					
						
							| 
									
										
										
										
											2023-02-09 00:10:59 +01:00
										 |  |  |   {#if onMainScreen} | 
					
						
							|  |  |  |     <div class="md:grid md:grid-flow-row md:grid-cols-2 lg:grid-cols-3 gap-4"> | 
					
						
							| 
									
										
										
										
											2023-03-09 20:54:12 +01:00
										 |  |  |       {#if ($search === undefined || $search === "") && !isCustom && hideThemes} | 
					
						
							| 
									
										
										
										
											2023-02-09 00:10:59 +01:00
										 |  |  |         <CustomGeneratorButton userDetails={state.osmConnection.userDetails} /> | 
					
						
							|  |  |  |         <ProfessionalServicesButton /> | 
					
						
							|  |  |  |       {/if} | 
					
						
							| 
									
										
										
										
											2023-02-03 22:28:11 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-13 21:31:27 +01:00
										 |  |  |       {#each filteredThemes as theme (theme.id)} | 
					
						
							| 
									
										
										
										
											2023-02-09 00:10:59 +01:00
										 |  |  |         {#if theme !== undefined && !(hideThemes && theme?.hideFromOverview)} | 
					
						
							|  |  |  |           <ThemeButton {theme} {isCustom} userDetails={state.osmConnection.userDetails} {state} /> | 
					
						
							|  |  |  |         {/if} | 
					
						
							|  |  |  |       {/each} | 
					
						
							|  |  |  |     </div> | 
					
						
							| 
									
										
										
										
											2023-03-09 20:54:12 +01:00
										 |  |  |   {:else} | 
					
						
							| 
									
										
										
										
											2023-02-09 00:10:59 +01:00
										 |  |  |     <div> | 
					
						
							| 
									
										
										
										
											2023-03-09 20:54:12 +01:00
										 |  |  |       {#if ($search === undefined || $search === "") && !isCustom && hideThemes} | 
					
						
							| 
									
										
										
										
											2023-02-09 00:10:59 +01:00
										 |  |  |         <CustomGeneratorButton userDetails={state.osmConnection.userDetails} /> | 
					
						
							|  |  |  |         <ProfessionalServicesButton /> | 
					
						
							| 
									
										
										
										
											2023-02-03 22:28:11 +01:00
										 |  |  |       {/if} | 
					
						
							| 
									
										
										
										
											2023-02-09 00:10:59 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-13 21:31:27 +01:00
										 |  |  |       {#each filteredThemes as theme (theme.id)} | 
					
						
							| 
									
										
										
										
											2023-02-09 00:10:59 +01:00
										 |  |  |         {#if theme !== undefined && !(hideThemes && theme?.hideFromOverview)} | 
					
						
							|  |  |  |           <ThemeButton {theme} {isCustom} userDetails={state.osmConnection.userDetails} {state} /> | 
					
						
							|  |  |  |         {/if} | 
					
						
							|  |  |  |       {/each} | 
					
						
							|  |  |  |     </div> | 
					
						
							| 
									
										
										
										
											2023-03-09 20:54:12 +01:00
										 |  |  |   {/if} | 
					
						
							| 
									
										
										
										
											2023-02-03 22:28:11 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   {#if filteredThemes.length == 0} | 
					
						
							|  |  |  |     <NoThemeResultButton {search} /> | 
					
						
							|  |  |  |   {/if} | 
					
						
							|  |  |  | </section> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <style lang="scss"> | 
					
						
							|  |  |  |   section { | 
					
						
							|  |  |  |     @apply flex flex-col; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | </style> |