| 
									
										
										
										
											2024-11-28 12:00:23 +01:00
										 |  |  | <script lang="ts"> | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Gives an overview of questions which are disabled for the given theme | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   import LayerConfig from "../../Models/ThemeConfig/LayerConfig" | 
					
						
							|  |  |  |   import ThemeViewState from "../../Models/ThemeViewState" | 
					
						
							|  |  |  |   import Tr from "../Base/Tr.svelte" | 
					
						
							|  |  |  |   import { Translation } from "../i18n/Translation" | 
					
						
							|  |  |  |   import { XMarkIcon } from "@babeard/svelte-heroicons/mini" | 
					
						
							|  |  |  |   import ToSvelte from "../Base/ToSvelte.svelte" | 
					
						
							| 
									
										
										
										
											2025-01-02 03:56:42 +01:00
										 |  |  |   import DefaultIcon from "../Map/DefaultIcon.svelte" | 
					
						
							| 
									
										
										
										
											2024-10-08 22:37:11 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-28 12:00:23 +01:00
										 |  |  |   export let layer: LayerConfig | 
					
						
							|  |  |  |   export let state: ThemeViewState | 
					
						
							| 
									
										
										
										
											2024-10-08 22:37:11 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-12-09 16:12:20 +01:00
										 |  |  |   let disabledQuestions = state.userRelatedState.getThemeDisabled(state.theme.id, layer.id) | 
					
						
							| 
									
										
										
										
											2024-10-08 22:37:11 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-28 12:00:23 +01:00
										 |  |  |   function getQuestion(id: string): Translation { | 
					
						
							|  |  |  |     return layer.tagRenderings.find((q) => q.id === id).question.Subs({}) | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2024-10-08 22:37:11 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-28 12:00:23 +01:00
										 |  |  |   function enable(idToEnable: string) { | 
					
						
							|  |  |  |     const newList = disabledQuestions.data.filter((id) => id !== idToEnable) | 
					
						
							|  |  |  |     disabledQuestions.set(newList) | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2024-10-08 22:37:11 +02:00
										 |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | {#if $disabledQuestions.length > 0} | 
					
						
							|  |  |  |   <div class="low-interaction p-2"> | 
					
						
							| 
									
										
										
										
											2024-11-28 12:00:23 +01:00
										 |  |  |     <h4 class="my-2 flex"> | 
					
						
							| 
									
										
										
										
											2024-10-08 22:37:11 +02:00
										 |  |  |       <div class="no-image-background block h-6 w-6"> | 
					
						
							| 
									
										
										
										
											2025-01-02 03:56:42 +01:00
										 |  |  |         <DefaultIcon {layer}/> | 
					
						
							| 
									
										
										
										
											2024-10-08 22:37:11 +02:00
										 |  |  |       </div> | 
					
						
							|  |  |  |       <Tr t={layer.name} /> | 
					
						
							|  |  |  |     </h4> | 
					
						
							|  |  |  |     <div class="flex"> | 
					
						
							|  |  |  |       {#each $disabledQuestions as id} | 
					
						
							|  |  |  |         <button class="badge button-unstyled" on:click={() => enable(id)}> | 
					
						
							|  |  |  |           <Tr cls="ml-2" t={getQuestion(id)} /> | 
					
						
							| 
									
										
										
										
											2024-11-28 12:00:23 +01:00
										 |  |  |           <XMarkIcon class="mr-2 h-4 w-4" /> | 
					
						
							| 
									
										
										
										
											2024-10-08 22:37:11 +02:00
										 |  |  |         </button> | 
					
						
							|  |  |  |       {/each} | 
					
						
							|  |  |  |     </div> | 
					
						
							|  |  |  |   </div> | 
					
						
							|  |  |  | {/if} |