@ -25,15 +25,20 @@ const Collaborators = function({ document }: { document: Document }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Avatars>
|
<Avatars>
|
||||||
<Tooltip tooltip={tooltip} placement="bottom">
|
<StyledTooltip tooltip={tooltip} placement="bottom">
|
||||||
{collaborators.map(user => (
|
{collaborators.map(user => (
|
||||||
<Avatar key={user.id} src={user.avatarUrl} />
|
<Avatar key={user.id} src={user.avatarUrl} />
|
||||||
))}
|
))}
|
||||||
</Tooltip>
|
</StyledTooltip>
|
||||||
</Avatars>
|
</Avatars>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const StyledTooltip = styled(Tooltip)`
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row-reverse;
|
||||||
|
`;
|
||||||
|
|
||||||
const Avatars = styled(Flex)`
|
const Avatars = styled(Flex)`
|
||||||
flex-direction: row-reverse;
|
flex-direction: row-reverse;
|
||||||
height: 26px;
|
height: 26px;
|
||||||
@ -45,7 +50,7 @@ const Avatar = styled.img`
|
|||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
border: 2px solid ${color.white};
|
border: 2px solid ${color.white};
|
||||||
margin-right: -13px;
|
margin-right: -10px;
|
||||||
|
|
||||||
&:first-child {
|
&:first-child {
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
|
@ -15,13 +15,18 @@ type Props = {
|
|||||||
innerRef?: Function,
|
innerRef?: Function,
|
||||||
};
|
};
|
||||||
|
|
||||||
const StyledStar = styled(Icon).attrs({
|
const StyledStar = styled(({ solid, ...props }) => <Icon {...props} />).attrs({
|
||||||
type: 'Star',
|
type: 'Star',
|
||||||
color: color.text,
|
color: color.text,
|
||||||
})`
|
})`
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
top: 1px;
|
||||||
margin-left: 4px;
|
margin-left: 4px;
|
||||||
opacity: ${props => (props.solid ? '1 !important' : 0)};
|
opacity: ${props => (props.solid ? '1 !important' : 0)};
|
||||||
transition: opacity 100ms ease-in-out;
|
transition: opacity 100ms ease-in-out;
|
||||||
|
|
||||||
|
${props => props.solid && 'polygon { fill: #000};'}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const DocumentLink = styled(Link)`
|
const DocumentLink = styled(Link)`
|
||||||
|
@ -92,12 +92,15 @@ const MenuItem = styled.div`
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border-left: 2px solid transparent;
|
border-left: 2px solid transparent;
|
||||||
|
|
||||||
|
color: ${color.text};
|
||||||
|
|
||||||
span {
|
span {
|
||||||
margin-top: 2px;
|
margin-top: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
color: ${color.text};
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ import styled from 'styled-components';
|
|||||||
import { color } from 'styles/constants';
|
import { color } from 'styles/constants';
|
||||||
|
|
||||||
const HelpText = styled.p`
|
const HelpText = styled.p`
|
||||||
user-select: none;
|
|
||||||
color: ${color.slateDark};
|
color: ${color.slateDark};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@ -1,11 +1,16 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import _ from 'lodash';
|
||||||
import ReactCSSTransitionGroup from 'react-addons-css-transition-group';
|
import ReactCSSTransitionGroup from 'react-addons-css-transition-group';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import Mask from './components/Mask';
|
import Mask from './components/Mask';
|
||||||
import Flex from 'components/Flex';
|
import Flex from 'components/Flex';
|
||||||
|
|
||||||
export default (props: Object) => {
|
type Props = {
|
||||||
|
count?: number,
|
||||||
|
};
|
||||||
|
|
||||||
|
const ListPlaceHolder = ({ count }: Props) => {
|
||||||
return (
|
return (
|
||||||
<ReactCSSTransitionGroup
|
<ReactCSSTransitionGroup
|
||||||
transitionName="fadeIn"
|
transitionName="fadeIn"
|
||||||
@ -16,14 +21,12 @@ export default (props: Object) => {
|
|||||||
transitionEnter
|
transitionEnter
|
||||||
transitionLeave
|
transitionLeave
|
||||||
>
|
>
|
||||||
<Item column auto>
|
{_.times(count || 2, index => (
|
||||||
<Mask header />
|
<Item key={index} column auto>
|
||||||
<Mask />
|
|
||||||
</Item>
|
|
||||||
<Item column auto>
|
|
||||||
<Mask header />
|
<Mask header />
|
||||||
<Mask />
|
<Mask />
|
||||||
</Item>
|
</Item>
|
||||||
|
))}
|
||||||
</ReactCSSTransitionGroup>
|
</ReactCSSTransitionGroup>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -31,3 +34,5 @@ export default (props: Object) => {
|
|||||||
const Item = styled(Flex)`
|
const Item = styled(Flex)`
|
||||||
padding: 18px 0;
|
padding: 18px 0;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export default ListPlaceHolder;
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { observable } from 'mobx';
|
||||||
import { observer, inject } from 'mobx-react';
|
import { observer, inject } from 'mobx-react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import DocumentsStore from 'stores/DocumentsStore';
|
import DocumentsStore from 'stores/DocumentsStore';
|
||||||
|
import Flex from 'components/Flex';
|
||||||
import DocumentList from 'components/DocumentList';
|
import DocumentList from 'components/DocumentList';
|
||||||
import PageTitle from 'components/PageTitle';
|
import PageTitle from 'components/PageTitle';
|
||||||
import CenteredContent from 'components/CenteredContent';
|
import CenteredContent from 'components/CenteredContent';
|
||||||
@ -26,29 +28,33 @@ type Props = {
|
|||||||
|
|
||||||
@observer class Dashboard extends React.Component {
|
@observer class Dashboard extends React.Component {
|
||||||
props: Props;
|
props: Props;
|
||||||
|
@observable isLoaded = false;
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.props.documents.fetchRecentlyModified({ limit: 5 });
|
this.loadContent();
|
||||||
this.props.documents.fetchRecentlyViewed({ limit: 5 });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get showPlaceholder() {
|
loadContent = async () => {
|
||||||
const { isLoaded, isFetching } = this.props.documents;
|
await Promise.all([
|
||||||
return !isLoaded && isFetching;
|
this.props.documents.fetchRecentlyModified({ limit: 5 }),
|
||||||
}
|
this.props.documents.fetchRecentlyViewed({ limit: 5 }),
|
||||||
|
]);
|
||||||
|
this.isLoaded = true;
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<CenteredContent>
|
<CenteredContent>
|
||||||
<PageTitle title="Home" />
|
<PageTitle title="Home" />
|
||||||
<h1>Home</h1>
|
<h1>Home</h1>
|
||||||
|
{this.isLoaded
|
||||||
|
? <Flex column>
|
||||||
<Subheading>Recently viewed</Subheading>
|
<Subheading>Recently viewed</Subheading>
|
||||||
{this.showPlaceholder && <ListPlaceholder />}
|
|
||||||
<DocumentList documents={this.props.documents.recentlyViewed} />
|
<DocumentList documents={this.props.documents.recentlyViewed} />
|
||||||
|
|
||||||
<Subheading>Recently edited</Subheading>
|
<Subheading>Recently edited</Subheading>
|
||||||
<DocumentList documents={this.props.documents.recentlyEdited} />
|
<DocumentList documents={this.props.documents.recentlyEdited} />
|
||||||
{this.showPlaceholder && <ListPlaceholder />}
|
</Flex>
|
||||||
|
: <ListPlaceholder count={5} />}
|
||||||
</CenteredContent>
|
</CenteredContent>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ class DocumentsStore extends BaseStore {
|
|||||||
};
|
};
|
||||||
|
|
||||||
@action fetchRecentlyModified = async (options: ?Object): Promise<*> => {
|
@action fetchRecentlyModified = async (options: ?Object): Promise<*> => {
|
||||||
return this.fetchAll('list', options);
|
return await this.fetchAll('list', options);
|
||||||
};
|
};
|
||||||
|
|
||||||
@action fetchRecentlyViewed = async (options: ?Object): Promise<*> => {
|
@action fetchRecentlyViewed = async (options: ?Object): Promise<*> => {
|
||||||
|
Reference in New Issue
Block a user