New published info location and author info
This commit is contained in:
42
frontend/components/AuthorInfo/AuthorInfo.js
Normal file
42
frontend/components/AuthorInfo/AuthorInfo.js
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
// @flow
|
||||||
|
import React, { Component } from 'react';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
import type { User } from 'types';
|
||||||
|
import { Flex } from 'reflexbox';
|
||||||
|
|
||||||
|
const Container = styled(Flex)`
|
||||||
|
justify-content: space-between;
|
||||||
|
color: #bbb;
|
||||||
|
font-size: 13px;
|
||||||
|
`;
|
||||||
|
|
||||||
|
class AuthorInfo extends Component {
|
||||||
|
props: {
|
||||||
|
collaborators: Array<User>,
|
||||||
|
views: number,
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { collaborators, views } = this.props;
|
||||||
|
|
||||||
|
const users = collaborators.map((user, index, arr) => (
|
||||||
|
<span key={user.id}>
|
||||||
|
{user.name} {arr.length > 1 && (index < arr.length - 1 ? ',' : 'and')}
|
||||||
|
</span>
|
||||||
|
));
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Container align="center">
|
||||||
|
Recently edited by
|
||||||
|
{' '}
|
||||||
|
{users}
|
||||||
|
{' '}
|
||||||
|
and viewed
|
||||||
|
{` ${views} `}
|
||||||
|
times.
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AuthorInfo;
|
3
frontend/components/AuthorInfo/index.js
Normal file
3
frontend/components/AuthorInfo/index.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
// @flow
|
||||||
|
import AuthorInfo from './AuthorInfo';
|
||||||
|
export default AuthorInfo;
|
@ -13,7 +13,7 @@ import Editor from 'components/Editor';
|
|||||||
import { HeaderAction, SaveAction } from 'components/Layout';
|
import { HeaderAction, SaveAction } from 'components/Layout';
|
||||||
import LoadingIndicator from 'components/LoadingIndicator';
|
import LoadingIndicator from 'components/LoadingIndicator';
|
||||||
import PublishingInfo from 'components/PublishingInfo';
|
import PublishingInfo from 'components/PublishingInfo';
|
||||||
import DocumentViews from 'components/DocumentViews';
|
import AuthorInfo from 'components/AuthorInfo';
|
||||||
import PreviewLoading from 'components/PreviewLoading';
|
import PreviewLoading from 'components/PreviewLoading';
|
||||||
import CenteredContent from 'components/CenteredContent';
|
import CenteredContent from 'components/CenteredContent';
|
||||||
import PageTitle from 'components/PageTitle';
|
import PageTitle from 'components/PageTitle';
|
||||||
@ -142,26 +142,29 @@ type Props = {
|
|||||||
updatedBy={this.document.updatedBy}
|
updatedBy={this.document.updatedBy}
|
||||||
/>
|
/>
|
||||||
</InfoWrapper>
|
</InfoWrapper>
|
||||||
<Editor
|
<Content>
|
||||||
key={this.document.id}
|
<Editor
|
||||||
text={this.document.text}
|
key={this.document.id}
|
||||||
onImageUploadStart={this.onImageUploadStart}
|
text={this.document.text}
|
||||||
onImageUploadStop={this.onImageUploadStop}
|
onImageUploadStart={this.onImageUploadStart}
|
||||||
onChange={this.onChange}
|
onImageUploadStop={this.onImageUploadStop}
|
||||||
onSave={this.onSave}
|
onChange={this.onChange}
|
||||||
onCancel={this.onCancel}
|
onSave={this.onSave}
|
||||||
onStar={this.document.star}
|
onCancel={this.onCancel}
|
||||||
onUnstar={this.document.unstar}
|
onStar={this.document.star}
|
||||||
starred={this.document.starred}
|
onUnstar={this.document.unstar}
|
||||||
readOnly={!isEditing}
|
starred={this.document.starred}
|
||||||
/>
|
readOnly={!isEditing}
|
||||||
|
/>
|
||||||
|
</Content>
|
||||||
|
<InfoWrapper visible={!isEditing} bottom>
|
||||||
|
<AuthorInfo
|
||||||
|
collaborators={this.document.collaborators}
|
||||||
|
views={this.document.views}
|
||||||
|
/>
|
||||||
|
</InfoWrapper>
|
||||||
</DocumentContainer>
|
</DocumentContainer>
|
||||||
<Meta align="center" justify="flex-end" readOnly={!isEditing}>
|
<Meta align="center" justify="flex-end" readOnly={!isEditing}>
|
||||||
{!isEditing &&
|
|
||||||
<DocumentViews
|
|
||||||
count={this.document.views}
|
|
||||||
documentId={this.document.id}
|
|
||||||
/>}
|
|
||||||
<Flex align="center">
|
<Flex align="center">
|
||||||
<HeaderAction>
|
<HeaderAction>
|
||||||
{isEditing
|
{isEditing
|
||||||
@ -190,6 +193,10 @@ const Meta = styled(Flex)`
|
|||||||
padding: 10px 20px;
|
padding: 10px 20px;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const Content = styled(Flex)`
|
||||||
|
margin-bottom: 20px;
|
||||||
|
`;
|
||||||
|
|
||||||
const InfoWrapper = styled(Flex)`
|
const InfoWrapper = styled(Flex)`
|
||||||
opacity: ${({ visible }) => (visible ? '1' : '0')};
|
opacity: ${({ visible }) => (visible ? '1' : '0')};
|
||||||
transition: all 100ms ease-in-out;
|
transition: all 100ms ease-in-out;
|
||||||
|
Reference in New Issue
Block a user