diff --git a/ui/src/common/LoadingSpinner.tsx b/ui/src/common/LoadingSpinner.tsx index 3f0df56..fc35a42 100644 --- a/ui/src/common/LoadingSpinner.tsx +++ b/ui/src/common/LoadingSpinner.tsx @@ -7,7 +7,7 @@ export default function LoadingSpinner() { return ( - + ); diff --git a/ui/src/message/Messages.tsx b/ui/src/message/Messages.tsx index 5b6eacc..120fe62 100644 --- a/ui/src/message/Messages.tsx +++ b/ui/src/message/Messages.tsx @@ -1,4 +1,3 @@ -import CircularProgress from '@material-ui/core/CircularProgress'; import Grid from '@material-ui/core/Grid'; import Typography from '@material-ui/core/Typography'; import React, {Component} from 'react'; @@ -12,6 +11,7 @@ import {observable} from 'mobx'; import ReactInfinite from 'react-infinite'; import {IMessage} from '../types'; import ConfirmDialog from '../common/ConfirmDialog'; +import LoadingSpinner from '../common/LoadingSpinner'; type IProps = RouteComponentProps<{id: string}>; @@ -87,7 +87,9 @@ class Messages extends Component, }> - {hasMessages ? ( + {!messagesStore.loaded(appId) ? ( + + ) : hasMessages ? (
, {messages.map(this.renderMessage)} - {hasMore ? ( - - - - ) : ( - this.label("You've reached the end") - )} + {hasMore ? : this.label("You've reached the end")}
) : ( this.label('No messages') diff --git a/ui/src/message/MessagesStore.ts b/ui/src/message/MessagesStore.ts index 7bd8eea..136d2a9 100644 --- a/ui/src/message/MessagesStore.ts +++ b/ui/src/message/MessagesStore.ts @@ -35,6 +35,8 @@ export class MessagesStore { return this.state[appId] || this.emptyState(); }; + public loaded = (appId: number) => this.stateOf(appId, /*create*/ false).loaded; + public canLoadMore = (appId: number) => this.stateOf(appId, /*create*/ false).hasMore; @action