Added: Recently published view to collection
Added: Infinite scroll to collection
This commit is contained in:
@@ -7,12 +7,14 @@ import ArrowKeyNavigation from 'boundless-arrow-key-navigation';
|
||||
type Props = {
|
||||
documents: Document[],
|
||||
showCollection?: boolean,
|
||||
showPublished?: boolean,
|
||||
limit?: number,
|
||||
};
|
||||
|
||||
export default function DocumentList({
|
||||
limit,
|
||||
showCollection,
|
||||
showPublished,
|
||||
documents,
|
||||
}: Props) {
|
||||
const items = limit ? documents.splice(0, limit) : documents;
|
||||
@@ -27,6 +29,7 @@ export default function DocumentList({
|
||||
key={document.id}
|
||||
document={document}
|
||||
showCollection={showCollection}
|
||||
showPublished={showPublished}
|
||||
/>
|
||||
))}
|
||||
</ArrowKeyNavigation>
|
||||
|
||||
@@ -15,6 +15,7 @@ type Props = {
|
||||
highlight?: ?string,
|
||||
context?: ?string,
|
||||
showCollection?: boolean,
|
||||
showPublished?: boolean,
|
||||
ref?: *,
|
||||
};
|
||||
|
||||
@@ -133,6 +134,7 @@ class DocumentPreview extends React.Component<Props> {
|
||||
const {
|
||||
document,
|
||||
showCollection,
|
||||
showPublished,
|
||||
highlight,
|
||||
context,
|
||||
...rest
|
||||
@@ -173,6 +175,7 @@ class DocumentPreview extends React.Component<Props> {
|
||||
<PublishingInfo
|
||||
document={document}
|
||||
collection={showCollection ? document.collection : undefined}
|
||||
showPublished={showPublished}
|
||||
/>
|
||||
</DocumentLink>
|
||||
);
|
||||
|
||||
@@ -19,11 +19,12 @@ const Modified = styled.span`
|
||||
|
||||
type Props = {
|
||||
collection?: Collection,
|
||||
showPublished?: boolean,
|
||||
document: Document,
|
||||
views?: number,
|
||||
};
|
||||
|
||||
function PublishingInfo({ collection, document }: Props) {
|
||||
function PublishingInfo({ collection, showPublished, document }: Props) {
|
||||
const {
|
||||
modifiedSinceViewed,
|
||||
updatedAt,
|
||||
@@ -35,7 +36,7 @@ function PublishingInfo({ collection, document }: Props) {
|
||||
|
||||
return (
|
||||
<Container align="center">
|
||||
{publishedAt && neverUpdated ? (
|
||||
{publishedAt && (neverUpdated || showPublished) ? (
|
||||
<span>
|
||||
{updatedBy.name} published <Time dateTime={publishedAt} /> ago
|
||||
</span>
|
||||
@@ -48,7 +49,7 @@ function PublishingInfo({ collection, document }: Props) {
|
||||
</span>
|
||||
) : (
|
||||
<Modified highlight={modifiedSinceViewed}>
|
||||
modified <Time dateTime={updatedAt} /> ago
|
||||
updated <Time dateTime={updatedAt} /> ago
|
||||
</Modified>
|
||||
)}
|
||||
</React.Fragment>
|
||||
|
||||
@@ -11,6 +11,7 @@ import { ListPlaceholder } from 'components/LoadingPlaceholder';
|
||||
|
||||
type Props = {
|
||||
showCollection?: boolean,
|
||||
showPublished?: boolean,
|
||||
documents: Document[],
|
||||
fetch: (options: ?Object) => Promise<*>,
|
||||
options?: Object,
|
||||
@@ -64,11 +65,15 @@ class PaginatedDocumentList extends React.Component<Props> {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { showCollection, documents } = this.props;
|
||||
const { showCollection, showPublished, documents } = this.props;
|
||||
|
||||
return this.isLoaded || documents.length ? (
|
||||
<React.Fragment>
|
||||
<DocumentList documents={documents} showCollection={showCollection} />
|
||||
<DocumentList
|
||||
documents={documents}
|
||||
showCollection={showCollection}
|
||||
showPublished={showPublished}
|
||||
/>
|
||||
{this.allowLoadMore && (
|
||||
<Waypoint key={this.offset} onEnter={this.loadMoreResults} />
|
||||
)}
|
||||
|
||||
@@ -59,6 +59,7 @@ class CollectionLink extends React.Component<Props> {
|
||||
hideDisclosure
|
||||
menuOpen={this.menuOpen}
|
||||
label={collection.name}
|
||||
exact={false}
|
||||
menu={
|
||||
<CollectionMenu
|
||||
history={history}
|
||||
|
||||
Reference in New Issue
Block a user