Closes #929 – Clarify pin feature

This commit is contained in:
Tom Moor
2019-04-08 21:47:27 -07:00
parent 763f57a3dc
commit a3ca3447d1
4 changed files with 21 additions and 10 deletions

View File

@@ -17,6 +17,7 @@ type Props = {
context?: ?string,
showCollection?: boolean,
showPublished?: boolean,
showPin?: boolean,
link?: boolean,
ref?: *,
};
@@ -137,6 +138,7 @@ class DocumentPreview extends React.Component<Props> {
document,
showCollection,
showPublished,
showPin,
highlight,
context,
link,
@@ -172,7 +174,7 @@ class DocumentPreview extends React.Component<Props> {
)}
</Actions>
)}
<StyledDocumentMenu document={document} />
<StyledDocumentMenu document={document} showPin={showPin} />
</Heading>
{!queryIsInTitle && (
<ResultContext

View File

@@ -19,6 +19,7 @@ type Props = {
className: string,
showPrint?: boolean,
showToggleEmbeds?: boolean,
showPin?: boolean,
};
@observer
@@ -97,7 +98,7 @@ class DocumentMenu extends React.Component<Props> {
render() {
if (this.redirectTo) return <Redirect to={this.redirectTo} push />;
const { document, label, className, showPrint, auth } = this.props;
const { document, label, className, showPrint, showPin, auth } = this.props;
const canShareDocuments = auth.team && auth.team.sharing;
if (document.isArchived) {
@@ -117,13 +118,16 @@ class DocumentMenu extends React.Component<Props> {
<DropdownMenu label={label || <MoreIcon />} className={className}>
{!document.isDraft ? (
<React.Fragment>
{document.pinned ? (
<DropdownMenuItem onClick={this.handleUnpin}>
Unpin
</DropdownMenuItem>
) : (
<DropdownMenuItem onClick={this.handlePin}>Pin</DropdownMenuItem>
)}
{showPin &&
(document.pinned ? (
<DropdownMenuItem onClick={this.handleUnpin}>
Unpin
</DropdownMenuItem>
) : (
<DropdownMenuItem onClick={this.handlePin}>
Pin to collection
</DropdownMenuItem>
))}
{document.starred ? (
<DropdownMenuItem onClick={this.handleUnstar}>
Unstar

View File

@@ -195,7 +195,7 @@ class CollectionScene extends React.Component<Props> {
<Subheading>
<TinyPinIcon size={18} /> Pinned
</Subheading>
<DocumentList documents={pinnedDocuments} />
<DocumentList documents={pinnedDocuments} showPin />
</React.Fragment>
)}
@@ -222,6 +222,7 @@ class CollectionScene extends React.Component<Props> {
)}
fetch={documents.fetchAlphabetical}
options={{ collection: collection.id }}
showPin
/>
</Route>
<Route path={collectionUrl(collection.id, 'old')}>
@@ -232,6 +233,7 @@ class CollectionScene extends React.Component<Props> {
)}
fetch={documents.fetchLeastRecentlyUpdated}
options={{ collection: collection.id }}
showPin
/>
</Route>
<Route path={collectionUrl(collection.id, 'recent')}>
@@ -243,6 +245,7 @@ class CollectionScene extends React.Component<Props> {
fetch={documents.fetchRecentlyPublished}
options={{ collection: collection.id }}
showPublished
showPin
/>
</Route>
<Route path={collectionUrl(collection.id)}>
@@ -252,6 +255,7 @@ class CollectionScene extends React.Component<Props> {
)}
fetch={documents.fetchRecentlyUpdated}
options={{ collection: collection.id }}
showPin
/>
</Route>
</Switch>

View File

@@ -7738,6 +7738,7 @@ retry-axios@0.3.2, retry-axios@^0.3.2:
rich-markdown-editor@^9.1.2:
version "9.1.2"
resolved "https://registry.yarnpkg.com/rich-markdown-editor/-/rich-markdown-editor-9.1.2.tgz#869d2a66d93b84ae6878ad3917dd3a012cffb721"
integrity sha512-Sv9svBpH+rVktpNjD/73IpVTVE3atKVLt+Kdcx+o/DRkvJPdXwJkMYXM2jE8IIBRafgdGS/X6JZImVlsX5uHxQ==
dependencies:
"@tommoor/slate-edit-list" "0.19.0-0"
"@wikifactory/slate-edit-blockquote" "^0.7.1"