hide cowboy hat setting
This commit is contained in:
parent
a241d683d8
commit
4be5286122
|
@ -95,7 +95,7 @@ export default {
|
||||||
const users = await models.$queryRaw(`
|
const users = await models.$queryRaw(`
|
||||||
SELECT users.*
|
SELECT users.*
|
||||||
FROM users
|
FROM users
|
||||||
WHERE NOT "hideFromTopUsers" AND streak IS NOT NULL
|
WHERE NOT "hideFromTopUsers" AND NOT "hideCowboyHat" AND streak IS NOT NULL
|
||||||
ORDER BY streak DESC, created_at ASC
|
ORDER BY streak DESC, created_at ASC
|
||||||
OFFSET $1
|
OFFSET $1
|
||||||
LIMIT ${LIMIT}`, decodedCursor.offset)
|
LIMIT ${LIMIT}`, decodedCursor.offset)
|
||||||
|
|
|
@ -22,7 +22,8 @@ export default gql`
|
||||||
setName(name: String!): Boolean
|
setName(name: String!): Boolean
|
||||||
setSettings(tipDefault: Int!, turboTipping: Boolean!, fiatCurrency: String!, noteItemSats: Boolean!,
|
setSettings(tipDefault: Int!, turboTipping: Boolean!, fiatCurrency: String!, noteItemSats: Boolean!,
|
||||||
noteEarning: Boolean!, noteAllDescendants: Boolean!, noteMentions: Boolean!, noteDeposits: Boolean!,
|
noteEarning: Boolean!, noteAllDescendants: Boolean!, noteMentions: Boolean!, noteDeposits: Boolean!,
|
||||||
noteInvites: Boolean!, noteJobIndicator: Boolean!, noteCowboyHat: Boolean!, hideInvoiceDesc: Boolean!, hideFromTopUsers: Boolean!,
|
noteInvites: Boolean!, noteJobIndicator: Boolean!, noteCowboyHat: Boolean!, hideInvoiceDesc: Boolean!,
|
||||||
|
hideFromTopUsers: Boolean!, hideCowboyHat: Boolean!,
|
||||||
wildWestMode: Boolean!, greeterMode: Boolean!, nostrPubkey: String, nostrRelays: [String!]): User
|
wildWestMode: Boolean!, greeterMode: Boolean!, nostrPubkey: String, nostrRelays: [String!]): User
|
||||||
setPhoto(photoId: ID!): Int!
|
setPhoto(photoId: ID!): Int!
|
||||||
upsertBio(bio: String!): User!
|
upsertBio(bio: String!): User!
|
||||||
|
@ -74,6 +75,7 @@ export default gql`
|
||||||
noteCowboyHat: Boolean!
|
noteCowboyHat: Boolean!
|
||||||
hideInvoiceDesc: Boolean!
|
hideInvoiceDesc: Boolean!
|
||||||
hideFromTopUsers: Boolean!
|
hideFromTopUsers: Boolean!
|
||||||
|
hideCowboyHat: Boolean!
|
||||||
wildWestMode: Boolean!
|
wildWestMode: Boolean!
|
||||||
greeterMode: Boolean!
|
greeterMode: Boolean!
|
||||||
lastCheckedJobs: String
|
lastCheckedJobs: String
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import { Badge, OverlayTrigger, Tooltip } from 'react-bootstrap'
|
import { Badge, OverlayTrigger, Tooltip } from 'react-bootstrap'
|
||||||
import CowboyHatIcon from '../svgs/cowboy.svg'
|
import CowboyHatIcon from '../svgs/cowboy.svg'
|
||||||
|
|
||||||
export default function CowboyHat ({ streak, badge, className = 'ml-1', height = 16, width = 16 }) {
|
export default function CowboyHat ({ user, badge, className = 'ml-1', height = 16, width = 16 }) {
|
||||||
if (streak === null) {
|
if (user?.streak === null || user.hideCowboyHat) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const streak = user.streak
|
||||||
return (
|
return (
|
||||||
<HatTooltip overlayText={streak ? `${streak} days` : 'new'}>
|
<HatTooltip overlayText={streak ? `${streak} days` : 'new'}>
|
||||||
{badge
|
{badge
|
||||||
|
|
|
@ -86,7 +86,7 @@ export default function Header ({ sub }) {
|
||||||
<NavDropdown
|
<NavDropdown
|
||||||
className={styles.dropdown} title={
|
className={styles.dropdown} title={
|
||||||
<Nav.Link eventKey={me?.name} as='span' className='p-0 d-flex align-items-center' onClick={e => e.preventDefault()}>
|
<Nav.Link eventKey={me?.name} as='span' className='p-0 d-flex align-items-center' onClick={e => e.preventDefault()}>
|
||||||
{`@${me?.name}`}<CowboyHat streak={me.streak} />
|
{`@${me?.name}`}<CowboyHat user={me} />
|
||||||
</Nav.Link>
|
</Nav.Link>
|
||||||
} alignRight
|
} alignRight
|
||||||
>
|
>
|
||||||
|
@ -152,7 +152,7 @@ export default function Header ({ sub }) {
|
||||||
}, [])
|
}, [])
|
||||||
}
|
}
|
||||||
return path !== '/login' && path !== '/signup' && !path.startsWith('/invites') &&
|
return path !== '/login' && path !== '/signup' && !path.startsWith('/invites') &&
|
||||||
<div className='ml-auto'>
|
<div>
|
||||||
<Button
|
<Button
|
||||||
className='align-items-center px-3 py-1 mr-2'
|
className='align-items-center px-3 py-1 mr-2'
|
||||||
id='signup'
|
id='signup'
|
||||||
|
|
|
@ -49,7 +49,7 @@ export default function ItemInfo ({ item, commentsText, className, embellishUser
|
||||||
<span>
|
<span>
|
||||||
<Link href={`/${item.user.name}`} passHref>
|
<Link href={`/${item.user.name}`} passHref>
|
||||||
<a className='d-inline-flex align-items-center'>
|
<a className='d-inline-flex align-items-center'>
|
||||||
@{item.user.name}<CowboyHat className='ml-1 fill-grey' streak={item.user.streak} height={12} width={12} />
|
@{item.user.name}<CowboyHat className='ml-1 fill-grey' user={item.user} height={12} width={12} />
|
||||||
{embellishUser}
|
{embellishUser}
|
||||||
</a>
|
</a>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
|
@ -54,7 +54,7 @@ export default function ItemJob ({ item, toc, rank, children }) {
|
||||||
<span>
|
<span>
|
||||||
<Link href={`/${item.user.name}`} passHref>
|
<Link href={`/${item.user.name}`} passHref>
|
||||||
<a className='d-inline-flex align-items-center'>
|
<a className='d-inline-flex align-items-center'>
|
||||||
@{item.user.name}<CowboyHat className='ml-1 fill-grey' streak={item.user.streak} height={12} width={12} />
|
@{item.user.name}<CowboyHat className='ml-1 fill-grey' user={item.user} height={12} width={12} />
|
||||||
</a>
|
</a>
|
||||||
</Link>
|
</Link>
|
||||||
<span> </span>
|
<span> </span>
|
||||||
|
|
|
@ -118,7 +118,7 @@ export default function UserHeader ({ user }) {
|
||||||
)
|
)
|
||||||
: (
|
: (
|
||||||
<div className='d-flex align-items-center mb-2'>
|
<div className='d-flex align-items-center mb-2'>
|
||||||
<div className={styles.username}>@{user.name}<CowboyHat className='' streak={user.streak} badge /></div>
|
<div className={styles.username}>@{user.name}<CowboyHat className='' user={user} badge /></div>
|
||||||
{isMe &&
|
{isMe &&
|
||||||
<Button className='py-0' style={{ lineHeight: '1.25' }} variant='link' onClick={() => setEditting(true)}>edit nym</Button>}
|
<Button className='py-0' style={{ lineHeight: '1.25' }} variant='link' onClick={() => setEditting(true)}>edit nym</Button>}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -20,7 +20,7 @@ export default function UserList ({ users }) {
|
||||||
<div className={styles.hunk}>
|
<div className={styles.hunk}>
|
||||||
<Link href={`/${user.name}`} passHref>
|
<Link href={`/${user.name}`} passHref>
|
||||||
<a className={`${styles.title} d-inline-flex align-items-center text-reset`}>
|
<a className={`${styles.title} d-inline-flex align-items-center text-reset`}>
|
||||||
@{user.name}<CowboyHat className='ml-1 fill-grey' height={14} width={14} streak={user.streak} />
|
@{user.name}<CowboyHat className='ml-1 fill-grey' height={14} width={14} user={user} />
|
||||||
</a>
|
</a>
|
||||||
</Link>
|
</Link>
|
||||||
<div className={styles.other}>
|
<div className={styles.other}>
|
||||||
|
|
|
@ -10,6 +10,7 @@ export const COMMENT_FIELDS = gql`
|
||||||
user {
|
user {
|
||||||
name
|
name
|
||||||
streak
|
streak
|
||||||
|
hideCowboyHat
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
sats
|
sats
|
||||||
|
@ -33,6 +34,7 @@ export const COMMENT_FIELDS = gql`
|
||||||
user {
|
user {
|
||||||
name
|
name
|
||||||
streak
|
streak
|
||||||
|
hideCowboyHat
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ export const INVITE_FIELDS = gql`
|
||||||
user {
|
user {
|
||||||
name
|
name
|
||||||
streak
|
streak
|
||||||
|
hideCowboyHat
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
poor
|
poor
|
||||||
|
|
|
@ -12,6 +12,7 @@ export const ITEM_FIELDS = gql`
|
||||||
user {
|
user {
|
||||||
name
|
name
|
||||||
streak
|
streak
|
||||||
|
hideCowboyHat
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
fwdUserId
|
fwdUserId
|
||||||
|
@ -54,6 +55,7 @@ export const ITEM_FULL_FIELDS = gql`
|
||||||
fwdUser {
|
fwdUser {
|
||||||
name
|
name
|
||||||
streak
|
streak
|
||||||
|
hideCowboyHat
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
root {
|
root {
|
||||||
|
@ -67,6 +69,7 @@ export const ITEM_FULL_FIELDS = gql`
|
||||||
user {
|
user {
|
||||||
name
|
name
|
||||||
streak
|
streak
|
||||||
|
hideCowboyHat
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ export const ME = gql`
|
||||||
noteCowboyHat
|
noteCowboyHat
|
||||||
hideInvoiceDesc
|
hideInvoiceDesc
|
||||||
hideFromTopUsers
|
hideFromTopUsers
|
||||||
|
hideCowboyHat
|
||||||
wildWestMode
|
wildWestMode
|
||||||
greeterMode
|
greeterMode
|
||||||
lastCheckedJobs
|
lastCheckedJobs
|
||||||
|
@ -49,6 +50,7 @@ export const SETTINGS_FIELDS = gql`
|
||||||
noteCowboyHat
|
noteCowboyHat
|
||||||
hideInvoiceDesc
|
hideInvoiceDesc
|
||||||
hideFromTopUsers
|
hideFromTopUsers
|
||||||
|
hideCowboyHat
|
||||||
nostrPubkey
|
nostrPubkey
|
||||||
nostrRelays
|
nostrRelays
|
||||||
wildWestMode
|
wildWestMode
|
||||||
|
@ -75,12 +77,14 @@ gql`
|
||||||
${SETTINGS_FIELDS}
|
${SETTINGS_FIELDS}
|
||||||
mutation setSettings($tipDefault: Int!, $turboTipping: Boolean!, $fiatCurrency: String!, $noteItemSats: Boolean!,
|
mutation setSettings($tipDefault: Int!, $turboTipping: Boolean!, $fiatCurrency: String!, $noteItemSats: Boolean!,
|
||||||
$noteEarning: Boolean!, $noteAllDescendants: Boolean!, $noteMentions: Boolean!, $noteDeposits: Boolean!,
|
$noteEarning: Boolean!, $noteAllDescendants: Boolean!, $noteMentions: Boolean!, $noteDeposits: Boolean!,
|
||||||
$noteInvites: Boolean!, $noteJobIndicator: Boolean!, $noteCowboyHat: Boolean!, $hideInvoiceDesc: Boolean!, $hideFromTopUsers: Boolean!,
|
$noteInvites: Boolean!, $noteJobIndicator: Boolean!, $noteCowboyHat: Boolean!, $hideInvoiceDesc: Boolean!,
|
||||||
|
$hideFromTopUsers: Boolean!, $hideCowboyHat: Boolean!,
|
||||||
$wildWestMode: Boolean!, $greeterMode: Boolean!, $nostrPubkey: String, $nostrRelays: [String!]) {
|
$wildWestMode: Boolean!, $greeterMode: Boolean!, $nostrPubkey: String, $nostrRelays: [String!]) {
|
||||||
setSettings(tipDefault: $tipDefault, turboTipping: $turboTipping, fiatCurrency: $fiatCurrency,
|
setSettings(tipDefault: $tipDefault, turboTipping: $turboTipping, fiatCurrency: $fiatCurrency,
|
||||||
noteItemSats: $noteItemSats, noteEarning: $noteEarning, noteAllDescendants: $noteAllDescendants,
|
noteItemSats: $noteItemSats, noteEarning: $noteEarning, noteAllDescendants: $noteAllDescendants,
|
||||||
noteMentions: $noteMentions, noteDeposits: $noteDeposits, noteInvites: $noteInvites,
|
noteMentions: $noteMentions, noteDeposits: $noteDeposits, noteInvites: $noteInvites,
|
||||||
noteJobIndicator: $noteJobIndicator, noteCowboyHat: $noteCowboyHat, hideInvoiceDesc: $hideInvoiceDesc, hideFromTopUsers: $hideFromTopUsers,
|
noteJobIndicator: $noteJobIndicator, noteCowboyHat: $noteCowboyHat, hideInvoiceDesc: $hideInvoiceDesc,
|
||||||
|
hideFromTopUsers: $hideFromTopUsers, hideCowboyHat: $hideCowboyHat,
|
||||||
wildWestMode: $wildWestMode, greeterMode: $greeterMode, nostrPubkey: $nostrPubkey, nostrRelays: $nostrRelays) {
|
wildWestMode: $wildWestMode, greeterMode: $greeterMode, nostrPubkey: $nostrPubkey, nostrRelays: $nostrRelays) {
|
||||||
...SettingsFields
|
...SettingsFields
|
||||||
}
|
}
|
||||||
|
@ -107,6 +111,7 @@ gql`
|
||||||
searchUsers(q: $q, limit: $limit, similarity: $similarity) {
|
searchUsers(q: $q, limit: $limit, similarity: $similarity) {
|
||||||
name
|
name
|
||||||
streak
|
streak
|
||||||
|
hideCowboyHat
|
||||||
photoId
|
photoId
|
||||||
stacked
|
stacked
|
||||||
spent
|
spent
|
||||||
|
@ -122,6 +127,7 @@ export const USER_FIELDS = gql`
|
||||||
createdAt
|
createdAt
|
||||||
name
|
name
|
||||||
streak
|
streak
|
||||||
|
hideCowboyHat
|
||||||
nitems
|
nitems
|
||||||
ncomments
|
ncomments
|
||||||
nbookmarks
|
nbookmarks
|
||||||
|
@ -140,6 +146,7 @@ export const TOP_USERS = gql`
|
||||||
users {
|
users {
|
||||||
name
|
name
|
||||||
streak
|
streak
|
||||||
|
hideCowboyHat
|
||||||
photoId
|
photoId
|
||||||
stacked(when: $when)
|
stacked(when: $when)
|
||||||
spent(when: $when)
|
spent(when: $when)
|
||||||
|
@ -158,6 +165,7 @@ export const TOP_COWBOYS = gql`
|
||||||
users {
|
users {
|
||||||
name
|
name
|
||||||
streak
|
streak
|
||||||
|
hideCowboyHat
|
||||||
photoId
|
photoId
|
||||||
stacked(when: "forever")
|
stacked(when: "forever")
|
||||||
spent(when: "forever")
|
spent(when: "forever")
|
||||||
|
|
|
@ -64,6 +64,7 @@ export default function Settings ({ data: { settings } }) {
|
||||||
noteCowboyHat: settings?.noteCowboyHat,
|
noteCowboyHat: settings?.noteCowboyHat,
|
||||||
hideInvoiceDesc: settings?.hideInvoiceDesc,
|
hideInvoiceDesc: settings?.hideInvoiceDesc,
|
||||||
hideFromTopUsers: settings?.hideFromTopUsers,
|
hideFromTopUsers: settings?.hideFromTopUsers,
|
||||||
|
hideCowboyHat: settings?.hideCowboyHat,
|
||||||
wildWestMode: settings?.wildWestMode,
|
wildWestMode: settings?.wildWestMode,
|
||||||
greeterMode: settings?.greeterMode,
|
greeterMode: settings?.greeterMode,
|
||||||
nostrPubkey: settings?.nostrPubkey ? bech32encode(settings.nostrPubkey) : '',
|
nostrPubkey: settings?.nostrPubkey ? bech32encode(settings.nostrPubkey) : '',
|
||||||
|
@ -205,6 +206,11 @@ export default function Settings ({ data: { settings } }) {
|
||||||
<Checkbox
|
<Checkbox
|
||||||
label={<>hide me from <Link href='/top/users/day' passHref><a>top users</a></Link></>}
|
label={<>hide me from <Link href='/top/users/day' passHref><a>top users</a></Link></>}
|
||||||
name='hideFromTopUsers'
|
name='hideFromTopUsers'
|
||||||
|
groupClassName='mb-0'
|
||||||
|
/>
|
||||||
|
<Checkbox
|
||||||
|
label={<>hide my cowboy hat</>}
|
||||||
|
name='hideCowboyHat'
|
||||||
/>
|
/>
|
||||||
<div className='form-label'>content</div>
|
<div className='form-label'>content</div>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "users" ADD COLUMN "hideMyCowboyHat" BOOLEAN NOT NULL DEFAULT false;
|
|
@ -0,0 +1,2 @@
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "users" RENAME COLUMN "hideMyCowboyHat" TO "hideCowboyHat";
|
|
@ -79,6 +79,7 @@ model User {
|
||||||
// privacy settings
|
// privacy settings
|
||||||
hideInvoiceDesc Boolean @default(false)
|
hideInvoiceDesc Boolean @default(false)
|
||||||
hideFromTopUsers Boolean @default(false)
|
hideFromTopUsers Boolean @default(false)
|
||||||
|
hideCowboyHat Boolean @default(false)
|
||||||
|
|
||||||
// content settings
|
// content settings
|
||||||
wildWestMode Boolean @default(false)
|
wildWestMode Boolean @default(false)
|
||||||
|
|
Loading…
Reference in New Issue