From e0233c013307462738ce261c76bf3ca94b87b1e6 Mon Sep 17 00:00:00 2001 From: Travis Eden Date: Tue, 10 Jul 2018 10:25:38 -0400 Subject: [PATCH] separate busy indicator from content list and move to title bar --- .../component/common/busy-indicator.jsx | 20 +++++++++++---- src/renderer/page/channel/view.jsx | 25 +++++++++---------- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/src/renderer/component/common/busy-indicator.jsx b/src/renderer/component/common/busy-indicator.jsx index 759e91b5c0b..1dfae933206 100644 --- a/src/renderer/component/common/busy-indicator.jsx +++ b/src/renderer/component/common/busy-indicator.jsx @@ -5,10 +5,20 @@ type Props = { message: ?string, }; -const BusyIndicator = (props: Props) => ( - - {props.message} - -); +class BusyIndicator extends React.PureComponent { + static defaultProps = { + message: '', + }; + + render() { + const { message } = this.props; + + return ( + + {message} + + ); + } +} export default BusyIndicator; diff --git a/src/renderer/page/channel/view.jsx b/src/renderer/page/channel/view.jsx index 03324cf3f5a..da49f8e6a55 100644 --- a/src/renderer/page/channel/view.jsx +++ b/src/renderer/page/channel/view.jsx @@ -48,7 +48,7 @@ class ChannelPage extends React.PureComponent { this.props.navigate('/show', newParams); } - paginate(e, totalPages: number) { + paginate(e: SyntheticKeyboardEvent<*>, totalPages: number) { // Change page if enter was pressed, and the given page is between // the first and the last. const pageFromInput = Number(e.target.value); @@ -67,22 +67,21 @@ class ChannelPage extends React.PureComponent { const { fetching, claimsInChannel, claim, page, totalPages } = this.props; const { name, permanent_url: permanentUrl, claim_id: claimId } = claim; const currentPage = parseInt((page || 1) - 1, 10); - let contentList; - if (fetching) { - contentList = ; - } else { - contentList = - claimsInChannel && claimsInChannel.length ? ( - - ) : ( - {__('No content found.')} - ); - } + + const contentList = + claimsInChannel && claimsInChannel.length ? ( + + ) : ( + !fetching && {__('No content found.')} + ); return (
-

{name}

+

+ {name} + {fetching && } +