This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
outline/app/scenes/Starred/Starred.js

39 lines
1.1 KiB
JavaScript
Raw Normal View History

// @flow
2018-05-05 23:16:08 +00:00
import * as React from 'react';
2017-06-28 05:15:29 +00:00
import { observer, inject } from 'mobx-react';
import CenteredContent from 'components/CenteredContent';
import { ListPlaceholder } from 'components/LoadingPlaceholder';
import Empty from 'components/Empty';
import PageTitle from 'components/PageTitle';
import DocumentList from 'components/DocumentList';
2017-06-28 05:15:29 +00:00
import DocumentsStore from 'stores/DocumentsStore';
2018-05-05 23:16:08 +00:00
type Props = {
documents: DocumentsStore,
};
2018-05-05 23:16:08 +00:00
@observer
class Starred extends React.Component<Props> {
componentDidMount() {
2017-06-28 05:15:29 +00:00
this.props.documents.fetchStarred();
}
render() {
const { isLoaded, isFetching, starred } = this.props.documents;
const showLoading = !isLoaded && isFetching;
const showEmpty = isLoaded && !starred.length;
return (
<CenteredContent column auto>
<PageTitle title="Starred" />
<h1>Starred</h1>
{showLoading && <ListPlaceholder />}
{showEmpty && <Empty>No starred documents yet.</Empty>}
<DocumentList documents={starred} />
</CenteredContent>
);
}
}
2017-06-28 05:15:29 +00:00
export default inject('documents')(Starred);