diff --git a/src/js/Helpers.tsx b/src/js/Helpers.tsx index e4f5e4a1..f1492bf6 100644 --- a/src/js/Helpers.tsx +++ b/src/js/Helpers.tsx @@ -841,14 +841,14 @@ export default { } }, 100), - animateScrollTop: (selector: string): void => { - const el = $(selector); + animateScrollTop: (selector?: string): void => { + const el = selector ? $(selector) : $(window); el.css({ overflow: 'hidden' }); setTimeout(() => { el.css({ overflow: '' }); el.on('scroll mousedown wheel DOMMouseScroll mousewheel keyup touchstart', (e) => { if ( - (e.which && e.which > 0) || + e.which > 0 || e.type === 'mousedown' || e.type === 'mousewheel' || e.type === 'touchstart' diff --git a/src/js/components/feed/BaseFeed.tsx b/src/js/components/feed/BaseFeed.tsx index 162971c0..16c95340 100644 --- a/src/js/components/feed/BaseFeed.tsx +++ b/src/js/components/feed/BaseFeed.tsx @@ -138,19 +138,6 @@ class Feed extends BaseComponent { console.log('load more events', this.state.displayCount, this.props.scrollElement); } } - this.checkScrollPosition(); - }; - - checkScrollPosition = () => { - // if scrolled past this.base element's start, apply fixedTop class to it - if (!this.props.scrollElement) { - return; - } - const showNewMsgsFixedTop = - this.props.scrollElement.scrollTop > (this.base as HTMLElement).offsetTop - 60; - if (showNewMsgsFixedTop !== this.state.showNewMsgsFixedTop) { - this.setState({ showNewMsgsFixedTop }); - } }; componentWillUnmount() { @@ -185,7 +172,7 @@ class Feed extends BaseComponent { let first = true; localState.get('scrollUp').on( this.sub(() => { - !first && Helpers.animateScrollTop('.main-view'); + !first && Helpers.animateScrollTop(); first = false; }), ); @@ -291,7 +278,7 @@ class Feed extends BaseComponent { this.handleScroll(); this.replaceState(); if (!this.state.queuedEvents.length && prevState.queuedEvents.length) { - Helpers.animateScrollTop('.main-view'); + Helpers.animateScrollTop(); } if (this.props.filter !== prevProps.filter || this.props.keyword !== prevProps.keyword) { this.setState({ sortedEvents: [] }); @@ -310,17 +297,18 @@ class Feed extends BaseComponent { eventsShownTime: Math.floor(Date.now() / 1000), displayCount: INITIAL_PAGE_SIZE, }); + Helpers.animateScrollTop(); } renderShowNewEvents() { return ( -
this.showQueuedEvents()} - > - {t('show_n_new_messages').replace('{n}', this.state.queuedEvents.length)} +
+
this.showQueuedEvents()} + > + {t('show_n_new_messages').replace('{n}', this.state.queuedEvents.length)} +
); } diff --git a/src/js/views/Profile.tsx b/src/js/views/Profile.tsx index 246a9437..0e09dae2 100644 --- a/src/js/views/Profile.tsx +++ b/src/js/views/Profile.tsx @@ -46,8 +46,8 @@ class Profile extends View { getNotification() { if (this.state.noFollowers && this.followers.has(Key.getPubKey())) { return html` -
-
+
+

Share your profile link so ${this.state.name || 'this user'} can follow you:

<${Copy} text=${t('copy_link')} copyStr=${Helpers.getMyProfileLink()} /> @@ -134,15 +134,15 @@ class Profile extends View { const loggedIn = this.state.loggedIn; // TODO: on Follow / Message btn click open login modal if not logged in return html` -

-
-
+
+
+
${profilePicture}
-
+
!loggedIn && localState.get('showLoginModal').put(true)}> ${this.state.isMyProfile ? html`
-
+
<${Dropdown}> <${Copy} className="btn btn-sm" @@ -206,19 +206,19 @@ class Profile extends View {
-
-
+
+
<${Name} pub=${this.state.hexPub} /> ${this.state.nip05 - ? html`
${this.state.nip05.replace(/^_@/, '')}` : ''}
-
+
${this.state.followedUserCount} ${t('following')} @@ -231,7 +231,7 @@ class Profile extends View { : ''}
-

${this.state.about}

+

${this.state.about}

${this.renderLinks()}
@@ -250,21 +250,21 @@ class Profile extends View { renderTabs() { return html` -
+
<${Link} - className="btn btn-sm" + className="btn btn-sm btn-neutral" activeClassName="btn-primary" href="/${this.state.nostrAddress || this.state.npub}" >${t('posts')} ${this.state.noPosts ? '(0)' : ''} <${Link} - className="btn btn-sm" + className="btn btn-sm btn-neutral" activeClassName="btn-primary" href="/${this.state.nostrAddress || this.state.npub}/replies" >${t('posts')} & ${t('replies')} ${this.state.noReplies ? '(0)' : ''} <${Link} - className="btn btn-sm" + className="btn btn-sm btn-neutral" activeClassName="btn-primary" href="/${this.state.nostrAddress || this.state.npub}/likes" >${t('likes')} ${this.state.noLikes ? '(0)' : ''} +
<${Feed} scrollElement=${this.scrollElement.current} key="replies${this.state.hexPub}" @@ -290,7 +290,7 @@ class Profile extends View { `; } else if (this.props.tab === 'likes') { return html` -
+
<${Feed} scrollElement=${this.scrollElement.current} key="likes${this.state.hexPub}" @@ -305,7 +305,7 @@ class Profile extends View { return html`
-
+
${this.getNotification()} <${Feed} scrollElement=${this.scrollElement.current} @@ -331,7 +331,7 @@ class Profile extends View { ${this.state.banner ? html`
` : ''} -
+
<${Helmet}> ${title}