stacker.news/fragments/users.js

260 lines
5.3 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'
import { ITEM_FIELDS, ITEM_FULL_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
2023-02-01 14:44:35 +00:00
streak
sats
stacked
freePosts
freeComments
tipDefault
2022-12-09 19:25:38 +00:00
turboTipping
fiatCurrency
bioId
upvotePopover
tipPopover
noteItemSats
noteEarning
noteAllDescendants
noteMentions
noteDeposits
noteInvites
noteJobIndicator
2023-02-01 14:44:35 +00:00
noteCowboyHat
2022-08-30 21:50:47 +00:00
hideInvoiceDesc
2022-12-01 21:31:04 +00:00
hideFromTopUsers
2023-05-01 21:49:47 +00:00
hideCowboyHat
2022-09-21 19:57:36 +00:00
wildWestMode
2022-09-27 21:19:15 +00:00
greeterMode
lastCheckedJobs
}
}`
export const SETTINGS_FIELDS = gql`
fragment SettingsFields on User {
2022-06-02 22:55:23 +00:00
tipDefault
2022-12-09 19:25:38 +00:00
turboTipping
fiatCurrency
2022-06-02 22:55:23 +00:00
noteItemSats
noteEarning
noteAllDescendants
noteMentions
noteDeposits
noteInvites
noteJobIndicator
2023-02-01 14:44:35 +00:00
noteCowboyHat
2022-08-30 21:50:47 +00:00
hideInvoiceDesc
2022-12-01 21:31:04 +00:00
hideFromTopUsers
2023-05-01 21:49:47 +00:00
hideCowboyHat
2023-01-07 00:53:09 +00:00
nostrPubkey
nostrRelays
2022-09-21 19:57:36 +00:00
wildWestMode
2022-09-27 21:19:15 +00:00
greeterMode
2022-06-02 22:55:23 +00:00
authMethods {
lightning
2023-01-18 18:49:20 +00:00
slashtags
2022-06-02 22:55:23 +00:00
github
2023-01-18 18:49:20 +00:00
twitter
email
2022-06-02 22:55:23 +00:00
}
}`
export const SETTINGS = gql`
${SETTINGS_FIELDS}
{
settings {
...SettingsFields
2022-06-02 22:55:23 +00:00
}
}`
export const SET_SETTINGS =
gql`
${SETTINGS_FIELDS}
2022-12-09 19:25:38 +00:00
mutation setSettings($tipDefault: Int!, $turboTipping: Boolean!, $fiatCurrency: String!, $noteItemSats: Boolean!,
$noteEarning: Boolean!, $noteAllDescendants: Boolean!, $noteMentions: Boolean!, $noteDeposits: Boolean!,
2023-05-01 21:49:47 +00:00
$noteInvites: Boolean!, $noteJobIndicator: Boolean!, $noteCowboyHat: Boolean!, $hideInvoiceDesc: Boolean!,
$hideFromTopUsers: Boolean!, $hideCowboyHat: Boolean!,
2023-01-07 00:53:09 +00:00
$wildWestMode: Boolean!, $greeterMode: Boolean!, $nostrPubkey: String, $nostrRelays: [String!]) {
2022-12-09 19:25:38 +00:00
setSettings(tipDefault: $tipDefault, turboTipping: $turboTipping, fiatCurrency: $fiatCurrency,
noteItemSats: $noteItemSats, noteEarning: $noteEarning, noteAllDescendants: $noteAllDescendants,
noteMentions: $noteMentions, noteDeposits: $noteDeposits, noteInvites: $noteInvites,
2023-05-01 21:49:47 +00:00
noteJobIndicator: $noteJobIndicator, noteCowboyHat: $noteCowboyHat, hideInvoiceDesc: $hideInvoiceDesc,
hideFromTopUsers: $hideFromTopUsers, hideCowboyHat: $hideCowboyHat,
2023-01-07 00:53:09 +00:00
wildWestMode: $wildWestMode, greeterMode: $greeterMode, nostrPubkey: $nostrPubkey, nostrRelays: $nostrRelays) {
...SettingsFields
}
}
`
2022-04-19 18:32:39 +00:00
export const NAME_QUERY =
gql`
query nameAvailable($name: String!) {
nameAvailable(name: $name)
}
`
export const NAME_MUTATION =
gql`
mutation setName($name: String!) {
setName(name: $name)
}
`
2022-08-26 22:20:09 +00:00
export const USER_SEARCH =
gql`
2022-10-25 17:13:06 +00:00
query searchUsers($q: String!, $limit: Int, $similarity: Float) {
searchUsers(q: $q, limit: $limit, similarity: $similarity) {
2022-08-26 22:20:09 +00:00
name
2023-02-01 14:44:35 +00:00
streak
2023-05-01 21:49:47 +00:00
hideCowboyHat
2022-10-25 17:13:06 +00:00
photoId
stacked
spent
ncomments
nitems
2023-07-10 17:59:21 +00:00
referrals
2022-08-26 22:20:09 +00:00
}
}`
2021-09-24 21:28:21 +00:00
export const USER_FIELDS = gql`
${ITEM_FIELDS}
fragment UserFields on User {
id
createdAt
name
2023-02-01 14:44:35 +00:00
streak
maxStreak
2023-05-01 21:49:47 +00:00
hideCowboyHat
2021-09-24 21:28:21 +00:00
nitems
ncomments
nbookmarks
2021-09-24 21:28:21 +00:00
stacked
sats
2022-05-16 20:51:22 +00:00
photoId
2021-09-24 21:28:21 +00:00
bio {
...ItemFields
text
}
}`
2021-09-30 15:46:58 +00:00
2021-12-17 00:39:19 +00:00
export const TOP_USERS = gql`
2023-02-03 19:10:18 +00:00
query TopUsers($cursor: String, $when: String, $sort: String) {
2022-10-25 21:35:32 +00:00
topUsers(cursor: $cursor, when: $when, sort: $sort) {
2021-12-17 00:39:19 +00:00
users {
name
2023-02-01 14:44:35 +00:00
streak
2023-05-01 21:49:47 +00:00
hideCowboyHat
2022-10-25 21:35:32 +00:00
photoId
2022-10-26 14:56:22 +00:00
stacked(when: $when)
spent(when: $when)
ncomments(when: $when)
nitems(when: $when)
2022-12-19 23:00:53 +00:00
referrals(when: $when)
2021-12-17 00:39:19 +00:00
}
cursor
}
}
`
2023-02-09 18:41:28 +00:00
export const TOP_COWBOYS = gql`
query TopCowboys($cursor: String) {
topCowboys(cursor: $cursor) {
users {
name
streak
2023-05-01 21:49:47 +00:00
hideCowboyHat
2023-02-09 18:41:28 +00:00
photoId
stacked(when: "forever")
spent(when: "forever")
ncomments(when: "forever")
nitems(when: "forever")
referrals(when: "forever")
}
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
2023-06-03 00:55:45 +00:00
since
2021-09-30 15:46:58 +00:00
bio {
...ItemWithComments
}
}
}`
2021-10-26 20:49:37 +00:00
export const USER_WITH_COMMENTS = gql`
${USER_FIELDS}
${COMMENT_FIELDS}
query UserWithComments($name: String!) {
user(name: $name) {
...UserFields
2023-06-03 00:55:45 +00:00
since
2021-10-26 20:49:37 +00:00
}
2021-12-16 23:05:31 +00:00
moreFlatComments(sort: "user", name: $name) {
2021-10-26 20:49:37 +00:00
cursor
comments {
...CommentFields
root {
id
title
bounty
bountyPaidTo
subName
user {
name
streak
hideCowboyHat
id
}
}
2021-10-26 20:49:37 +00:00
}
}
}`
export const USER_WITH_BOOKMARKS = gql`
${USER_FIELDS}
${ITEM_FULL_FIELDS}
query UserWithBookmarks($name: String!, $cursor: String) {
user(name: $name) {
...UserFields
2023-06-03 00:55:45 +00:00
since
}
moreBookmarks(name: $name, cursor: $cursor) {
cursor
items {
...ItemFullFields
}
}
}
`
2021-10-26 20:49:37 +00:00
export const USER_WITH_POSTS = gql`
${USER_FIELDS}
${ITEM_FIELDS}
2022-02-17 17:23:43 +00:00
query UserWithPosts($name: String!) {
2021-10-26 20:49:37 +00:00
user(name: $name) {
...UserFields
2023-06-03 00:55:45 +00:00
since
2021-10-26 20:49:37 +00:00
}
2022-02-17 17:23:43 +00:00
items(sort: "user", name: $name) {
2021-10-26 20:49:37 +00:00
cursor
items {
...ItemFields
}
pins {
...ItemFields
2021-10-26 20:49:37 +00:00
}
}
}`