diff --git a/src/map-app/app/map-ui.ts b/src/map-app/app/map-ui.ts index f7598786..80d17ed8 100644 --- a/src/map-app/app/map-ui.ts +++ b/src/map-app/app/map-ui.ts @@ -138,7 +138,7 @@ export class MapUI { this.stateManager.propFilter(new PropEquality(propName, value, isMulti)); } - if (canDisplayExpandedSidebar()) // on smaller screens, wait until user clicks Apply Filters + if (canDisplayExpandedSidebar()) // on smaller screens, wait until user clicks Show Results EventBus.Sidebar.showInitiativeList.pub(); } @@ -216,6 +216,9 @@ export class MapUI { else { // User has deselected EventBus.Markers.needToShowLatestSelection.pub([]); + this.getSidebarPresenter(this).then((presenter) => { + presenter.hideInitiativeSidebar(); + }); } this.refreshSidebar(); diff --git a/src/map-app/app/presenter/sidebar.ts b/src/map-app/app/presenter/sidebar.ts index 09891574..4cc831b2 100644 --- a/src/map-app/app/presenter/sidebar.ts +++ b/src/map-app/app/presenter/sidebar.ts @@ -131,7 +131,6 @@ export class SidebarPresenter extends BasePresenter { }); EventBus.Sidebar.showSidebar.sub(() => this.showSidebar()); EventBus.Sidebar.hideSidebar.sub(() => this.hideSidebar()); - EventBus.Sidebar.hideInitiativeSidebar.sub(() => this.hideInitiativeSidebar()); EventBus.Sidebar.showInitiativeList.sub(() => this.showInitiativeList()); EventBus.Sidebar.hideInitiativeList.sub(() => this.hideInitiativeList()); EventBus.Initiatives.reset.sub(() => { diff --git a/src/map-app/app/view/sidebar.ts b/src/map-app/app/view/sidebar.ts index 30e5c90a..6da1b57d 100644 --- a/src/map-app/app/view/sidebar.ts +++ b/src/map-app/app/view/sidebar.ts @@ -171,15 +171,6 @@ export class SidebarView extends BaseView { } - hideInitiativeSidebar() { - const initiativeSidebar = d3.select("#sea-initiative-sidebar"); - const node = initiativeSidebar.node(); - - if (node instanceof HTMLElement && node?.getBoundingClientRect().x === 0) { - initiativeSidebar.classed("sea-initiative-sidebar-open", false); - } - } - showInitiativeList() { //if empty don't show const empty = d3.select("#sea-initiatives-list-sidebar-content").select("ul").empty(); @@ -244,4 +235,13 @@ export class SidebarView extends BaseView { if (!canDisplayInitiativePopups()) EventBus.Sidebar.showSidebar.pub(); } + + hideInitiativeSidebar() { + const initiativeSidebar = d3.select("#sea-initiative-sidebar"); + const node = initiativeSidebar.node(); + + if (node instanceof HTMLElement && node?.getBoundingClientRect().x === 0) { + initiativeSidebar.classed("sea-initiative-sidebar-open", false); + } + } } diff --git a/src/map-app/eventbus.ts b/src/map-app/eventbus.ts index 66f3ba66..e2e48182 100644 --- a/src/map-app/eventbus.ts +++ b/src/map-app/eventbus.ts @@ -87,7 +87,6 @@ export namespace EventBus { export namespace Sidebar { export const showInitiativeList = new PostalTopic("Sidebar.showInitiativeList"); export const hideInitiativeList = new PostalTopic("Sidebar.hideInitiativeList"); - export const hideInitiativeSidebar = new PostalTopic("Sidebar.hideInitiativeSidebar"); export const hideSidebar = new PostalTopic("Sidebar.hideSidebar"); export const showAbout = new PostalTopic("Sidebar.showAbout"); export const showDatasets = new PostalTopic("Sidebar.showDatasets");