Fix back button behavior

fixes #12
This commit is contained in:
2026-02-08 16:46:07 +04:00
parent 348b721876
commit 59e3d91071
5 changed files with 114 additions and 3 deletions

View File

@@ -77,11 +77,11 @@ export default class PlaceTemplate extends Component {
navigateBack(place) {
// The sidebar calls this with null when "Back" is clicked.
if (place === null) {
// If we have history, go back (preserves search state)
if (window.history.length > 1) {
// If we came from search results, go back in history
if (this.mapUi.returnToSearch) {
window.history.back();
} else {
// Fallback if opened directly
// Otherwise just close the sidebar (return to map index)
this.router.transitionTo('index');
}
} else {

View File

@@ -5,10 +5,12 @@ import { action } from '@ember/object';
export default class SearchTemplate extends Component {
@service router;
@service mapUi;
@action
selectPlace(place) {
if (place) {
this.mapUi.returnToSearch = true;
this.router.transitionTo('place', place);
}
}