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.
107 lines
3.3 KiB
Plaintext
107 lines
3.3 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 TabNav from './tab-nav';
|
|
import ActivityZapItem from './activity-zap-item';
|
|
import ActivityPhotoItem from './activity-photo-item';
|
|
import Modal from './modal';
|
|
import NostrConnect from './nostr-connect';
|
|
import not from 'ember-truth-helpers/helpers/not';
|
|
import eq from 'ember-truth-helpers/helpers/eq';
|
|
import and from 'ember-truth-helpers/helpers/and';
|
|
import restoreScroll from '../modifiers/restore-scroll';
|
|
import observeIntersection from '../modifiers/observe-intersection';
|
|
import bottomSheet from '../modifiers/bottom-sheet';
|
|
|
|
export default class ActivityTimelineComponent extends Component {
|
|
@tracked isNostrConnectModalOpen = false;
|
|
|
|
tabs = [
|
|
{ label: 'Home', value: 'home' },
|
|
{ label: 'Explore', value: 'explore' },
|
|
];
|
|
|
|
@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="Activity"
|
|
@icon="activity"
|
|
@onBack={{@onBack}}
|
|
@onClose={{@onClose}}
|
|
/>
|
|
|
|
<TabNav
|
|
@tabs={{this.tabs}}
|
|
@active={{@sourceMode}}
|
|
@onChange={{@onSetSourceMode}}
|
|
/>
|
|
|
|
<div class="sidebar-content" {{restoreScroll @scrollTop}}>
|
|
{{#if @isLoading}}
|
|
<div class="sidebar-loading">
|
|
<Icon @name="loading-ring" @size={{24}} @color="#898989" />
|
|
</div>
|
|
{{else if (and (not @isConnected) (eq @sourceMode "home"))}}
|
|
<p class="empty-state">
|
|
<a
|
|
href="#"
|
|
role="button"
|
|
tabindex="0"
|
|
{{on "click" this.openNostrConnectModal}}
|
|
>Connect your Nostr account</a>
|
|
to see your activity.
|
|
</p>
|
|
{{else if (not @items.length)}}
|
|
<p class="empty-state">No activity yet.</p>
|
|
{{else}}
|
|
<ul class="activity-list">
|
|
{{#each @items as |item|}}
|
|
{{#if (eq item.type "zap")}}
|
|
<ActivityZapItem @item={{item}} @onSelect={{@onSelect}} />
|
|
{{else if (eq item.type "photo")}}
|
|
<ActivityPhotoItem @item={{item}} @onSelect={{@onSelect}} />
|
|
{{/if}}
|
|
{{/each}}
|
|
<li
|
|
class="activity-load-more"
|
|
{{observeIntersection @onSentinelVisibility (not @hasMore)}}
|
|
>
|
|
{{#if @isLoadingMore}}
|
|
<div class="activity-load-more-spinner">
|
|
<Icon @name="loading-ring" @size={{24}} @color="#898989" />
|
|
</div>
|
|
{{/if}}
|
|
</li>
|
|
</ul>
|
|
{{/if}}
|
|
</div>
|
|
</div>
|
|
|
|
{{#if this.isNostrConnectModalOpen}}
|
|
<Modal @onClose={{this.closeNostrConnectModal}}>
|
|
<NostrConnect @onConnect={{this.onNostrConnected}} />
|
|
</Modal>
|
|
{{/if}}
|
|
</template>
|
|
}
|