Derive the sheet stack from the URL instead of mutating it: the route template keeps rendering the top sheet, and application.gjs renders the service-driven parent (search results, lists index, app menu) behind it on mobile, inert, so closing the top sheet reveals the parent at its remembered size. - bottom-sheet modifier: `background` arg — background instances settle immediately, inject no handle, take no gestures, never own the inset slot, and never write the remembered detent (restore-only). - z-index: demote background sheets below the top sheet, including the app menu whose desktop z-index was inverted. - outside tap on mobile pops to the parent without hideSidebar(), keeping the session and detent alive; desktop keeps today's close-all. - tracked matchMedia-backed viewport service for the mobile breakpoint. - lists index extracted into a component so it can render top or background. - scope .sidebar-content lookups and test selectors to .sheet-top. Known v1 limitation: popping hard-cuts to the parent route (no exit animation). The full derived stack with independent detents for 3-level chains is deferred.
63 lines
1.4 KiB
JavaScript
63 lines
1.4 KiB
JavaScript
import Controller from '@ember/controller';
|
|
import { service } from '@ember/service';
|
|
import { action } from '@ember/object';
|
|
import { task } from 'ember-concurrency';
|
|
|
|
export default class ContributionsController extends Controller {
|
|
@service router;
|
|
@service mapUi;
|
|
@service nostrAuth;
|
|
@service contributions;
|
|
@service storage;
|
|
|
|
loadContributionsTask = task({ restartable: true }, async (pubkey) => {
|
|
if (!pubkey) return;
|
|
await this.contributions.load(pubkey);
|
|
});
|
|
|
|
get scrollTop() {
|
|
return this.mapUi.getScrollPosition('contributions');
|
|
}
|
|
|
|
get items() {
|
|
return this.contributions.items;
|
|
}
|
|
|
|
get isConnected() {
|
|
return this.nostrAuth.isConnected;
|
|
}
|
|
|
|
@action
|
|
selectContribution(item) {
|
|
if (!item) return;
|
|
|
|
const sidebarContent = document.querySelector(
|
|
'.sheet-top .sidebar-content'
|
|
);
|
|
if (sidebarContent) {
|
|
this.mapUi.saveScrollPosition('contributions', sidebarContent.scrollTop);
|
|
}
|
|
|
|
this.mapUi.returnToRoute = { name: 'contributions' };
|
|
this.mapUi.showSidebar();
|
|
this.mapUi.preventNextZoom = true;
|
|
|
|
this.router.transitionTo(`/place/${item.placeIdentifier}`);
|
|
}
|
|
|
|
@action
|
|
onNostrConnected() {
|
|
this.loadContributionsTask.perform(this.nostrAuth.pubkey);
|
|
}
|
|
|
|
@action
|
|
backToMenu() {
|
|
this.router.transitionTo('menu');
|
|
}
|
|
|
|
@action
|
|
close() {
|
|
this.router.transitionTo('index');
|
|
}
|
|
}
|