diff --git a/UI/Base/ScrollableFullScreen.ts b/UI/Base/ScrollableFullScreen.ts index 07124f997c..b9f134565b 100644 --- a/UI/Base/ScrollableFullScreen.ts +++ b/UI/Base/ScrollableFullScreen.ts @@ -24,11 +24,16 @@ export default class ScrollableFullScreen extends UIElement { private _fullscreencomponent: BaseUIElement; constructor(title: ((mode: string) => BaseUIElement), content: ((mode: string) => BaseUIElement), + hashToShow: string, isShown: UIEventSource = new UIEventSource(false) ) { super(); this.isShown = isShown; + if (hashToShow === undefined) { + throw "HashToShow should be defined as it is vital for the 'back' key functionality" + } + this._component = this.BuildComponent(title("desktop"), content("desktop"), isShown) .SetClass("hidden md:block"); this._fullscreencomponent = this.BuildComponent(title("mobile"), content("mobile").SetClass("pb-20"), isShown); @@ -38,10 +43,18 @@ export default class ScrollableFullScreen extends UIElement { isShown.addCallback(isShown => { if (isShown) { self.Activate(); + Hash.hash.setData(hashToShow) } else { ScrollableFullScreen.clear(); } }) + + Hash.hash.addCallback(hash => { + if (hash === hashToShow) { + return + } + isShown.setData(false) + }) } private static clear() { @@ -67,10 +80,10 @@ export default class ScrollableFullScreen extends UIElement { private BuildComponent(title: BaseUIElement, content: BaseUIElement, isShown: UIEventSource) { const returnToTheMap = new Combine([ - new Img(Svg.back.replace(/#000000/g,"#cccccc"),true) + new Img(Svg.back.replace(/#000000/g, "#cccccc"), true) .SetClass("block md:hidden w-12 h-12 p-2"), - new Img(Svg.close.replace(/#000000/g,"#cccccc"),true) - .SetClass("hidden md:block w-12 h-12 p-3") + new Img(Svg.close.replace(/#000000/g, "#cccccc"), true) + .SetClass("hidden md:block w-12 h-12 p-3") ]).SetClass("rounded-full p-0 flex-shrink-0 self-center") returnToTheMap.onClick(() => { diff --git a/UI/BigComponents/AllDownloads.ts b/UI/BigComponents/AllDownloads.ts index b49e77bcb0..2586fef3f1 100644 --- a/UI/BigComponents/AllDownloads.ts +++ b/UI/BigComponents/AllDownloads.ts @@ -13,7 +13,7 @@ import ExportPDF from "../ExportPDF"; export default class AllDownloads extends ScrollableFullScreen { constructor(isShown: UIEventSource) { - super(AllDownloads.GenTitle, AllDownloads.GeneratePanel, isShown); + super(AllDownloads.GenTitle, AllDownloads.GeneratePanel, "downloads", isShown); } private static GenTitle(): BaseUIElement { diff --git a/UI/BigComponents/FullWelcomePaneWithTabs.ts b/UI/BigComponents/FullWelcomePaneWithTabs.ts index 1862110ce2..10ab25de5b 100644 --- a/UI/BigComponents/FullWelcomePaneWithTabs.ts +++ b/UI/BigComponents/FullWelcomePaneWithTabs.ts @@ -30,6 +30,7 @@ export default class FullWelcomePaneWithTabs extends ScrollableFullScreen { super( () => layoutToUse.title.Clone(), () => FullWelcomePaneWithTabs.GenerateContents(state, currentTab, isShown), + "welcome", isShown ) } diff --git a/UI/BigComponents/LeftControls.ts b/UI/BigComponents/LeftControls.ts index 4b2328533e..cc8b9e4c05 100644 --- a/UI/BigComponents/LeftControls.ts +++ b/UI/BigComponents/LeftControls.ts @@ -41,6 +41,7 @@ export default class LeftControls extends Combine { state.layoutToUse, new ContributorCount(state).Contributors ), + "copyright", guiState.copyrightViewIsOpened ); @@ -74,6 +75,7 @@ export default class LeftControls extends Combine { new FilterView(state.filteredLayers, state.overlayToggles).SetClass( "block p-1" ), + "filters", guiState.filterViewIsOpened ).SetClass("rounded-lg"), new MapControlButton(Svg.filter_svg()) diff --git a/UI/DefaultGUI.ts b/UI/DefaultGUI.ts index 9af6162335..e259b4f2e3 100644 --- a/UI/DefaultGUI.ts +++ b/UI/DefaultGUI.ts @@ -254,6 +254,7 @@ export default class DefaultGUI { const addNewPoint = new ScrollableFullScreen( () => Translations.t.general.add.title.Clone(), () => new SimpleAddUI(newPointDialogIsShown, filterViewIsOpened, state), + "new", newPointDialogIsShown ); addNewPoint.isShown.addCallback((isShown) => { diff --git a/UI/Popup/FeatureInfoBox.ts b/UI/Popup/FeatureInfoBox.ts index 86f3aa68fa..d1ba0db371 100644 --- a/UI/Popup/FeatureInfoBox.ts +++ b/UI/Popup/FeatureInfoBox.ts @@ -26,7 +26,8 @@ export default class FeatureInfoBox extends ScrollableFullScreen { layerConfig: LayerConfig, ) { super(() => FeatureInfoBox.GenerateTitleBar(tags, layerConfig), - () => FeatureInfoBox.GenerateContent(tags, layerConfig)); + () => FeatureInfoBox.GenerateContent(tags, layerConfig), + tags.data.id); if (layerConfig === undefined) { throw "Undefined layerconfig";