diff --git a/app/scenes/Document/Document.js b/app/scenes/Document/Document.js index 87fa7ff1e..519aee49b 100644 --- a/app/scenes/Document/Document.js +++ b/app/scenes/Document/Document.js @@ -26,6 +26,7 @@ import DocumentMove from './components/DocumentMove'; import UiStore from 'stores/UiStore'; import AuthStore from 'stores/AuthStore'; import DocumentsStore from 'stores/DocumentsStore'; +import CollectionsStore from 'stores/CollectionsStore'; import LoadingPlaceholder from 'components/LoadingPlaceholder'; import LoadingIndicator from 'components/LoadingIndicator'; import CenteredContent from 'components/CenteredContent'; @@ -50,6 +51,7 @@ type Props = { history: Object, location: Location, documents: DocumentsStore, + collections: CollectionsStore, newDocument?: boolean, auth: AuthStore, ui: UiStore, @@ -248,7 +250,7 @@ class DocumentScene extends React.Component { }; render() { - const { location, match, ui } = this.props; + const { location, match } = this.props; const Editor = this.editorComponent; const isMoving = match.path === matchDocumentMove; const document = this.document; diff --git a/app/scenes/Document/components/Breadcrumb.js b/app/scenes/Document/components/Breadcrumb.js index 352a1f005..914b4bea8 100644 --- a/app/scenes/Document/components/Breadcrumb.js +++ b/app/scenes/Document/components/Breadcrumb.js @@ -1,26 +1,31 @@ // @flow import * as React from 'react'; +import { observer, inject } from 'mobx-react'; import breakpoint from 'styled-components-breakpoint'; import styled from 'styled-components'; import { Link } from 'react-router-dom'; import { CollectionIcon, GoToIcon } from 'outline-icons'; +import Document from 'models/Document'; +import CollectionsStore from 'stores/CollectionsStore'; import { collectionUrl } from 'utils/routeHelpers'; import Flex from 'shared/components/Flex'; -import Document from 'models/Document'; type Props = { document: Document, + collections: CollectionsStore, }; -const Breadcrumb = ({ document }: Props) => { +const Breadcrumb = observer(({ document, collections }: Props) => { const path = document.pathToDocument.slice(0, -1); + const collection = + collections.getById(document.collection.id) || document.collection; return ( - - {' '} - {document.collection.name} + + {' '} + {collection.name} {path.map(n => ( @@ -29,7 +34,7 @@ const Breadcrumb = ({ document }: Props) => { ))} ); -}; +}); const Wrapper = styled(Flex)` width: 33.3%; @@ -41,6 +46,7 @@ const Wrapper = styled(Flex)` `; const Slash = styled(GoToIcon)` + flex-shrink: 0; opacity: 0.25; `; @@ -58,10 +64,13 @@ const Crumb = styled(Link)` `; const CollectionName = styled(Link)` + display: flex; + flex-shrink: 0; color: ${props => props.theme.text}; font-size: 15px; - display: flex; font-weight: 500; + white-space: nowrap; + overflow: hidden; `; -export default Breadcrumb; +export default inject('collections')(Breadcrumb); diff --git a/app/scenes/Document/components/Header.js b/app/scenes/Document/components/Header.js index b3a7b28cf..6428f66fb 100644 --- a/app/scenes/Document/components/Header.js +++ b/app/scenes/Document/components/Header.js @@ -95,6 +95,12 @@ class Header extends React.Component { {!isDraft && !isEditing && } + {isSaving && + !isPublishing && ( + + Saving… + + )} {isDraft && ( { {isEditing && ( - {isSaving && !isPublishing && Saving…} { isSaving={isSaving} highlight={!isDraft} > - Done + {isDraft ? 'Save Draft' : 'Done'} - {isDraft && } )} {!isEditing && ( @@ -160,7 +164,6 @@ class Header extends React.Component { const Status = styled.div` color: ${props => props.theme.slate}; - margin-right: 12px; `; const Wrapper = styled(Flex)`