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