]> cat aescling's git repositories - mastodon.git/commitdiff
[Glitch] Make account media gallery more consistent with account timeline
authorThibaut Girka <thib@sitedethib.com>
Wed, 12 Dec 2018 17:06:00 +0000 (18:06 +0100)
committerThibG <thib@sitedethib.com>
Thu, 13 Dec 2018 14:00:36 +0000 (15:00 +0100)
Display “load more” more consistently, add a loading indicator on first load.

app/javascript/flavours/glitch/features/account_gallery/index.js

index 0405af2c33c9cf06e3faf10928c53f2757b5b391..a77db1c1b8526125e786001cec8fb1b92a1a0e2c 100644 (file)
@@ -107,8 +107,8 @@ export default class AccountGallery extends ImmutablePureComponent {
       );
     }
 
-    if (!isLoading && medias.size > 0 && hasMore) {
-      loadOlder = <LoadMore onClick={this.handleLoadOlder} />;
+    if (hasMore) {
+      loadOlder = <LoadMore visible={!isLoading} onClick={this.handleLoadOlder} />;
     }
 
     return (
@@ -116,10 +116,10 @@ export default class AccountGallery extends ImmutablePureComponent {
         <ColumnBackButton />
 
         <ScrollContainer scrollKey='account_gallery' shouldUpdateScroll={this.shouldUpdateScroll}>
-          <div className='scrollable' onScroll={this.handleScroll}>
+          <div className='scrollable scrollable--flex' onScroll={this.handleScroll}>
             <HeaderContainer accountId={this.props.params.accountId} />
 
-            <div className='account-gallery__container'>
+            <div role='feed' className='account-gallery__container'>
               {medias.map((media, index) => media === null ? (
                 <LoadMoreMedia
                   key={'more:' + medias.getIn(index + 1, 'id')}
@@ -134,6 +134,12 @@ export default class AccountGallery extends ImmutablePureComponent {
               ))}
               {loadOlder}
             </div>
+
+            {isLoading && medias.size === 0 && (
+              <div className='scrollable__append'>
+                <LoadingIndicator />
+              </div>
+            )}
           </div>
         </ScrollContainer>
       </Column>