Skip to content

Commit

Permalink
Fix initiative info close button on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
rogup committed Jun 3, 2024
1 parent 72ade1b commit f74bc66
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
5 changes: 4 additions & 1 deletion src/map-app/app/map-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -216,6 +216,9 @@ export class MapUI {
else {
// User has deselected
EventBus.Markers.needToShowLatestSelection.pub([]);
this.getSidebarPresenter(this).then((presenter) => {
presenter.hideInitiativeSidebar();
});
}

this.refreshSidebar();
Expand Down
1 change: 0 additions & 1 deletion src/map-app/app/presenter/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
18 changes: 9 additions & 9 deletions src/map-app/app/view/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}
}
}
1 change: 0 additions & 1 deletion src/map-app/eventbus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit f74bc66

Please sign in to comment.