forked from MapComplete/MapComplete
		
	UX: improve infobox for deleted items, fix #1632
This commit is contained in:
		
							parent
							
								
									761280bdac
								
							
						
					
					
						commit
						6563476c65
					
				
					 3 changed files with 41 additions and 33 deletions
				
			
		|  | @ -20,6 +20,7 @@ | ||||||
|         "cancel": "Cancel", |         "cancel": "Cancel", | ||||||
|         "cannotBeDeleted": "This feature can not be deleted", |         "cannotBeDeleted": "This feature can not be deleted", | ||||||
|         "delete": "Delete", |         "delete": "Delete", | ||||||
|  |         "deletedTitle": "Deleted feature", | ||||||
|         "explanations": { |         "explanations": { | ||||||
|             "hardDelete": "This feature will be deleted in OpenStreetMap. It can be recovered by an experienced contributor", |             "hardDelete": "This feature will be deleted in OpenStreetMap. It can be recovered by an experienced contributor", | ||||||
|             "retagNoOtherThemes": "This feature will be reclassified and hidden from this application", |             "retagNoOtherThemes": "This feature will be reclassified and hidden from this application", | ||||||
|  |  | ||||||
|  | @ -21,15 +21,17 @@ | ||||||
| 
 | 
 | ||||||
|   let isTesting = state.featureSwitchIsTesting |   let isTesting = state.featureSwitchIsTesting | ||||||
|   let isDebugging = state.featureSwitches.featureSwitchIsDebugging |   let isDebugging = state.featureSwitches.featureSwitchIsDebugging | ||||||
|    | 
 | ||||||
|   let metatags: Store<Record<string, string>> = state.userRelatedState.preferencesAsTags |   let metatags: Store<Record<string, string>> = state.userRelatedState.preferencesAsTags | ||||||
| </script> | </script> | ||||||
| 
 | 
 | ||||||
| {#if $tags._deleted === "yes"} | <div class="low-interaction flex border-b-2 border-black px-3 drop-shadow-md"> | ||||||
|   <Tr t={Translations.t.delete.isDeleted} /> |   <div class="h-fit w-full overflow-auto sm:p-2" style="max-height: 20vh;"> | ||||||
| {:else} |     {#if $tags._deleted === "yes"} | ||||||
|   <div class="low-interaction flex border-b-2 border-black px-3 drop-shadow-md"> |       <h3 class="p-4"> | ||||||
|     <div class="h-fit w-full overflow-auto sm:p-2" style="max-height: 20vh;"> |         <Tr t={Translations.t.delete.deletedTitle} /> | ||||||
|  |       </h3> | ||||||
|  |     {:else} | ||||||
|       <div class="flex h-full w-full flex-grow flex-col"> |       <div class="flex h-full w-full flex-grow flex-col"> | ||||||
|         <!-- Title element and  title icons--> |         <!-- Title element and  title icons--> | ||||||
|         <h3 class="m-0"> |         <h3 class="m-0"> | ||||||
|  | @ -37,7 +39,6 @@ | ||||||
|             <TagRenderingAnswer config={layer.title} {selectedElement} {state} {tags} {layer} /> |             <TagRenderingAnswer config={layer.title} {selectedElement} {state} {tags} {layer} /> | ||||||
|           </a> |           </a> | ||||||
|         </h3> |         </h3> | ||||||
| 
 |  | ||||||
|         <div |         <div | ||||||
|           class="no-weblate title-icons links-as-button mr-2 flex flex-row flex-wrap items-center gap-x-0.5 pt-0.5 sm:pt-1" |           class="no-weblate title-icons links-as-button mr-2 flex flex-row flex-wrap items-center gap-x-0.5 pt-0.5 sm:pt-1" | ||||||
|         > |         > | ||||||
|  | @ -57,22 +58,22 @@ | ||||||
|           {/each} |           {/each} | ||||||
| 
 | 
 | ||||||
|           {#if $isTesting || $isDebugging} |           {#if $isTesting || $isDebugging} | ||||||
|             <a class="subtle" href="https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Layers/{layer.id}.md" target="_blank" rel="noreferrer noopener " >{layer.id}</a> |             <a class="subtle" href="https://github.com/pietervdvn/MapComplete/blob/develop/Docs/Layers/{layer.id}.md" | ||||||
|  |                target="_blank" rel="noreferrer noopener ">{layer.id}</a> | ||||||
|           {/if} |           {/if} | ||||||
|         </div> |         </div> | ||||||
|       </div> |       </div> | ||||||
|     </div> |     {/if} | ||||||
| 
 |  | ||||||
|     <button |  | ||||||
|       on:click={() => state.selectedElement.setData(undefined)} |  | ||||||
|       use:ariaLabel={Translations.t.general.backToMap} |  | ||||||
|       class="mt-2 h-fit shrink-0 rounded-full border-none p-0" |  | ||||||
|       style="border: 0 !important; padding: 0 !important;" |  | ||||||
|     > |  | ||||||
|       <XCircleIcon aria-hidden={true} class="h-8 w-8" /> |  | ||||||
|     </button> |  | ||||||
|   </div> |   </div> | ||||||
| {/if} |   <button | ||||||
|  |     class="mt-2 h-fit shrink-0 rounded-full border-none p-0" | ||||||
|  |     on:click={() => state.selectedElement.setData(undefined)} | ||||||
|  |     style="border: 0 !important; padding: 0 !important;" | ||||||
|  |     use:ariaLabel={Translations.t.general.backToMap} | ||||||
|  |   > | ||||||
|  |     <XCircleIcon aria-hidden={true} class="h-8 w-8" /> | ||||||
|  |   </button> | ||||||
|  | </div> | ||||||
| 
 | 
 | ||||||
| <style> | <style> | ||||||
|     :global(.title-icons a) { |     :global(.title-icons a) { | ||||||
|  |  | ||||||
|  | @ -9,25 +9,27 @@ | ||||||
|   import Tr from "../Base/Tr.svelte" |   import Tr from "../Base/Tr.svelte" | ||||||
|   import TagRenderingConfig from "../../Models/ThemeConfig/TagRenderingConfig" |   import TagRenderingConfig from "../../Models/ThemeConfig/TagRenderingConfig" | ||||||
|   import UserRelatedState from "../../Logic/State/UserRelatedState" |   import UserRelatedState from "../../Logic/State/UserRelatedState" | ||||||
|  |   import Delete_icon from "../../assets/svg/Delete_icon.svelte" | ||||||
|  |   import BackButton from "../Base/BackButton.svelte" | ||||||
| 
 | 
 | ||||||
|   export let state: SpecialVisualizationState |   export let state: SpecialVisualizationState | ||||||
|   export let selectedElement: Feature |   export let selectedElement: Feature | ||||||
|   export let highlightedRendering: UIEventSource<string> = undefined |   export let highlightedRendering: UIEventSource<string> = undefined | ||||||
| 
 | 
 | ||||||
|   export let tags: UIEventSource<Record<string, string>> = state.featureProperties.getStore( |   export let tags: UIEventSource<Record<string, string>> = state.featureProperties.getStore( | ||||||
|     selectedElement.properties.id |     selectedElement.properties.id, | ||||||
|   ) |   ) | ||||||
| 
 | 
 | ||||||
|   let layer: LayerConfig = selectedElement.properties.id === "settings" ? UserRelatedState.usersettingsConfig :  state.layout.getMatchingLayer(tags.data) |   let layer: LayerConfig = selectedElement.properties.id === "settings" ? UserRelatedState.usersettingsConfig : state.layout.getMatchingLayer(tags.data) | ||||||
|    | 
 | ||||||
|    | 
 | ||||||
|   let stillMatches = tags.map(tags => !layer?.source?.osmTags || layer.source.osmTags?.matchesProperties(tags)) |   let stillMatches = tags.map(tags => !layer?.source?.osmTags || layer.source.osmTags?.matchesProperties(tags)) | ||||||
| 
 | 
 | ||||||
|   let _metatags: Record<string, string> |   let _metatags: Record<string, string> | ||||||
|   onDestroy( |   onDestroy( | ||||||
|     state.userRelatedState.preferencesAsTags.addCallbackAndRun((tags) => { |     state.userRelatedState.preferencesAsTags.addCallbackAndRun((tags) => { | ||||||
|       _metatags = tags |       _metatags = tags | ||||||
|     }) |     }), | ||||||
|   ) |   ) | ||||||
| 
 | 
 | ||||||
|   let knownTagRenderings: Store<TagRenderingConfig[]> = tags.mapD((tgs) => |   let knownTagRenderings: Store<TagRenderingConfig[]> = tags.mapD((tgs) => | ||||||
|  | @ -35,22 +37,26 @@ | ||||||
|       (config) => |       (config) => | ||||||
|         (config.condition?.matchesProperties(tgs) ?? true) && |         (config.condition?.matchesProperties(tgs) ?? true) && | ||||||
|         (config.metacondition?.matchesProperties({ ...tgs, ..._metatags }) ?? true) && |         (config.metacondition?.matchesProperties({ ...tgs, ..._metatags }) ?? true) && | ||||||
|         config.IsKnown(tgs) |         config.IsKnown(tgs), | ||||||
|     ) |     ), | ||||||
|   ) |   ) | ||||||
| </script> | </script> | ||||||
| 
 | 
 | ||||||
| {#if !$stillMatches} | {#if !$stillMatches} | ||||||
|   <div class="alert"  aria-live="assertive"> |   <div class="alert" aria-live="assertive"> | ||||||
|     <Tr t={Translations.t.delete.isChanged}/> |     <Tr t={Translations.t.delete.isChanged} /> | ||||||
|   </div> |   </div> | ||||||
| {:else if $tags._deleted === "yes"} | {:else if $tags._deleted === "yes"} | ||||||
|   <div aria-live="assertive"> |   <div class="flex w-full flex-col p-2"> | ||||||
|     <Tr t={Translations.t.delete.isDeleted} /> |     <div aria-live="assertive" class="alert flex items-center justify-center self-stretch"> | ||||||
|  |       <Delete_icon class="w-8 h-8 m-2" /> | ||||||
|  |       <Tr t={Translations.t.delete.isDeleted} /> | ||||||
|  |     </div> | ||||||
|  |     <BackButton clss="self-stretch mt-4" on:click={() => state.selectedElement.setData(undefined)}> | ||||||
|  |       <Tr t={Translations.t.general.returnToTheMap} /> | ||||||
|  |     </BackButton> | ||||||
|  |      | ||||||
|   </div> |   </div> | ||||||
|   <button class="w-full" on:click={() => state.selectedElement.setData(undefined)}> |  | ||||||
|     <Tr t={Translations.t.general.returnToTheMap} /> |  | ||||||
|   </button> |  | ||||||
| {:else} | {:else} | ||||||
|   <div |   <div | ||||||
|     class="selected-element-view flex h-full w-full flex-col gap-y-2 overflow-y-auto p-1 px-4" |     class="selected-element-view flex h-full w-full flex-col gap-y-2 overflow-y-auto p-1 px-4" | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue