Give each bottom sheet its own default height and remember the size the user drags it to, per sheet, so one sheet's height no longer leaks into the next. - App menu now opens at the medium detent instead of near-full-screen. - Place details opens at the short (collapsed) detent; the results and list sheets stay at medium. - Detent memory is keyed by route (map-ui.sheetDetents) instead of one shared slot, and the `detent` arg is authoritative on mount. - Background (parent) sheets are pinned to the minimum reachable detent on mount and on viewport changes, so they can never peek above the top sheet no matter how short it is. They still never write the detent memory.
66 lines
1.6 KiB
Plaintext
66 lines
1.6 KiB
Plaintext
import Component from '@glimmer/component';
|
|
import { action } from '@ember/object';
|
|
import { tracked } from '@glimmer/tracking';
|
|
import { fn } from '@ember/helper';
|
|
import { service } from '@ember/service';
|
|
import eq from 'ember-truth-helpers/helpers/eq';
|
|
import bottomSheet from '../../modifiers/bottom-sheet';
|
|
|
|
import AppMenuHome from './home';
|
|
import AppMenuSettings from './settings';
|
|
import AppMenuAbout from './about';
|
|
|
|
export default class AppMenu extends Component {
|
|
@service router;
|
|
@tracked currentView = 'menu'; // 'menu', 'settings', 'about'
|
|
|
|
@action
|
|
setView(view) {
|
|
this.currentView = view;
|
|
}
|
|
|
|
@action
|
|
goToSavedPlaces() {
|
|
this.router.transitionTo('lists.index');
|
|
}
|
|
|
|
@action
|
|
goToContributions() {
|
|
this.router.transitionTo('contributions');
|
|
}
|
|
|
|
@action
|
|
goToActivity() {
|
|
this.router.transitionTo('activity');
|
|
}
|
|
|
|
<template>
|
|
<div
|
|
class="sidebar app-menu-pane"
|
|
{{bottomSheet detent="medium" onDismiss=@onClose background=@background}}
|
|
>
|
|
{{#if (eq this.currentView "menu")}}
|
|
<AppMenuHome
|
|
@onNavigate={{this.setView}}
|
|
@onClose={{@onClose}}
|
|
@onSavedPlaces={{this.goToSavedPlaces}}
|
|
@onContributions={{this.goToContributions}}
|
|
@onActivity={{this.goToActivity}}
|
|
/>
|
|
|
|
{{else if (eq this.currentView "settings")}}
|
|
<AppMenuSettings
|
|
@onBack={{fn this.setView "menu"}}
|
|
@onClose={{@onClose}}
|
|
/>
|
|
|
|
{{else if (eq this.currentView "about")}}
|
|
<AppMenuAbout
|
|
@onBack={{fn this.setView "menu"}}
|
|
@onClose={{@onClose}}
|
|
/>
|
|
{{/if}}
|
|
</div>
|
|
</template>
|
|
}
|