add 'stacking since' to profile
This commit is contained in:
parent
8ac570d403
commit
d815cae715
|
@ -19,8 +19,7 @@
|
|||
# misc
|
||||
.DS_Store
|
||||
*.pem
|
||||
db.sql
|
||||
test.sql
|
||||
*.sql
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
|
|
|
@ -558,6 +558,18 @@ export default {
|
|||
|
||||
User: {
|
||||
authMethods,
|
||||
since: async (user, args, { models }) => {
|
||||
// get the user's first item
|
||||
const item = await models.item.findFirst({
|
||||
where: {
|
||||
userId: user.id
|
||||
},
|
||||
orderBy: {
|
||||
createdAt: 'asc'
|
||||
}
|
||||
})
|
||||
return item?.id
|
||||
},
|
||||
nitems: async (user, { when }, { models }) => {
|
||||
if (typeof user.nitems === 'number') {
|
||||
return user.nitems
|
||||
|
|
|
@ -63,6 +63,7 @@ export default gql`
|
|||
photoId: Int
|
||||
streak: Int
|
||||
sats: Int!
|
||||
since: Int
|
||||
upvotePopover: Boolean!
|
||||
tipPopover: Boolean!
|
||||
noteItemSats: Boolean!
|
||||
|
|
|
@ -64,7 +64,7 @@ export default function UserHeader ({ user }) {
|
|||
}}
|
||||
/>}
|
||||
</div>
|
||||
<div className='ml-0 ml-sm-1 mt-3 mt-sm-0 justify-content-center align-self-sm-center'>
|
||||
<div className='ml-0 ml-sm-3 mt-3 mt-sm-0 justify-content-center align-self-sm-center'>
|
||||
{editting
|
||||
? (
|
||||
<Form
|
||||
|
@ -126,7 +126,7 @@ export default function UserHeader ({ user }) {
|
|||
<Satistics user={user} />
|
||||
<ModalButton
|
||||
clicker={
|
||||
<Button className='font-weight-bold ml-0 ml-sm-2'>
|
||||
<Button className='font-weight-bold ml-0'>
|
||||
<LightningIcon
|
||||
width={20}
|
||||
height={20}
|
||||
|
@ -140,6 +140,10 @@ export default function UserHeader ({ user }) {
|
|||
</a>
|
||||
<div className='text-center font-weight-bold text-muted mt-3'>click or scan</div>
|
||||
</ModalButton>
|
||||
<small className='ml-0 mt-3 mt-sm-0 text-muted d-flex-inline'>stacking since: {user.since
|
||||
? <Link href={`/items/${user.since}`} passHref><a className='ml-1'>#{user.since}</a></Link>
|
||||
: <span>never</span>}
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<Nav
|
||||
|
|
|
@ -184,6 +184,7 @@ export const USER_FULL = gql`
|
|||
query User($name: String!) {
|
||||
user(name: $name) {
|
||||
...UserFields
|
||||
since
|
||||
bio {
|
||||
...ItemWithComments
|
||||
}
|
||||
|
@ -196,6 +197,7 @@ export const USER_WITH_COMMENTS = gql`
|
|||
query UserWithComments($name: String!) {
|
||||
user(name: $name) {
|
||||
...UserFields
|
||||
since
|
||||
}
|
||||
moreFlatComments(sort: "user", name: $name) {
|
||||
cursor
|
||||
|
@ -224,6 +226,7 @@ export const USER_WITH_BOOKMARKS = gql`
|
|||
query UserWithBookmarks($name: String!, $cursor: String) {
|
||||
user(name: $name) {
|
||||
...UserFields
|
||||
since
|
||||
}
|
||||
moreBookmarks(name: $name, cursor: $cursor) {
|
||||
cursor
|
||||
|
@ -240,6 +243,7 @@ export const USER_WITH_POSTS = gql`
|
|||
query UserWithPosts($name: String!) {
|
||||
user(name: $name) {
|
||||
...UserFields
|
||||
since
|
||||
}
|
||||
items(sort: "user", name: $name) {
|
||||
cursor
|
||||
|
|
Loading…
Reference in New Issue