forked from MapComplete/MapComplete
		
	UX: hide drawer during loading page
This commit is contained in:
		
							parent
							
								
									540e2c227e
								
							
						
					
					
						commit
						c30722451e
					
				
					 2 changed files with 16 additions and 3 deletions
				
			
		|  | @ -1,13 +1,13 @@ | ||||||
| <script lang="ts"> | <script lang="ts"> | ||||||
|   import { Drawer } from "flowbite-svelte" |   import { Drawer } from "flowbite-svelte" | ||||||
|   import { sineIn } from "svelte/easing" |   import { cubicInOut } from "svelte/easing" | ||||||
|   import { UIEventSource } from "../../Logic/UIEventSource.js" |   import { UIEventSource } from "../../Logic/UIEventSource.js" | ||||||
| 
 | 
 | ||||||
|   export let shown: UIEventSource<boolean> |   export let shown: UIEventSource<boolean> | ||||||
|   let transitionParams = { |   let transitionParams = { | ||||||
|     x: -320, |     x: -320, | ||||||
|     duration: 200, |     duration: 200, | ||||||
|     easing: sineIn, |     easing: cubicInOut, | ||||||
|   } |   } | ||||||
|   let hidden = !shown.data |   let hidden = !shown.data | ||||||
|   $: { |   $: { | ||||||
|  |  | ||||||
|  | @ -50,6 +50,7 @@ | ||||||
|   import Squares2x2 from "@babeard/svelte-heroicons/mini/Squares2x2" |   import Squares2x2 from "@babeard/svelte-heroicons/mini/Squares2x2" | ||||||
|   import EnvelopeOpen from "@babeard/svelte-heroicons/mini/EnvelopeOpen" |   import EnvelopeOpen from "@babeard/svelte-heroicons/mini/EnvelopeOpen" | ||||||
|   import PanoramaxLink from "./PanoramaxLink.svelte" |   import PanoramaxLink from "./PanoramaxLink.svelte" | ||||||
|  |   import { UIEventSource } from "../../Logic/UIEventSource" | ||||||
| 
 | 
 | ||||||
|   export let state: ThemeViewState |   export let state: ThemeViewState | ||||||
|   let userdetails = state.osmConnection.userDetails |   let userdetails = state.osmConnection.userDetails | ||||||
|  | @ -63,9 +64,21 @@ | ||||||
|   let location = state.mapProperties.location |   let location = state.mapProperties.location | ||||||
|   export let onlyLink: boolean |   export let onlyLink: boolean | ||||||
|   const t = Translations.t.general.menu |   const t = Translations.t.general.menu | ||||||
|  |   let shown = new UIEventSource(state.guistate.pageStates.menu.data) | ||||||
|  |   state.guistate.pageStates.menu.addCallback(isShown => { | ||||||
|  |     console.log("Setting", isShown) | ||||||
|  |     if(isShown){ | ||||||
|  |       shown.setData(true) | ||||||
|  |     }else{ | ||||||
|  |       Utils.waitFor(250).then(() => { | ||||||
|  |         shown.setData(state.guistate.pageStates.menu.data) | ||||||
|  |       }) | ||||||
|  |     } | ||||||
|  |   }) | ||||||
|  | 
 | ||||||
| </script> | </script> | ||||||
| 
 | 
 | ||||||
| <div class="low-interaction flex h-screen flex-col gap-y-2 overflow-y-auto p-2 sm:gap-y-3 sm:p-3"> | <div class="low-interaction flex h-screen flex-col gap-y-2 overflow-y-auto p-2 sm:gap-y-3 sm:p-3" class:hidden={!$shown}> | ||||||
|   <div class="flex justify-between"> |   <div class="flex justify-between"> | ||||||
|     <h2> |     <h2> | ||||||
|       <Tr t={t.title} /> |       <Tr t={t.title} /> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue