stacker.news/fragments/users.js

103 lines
1.7 KiB
JavaScript
Raw Normal View History

2021-09-24 21:28:21 +00:00
import { gql } from '@apollo/client'
2021-10-26 20:49:37 +00:00
import { COMMENT_FIELDS } from './comments'
2021-09-30 15:46:58 +00:00
import { ITEM_FIELDS, ITEM_WITH_COMMENTS } from './items'
2021-09-24 21:28:21 +00:00
2021-11-28 17:29:17 +00:00
export const ME = gql`
{
me {
id
name
sats
stacked
freePosts
freeComments
hasNewNotes
tipDefault
bio {
id
}
hasInvites
theme
2021-12-09 20:40:40 +00:00
upvotePopover
tipPopover
2021-11-28 17:29:17 +00:00
}
}`
2021-09-24 21:28:21 +00:00
export const USER_FIELDS = gql`
${ITEM_FIELDS}
fragment UserFields on User {
id
createdAt
name
nitems
ncomments
stacked
sats
bio {
...ItemFields
text
}
}`
2021-09-30 15:46:58 +00:00
2021-12-17 00:39:19 +00:00
export const TOP_USERS = gql`
query TopUsers($cursor: String, $within: String!) {
topUsers(cursor: $cursor, within: $within) {
users {
name
stacked
}
cursor
}
}
`
2021-10-26 20:49:37 +00:00
export const USER_FULL = gql`
2021-09-30 15:46:58 +00:00
${USER_FIELDS}
${ITEM_WITH_COMMENTS}
2021-10-26 20:49:37 +00:00
query User($name: String!) {
user(name: $name) {
2021-09-30 15:46:58 +00:00
...UserFields
bio {
...ItemWithComments
}
}
}`
2021-10-26 20:49:37 +00:00
export const USER_WITH_COMMENTS = gql`
${USER_FIELDS}
${ITEM_WITH_COMMENTS}
${COMMENT_FIELDS}
query UserWithComments($name: String!) {
user(name: $name) {
...UserFields
bio {
...ItemWithComments
}
}
2021-12-16 23:05:31 +00:00
moreFlatComments(sort: "user", name: $name) {
2021-10-26 20:49:37 +00:00
cursor
comments {
...CommentFields
}
}
}`
export const USER_WITH_POSTS = gql`
${USER_FIELDS}
${ITEM_WITH_COMMENTS}
${ITEM_FIELDS}
query UserWithPosts($name: String!, $sort: String!) {
user(name: $name) {
...UserFields
bio {
...ItemWithComments
}
}
moreItems(sort: $sort, name: $name) {
cursor
items {
...ItemFields
}
}
}`