* WIP: Archive * WIP * Finishing up archive endpoints * WIP * Update docs * Flow * Stash * Add toast message confirmations * Redirect handling, fixed publishhing info for archived docs * Redirect to collection instead of home, remove unused pub info * Account for deleted parent * Trash -> Archive Allow reading of archived docs * Dont overload deletedAt * Fixes * 💚 * ParentDocumentId wipe for unarchived sub docs * Fix: CMD+S exits editing Fix: Duplicate user name on published but unedited docs * Improve jank on paginated lists * Prevent editing when archived * 💚 Separate lint / flow steps
56 lines
1.7 KiB
JavaScript
56 lines
1.7 KiB
JavaScript
// @flow
|
||
import * as React from 'react';
|
||
import { observer, inject } from 'mobx-react';
|
||
import { NewDocumentIcon } from 'outline-icons';
|
||
|
||
import Heading from 'components/Heading';
|
||
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';
|
||
import Subheading from 'components/Subheading';
|
||
import NewDocumentMenu from 'menus/NewDocumentMenu';
|
||
import Actions, { Action } from 'components/Actions';
|
||
import DocumentsStore from 'stores/DocumentsStore';
|
||
|
||
type Props = {
|
||
documents: DocumentsStore,
|
||
};
|
||
|
||
@observer
|
||
class Drafts extends React.Component<Props> {
|
||
componentDidMount() {
|
||
this.props.documents.fetchDrafts();
|
||
}
|
||
|
||
render() {
|
||
const { isLoaded, isFetching, drafts } = this.props.documents;
|
||
const showLoading = !isLoaded && isFetching;
|
||
const showEmpty = isLoaded && !drafts.length;
|
||
|
||
return (
|
||
<CenteredContent column auto>
|
||
<PageTitle title="Drafts" />
|
||
<Heading>Drafts</Heading>
|
||
{showLoading && <ListPlaceholder />}
|
||
{showEmpty ? (
|
||
<Empty>You’ve not got any drafts at the moment.</Empty>
|
||
) : (
|
||
<React.Fragment>
|
||
<Subheading>Documents</Subheading>
|
||
<DocumentList documents={drafts} showCollection />
|
||
</React.Fragment>
|
||
)}
|
||
<Actions align="center" justify="flex-end">
|
||
<Action>
|
||
<NewDocumentMenu label={<NewDocumentIcon />} />
|
||
</Action>
|
||
</Actions>
|
||
</CenteredContent>
|
||
);
|
||
}
|
||
}
|
||
|
||
export default inject('documents')(Drafts);
|