import Telescope from 'meteor/nova:lib';
import React, { PropTypes, Component } from 'react';
import { FormattedMessage } from 'react-intl';
import { ListContainer } from "meteor/utilities:react-list-container";
import Posts from "meteor/nova:posts";
import Users from 'meteor/nova:users';
import { Link } from 'react-router';
import { graphql } from 'react-apollo';
import gql from 'graphql-tag';
const UsersProfilePostsList = (props, context) => {
const {loading, posts, refetch} = props.data;
return loading ?
:
{console.log("load more")}}
refetchQuery={refetch}
/>;
};
UsersProfilePostsList.propTypes = {
data: React.PropTypes.shape({
loading: React.PropTypes.bool,
posts: React.PropTypes.array,
}).isRequired,
params: React.PropTypes.object
};
UsersProfilePostsList.contextTypes = {
currentUser: React.PropTypes.object
};
UsersProfilePostsList.displayName = "UsersProfilePostsList";
const UsersProfilePostsListWithData = graphql(gql`
query getPosts($terms: Terms, $offset: Int, $limit: Int) {
posts(terms: $terms, offset: $offset, limit: $limit) {
_id
title
url
slug
htmlBody
thumbnailUrl
baseScore
postedAt
sticky
categories {
_id
name
slug
}
commentCount
upvoters {
_id
}
downvoters {
_id
}
upvotes # should be asked only for admins?
score # should be asked only for admins?
viewCount # should be asked only for admins?
clickCount # should be asked only for admins?
user {
_id
telescope {
displayName
slug
emailHash
}
}
}
}
`, {
options(ownProps) {
return {
variables: {
// get the view from the query params or ask for the 'top' one as a default
terms: ownProps.terms,
offset: 0,
limit: 10
},
pollInterval: 20000,
};
},
})(UsersProfilePostsList);
const UsersProfile = ({user}, {currentUser}) => {
const twitterName = Users.getTwitterName(user);
const terms = {view: "userPosts", userId: user._id};
const {selector, options} = Posts.parameters.get(terms);
return (
{Users.getDisplayName(user)}
{user.telescope.bio}
)
}
UsersProfile.propTypes = {
user: React.PropTypes.object.isRequired,
}
UsersProfile.contextTypes = {
currentUser: React.PropTypes.object
}
UsersProfile.displayName = "UsersProfile";
module.exports = UsersProfile;
//