Drawer headers: a shared DrawerHeader component renders the desktop nav-bar layout (back + centered title + close) and a mobile variant (left title, no back button, a single X that dismisses the top sheet — back when there is a parent, otherwise close). Place details uses the place name as its title with a compact, borderless header, and on mobile moves the photos below the place type. The X and back buttons now have aria-labels. Sheet scrolling: the content only scrolls while the sheet is at its largest detent; below that, dragging anywhere on the sheet (including list rows and links, not just the header) resizes it. At the largest detent, pulling down on the content while it is scrolled to the top shrinks the sheet (overscroll to shrink). Place details opens at the medium detent again. The mobile photo carousel no longer bleeds to the sheet edges, gets a wider gap and the same corner radius as the action buttons.
81 lines
2.4 KiB
Plaintext
81 lines
2.4 KiB
Plaintext
import Component from '@glimmer/component';
|
|
import { action } from '@ember/object';
|
|
import { tracked } from '@glimmer/tracking';
|
|
import { on } from '@ember/modifier';
|
|
import Icon from './icon';
|
|
import DrawerHeader from './drawer-header';
|
|
import ContributionPhoto from './contribution-photo';
|
|
import Modal from './modal';
|
|
import NostrConnect from './nostr-connect';
|
|
import eq from 'ember-truth-helpers/helpers/eq';
|
|
import not from 'ember-truth-helpers/helpers/not';
|
|
import restoreScroll from '../modifiers/restore-scroll';
|
|
import bottomSheet from '../modifiers/bottom-sheet';
|
|
|
|
export default class ContributionsTimelineComponent extends Component {
|
|
@tracked isNostrConnectModalOpen = false;
|
|
|
|
@action
|
|
openNostrConnectModal(event) {
|
|
event.preventDefault();
|
|
this.isNostrConnectModalOpen = true;
|
|
}
|
|
|
|
@action
|
|
closeNostrConnectModal() {
|
|
this.isNostrConnectModalOpen = false;
|
|
}
|
|
|
|
@action
|
|
onNostrConnected() {
|
|
this.closeNostrConnectModal();
|
|
this.args.onNostrConnected?.();
|
|
}
|
|
|
|
<template>
|
|
<div class="sidebar" {{bottomSheet detent="medium" onDismiss=@onClose}}>
|
|
<DrawerHeader
|
|
@title="My Contributions"
|
|
@icon="user-check"
|
|
@onBack={{@onBack}}
|
|
@onClose={{@onClose}}
|
|
/>
|
|
|
|
<div class="sidebar-content" {{restoreScroll @scrollTop}}>
|
|
{{#if @isLoading}}
|
|
<div class="sidebar-loading">
|
|
<Icon @name="loading-ring" @size={{24}} @color="#898989" />
|
|
</div>
|
|
{{else if (not @isConnected)}}
|
|
<p class="empty-state">
|
|
<a
|
|
href="#"
|
|
role="button"
|
|
tabindex="0"
|
|
{{on "click" this.openNostrConnectModal}}
|
|
>Connect your Nostr account</a>
|
|
to see your contributions.
|
|
</p>
|
|
{{else if (not @items.length)}}
|
|
<p class="empty-state">No contributions yet. Start by adding photos to
|
|
places.</p>
|
|
{{else}}
|
|
<ul class="contributions-list">
|
|
{{#each @items as |item|}}
|
|
{{#if (eq item.type "photo")}}
|
|
<ContributionPhoto @item={{item}} @onSelect={{@onSelect}} />
|
|
{{/if}}
|
|
{{/each}}
|
|
</ul>
|
|
{{/if}}
|
|
</div>
|
|
</div>
|
|
|
|
{{#if this.isNostrConnectModalOpen}}
|
|
<Modal @onClose={{this.closeNostrConnectModal}}>
|
|
<NostrConnect @onConnect={{this.onNostrConnected}} />
|
|
</Modal>
|
|
{{/if}}
|
|
</template>
|
|
}
|