Added empty state on user profiles when no documents edited

This commit is contained in:
Tom Moor 2019-03-09 18:55:54 -08:00
parent f11bba6b63
commit f75783c2f1
2 changed files with 14 additions and 6 deletions

View File

@ -15,6 +15,7 @@ type Props = {
documents: Document[],
fetch: (options: ?Object) => Promise<*>,
options?: Object,
empty?: React.Node,
};
@observer
@ -65,15 +66,19 @@ class PaginatedDocumentList extends React.Component<Props> {
};
render() {
const { showCollection, showPublished, documents } = this.props;
const { showCollection, showPublished, empty, documents } = this.props;
return this.isLoaded || documents.length ? (
<React.Fragment>
<DocumentList
documents={documents}
showCollection={showCollection}
showPublished={showPublished}
/>
{documents.length ? (
<DocumentList
documents={documents}
showCollection={showCollection}
showPublished={showPublished}
/>
) : (
empty
)}
{this.allowLoadMore && (
<Waypoint key={this.offset} onEnter={this.loadMoreResults} />
)}

View File

@ -61,6 +61,9 @@ class UserProfile extends React.Component<Props> {
documents={documents.createdByUser(user.id)}
fetch={documents.fetchOwned}
options={{ user: user.id }}
empty={
<HelpText>{user.name} hasnt updated any documents yet.</HelpText>
}
showCollection
/>
</Flex>