Added empty state on user profiles when no documents edited
This commit is contained in:
parent
f11bba6b63
commit
f75783c2f1
|
@ -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} />
|
||||
)}
|
||||
|
|
|
@ -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} hasn’t updated any documents yet.</HelpText>
|
||||
}
|
||||
showCollection
|
||||
/>
|
||||
</Flex>
|
||||
|
|
Reference in New Issue