diff --git a/packages/nova-base-components/lib/posts/PostsHome.jsx b/packages/nova-base-components/lib/posts/PostsHome.jsx
index b51601430..e8261555f 100644
--- a/packages/nova-base-components/lib/posts/PostsHome.jsx
+++ b/packages/nova-base-components/lib/posts/PostsHome.jsx
@@ -37,8 +37,8 @@ PostsHome.contextTypes = {
};
const PostsHomeWithData = graphql(gql`
- query getPosts($view: String, $offset: Int, $limit: Int) {
- posts(view: $view, offset: $offset, limit: $limit) {
+ query getPosts($terms: Terms, $offset: Int, $limit: Int) {
+ posts(terms: $terms, offset: $offset, limit: $limit) {
_id
title
url
@@ -77,10 +77,11 @@ const PostsHomeWithData = graphql(gql`
`, {
options(ownProps) {
+ const view = ownProps.location && ownProps.location.query && ownProps.location.query.view || 'top';
return {
variables: {
// get the view from the query params or ask for the 'top' one as a default
- view: ownProps.location && ownProps.location.query && ownProps.location.query.view || 'top',
+ terms: { view },
offset: 0,
limit: 10
},
diff --git a/packages/nova-base-components/lib/users/UsersProfile.jsx b/packages/nova-base-components/lib/users/UsersProfile.jsx
index a6e6591fa..af4bc80b4 100644
--- a/packages/nova-base-components/lib/users/UsersProfile.jsx
+++ b/packages/nova-base-components/lib/users/UsersProfile.jsx
@@ -6,11 +6,97 @@ 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 terms = {view: "userPosts", userId: user._id};
const {selector, options} = Posts.parameters.get(terms);
return (
@@ -26,18 +112,7 @@ const UsersProfile = ({user}, {currentUser}) => {
-
+
)
}
@@ -52,4 +127,17 @@ UsersProfile.contextTypes = {
UsersProfile.displayName = "UsersProfile";
-module.exports = UsersProfile;
\ No newline at end of file
+module.exports = UsersProfile;
+
+//
\ No newline at end of file