import { Checkbox, Form, Input, SubmitButton, Select, VariableInput } from '../components/form'
import Alert from 'react-bootstrap/Alert'
import Button from 'react-bootstrap/Button'
import InputGroup from 'react-bootstrap/InputGroup'
import { CenterLayout } from '../components/layout'
import { useState } from 'react'
import { gql, useMutation, useQuery } from '@apollo/client'
import { getGetServerSideProps } from '../api/ssrApollo'
import LoginButton from '../components/login-button'
import { signIn } from 'next-auth/react'
import { LightningAuth } from '../components/lightning-auth'
import { SETTINGS, SET_SETTINGS } from '../fragments/users'
import { useRouter } from 'next/router'
import Info from '../components/info'
import Link from 'next/link'
import AccordianItem from '../components/accordian-item'
import { bech32 } from 'bech32'
import { NOSTR_MAX_RELAY_NUM, NOSTR_PUBKEY_BECH32, DEFAULT_CROSSPOSTING_RELAYS } from '../lib/nostr'
import { emailSchema, lastAuthRemovalSchema, settingsSchema } from '../lib/validate'
import { SUPPORTED_CURRENCIES } from '../lib/currency'
import PageLoading from '../components/page-loading'
import { useShowModal } from '../components/modal'
import { authErrorMessage } from '../components/login'
import { NostrAuth } from '../components/nostr-auth'
import { useToast } from '../components/toast'
import { useLogger } from '../components/logger'
import { useMe } from '../components/me'
export const getServerSideProps = getGetServerSideProps({ query: SETTINGS, authRequired: true })
function bech32encode (hexString) {
return bech32.encode('npub', bech32.toWords(Buffer.from(hexString, 'hex')))
}
export default function Settings ({ ssrData }) {
const toaster = useToast()
const me = useMe()
const [setSettings] = useMutation(SET_SETTINGS, {
update (cache, { data: { setSettings } }) {
cache.modify({
id: 'ROOT_QUERY',
fields: {
settings () {
return setSettings
}
}
})
}
}
)
const logger = useLogger()
const { data } = useQuery(SETTINGS)
const { settings } = data || ssrData
if (!data && !ssrData) return
return (
settings
}
/>}
/>
notify me when ...
privacy
hide invoice descriptions
Use this if you don't want funding sources to be linkable to your SN identity.
It makes your invoice descriptions blank.
This only applies to invoices you create
lnurl-pay and lightning addresses still reference your nym
}
name='hideInvoiceDesc'
groupClassName='mb-0'
/>
hide me from top stackers>}
name='hideFromTopUsers'
groupClassName='mb-0'
/>
hide my cowboy hat>}
name='hideCowboyHat'
groupClassName='mb-0'
/>
hide my wallet balance>}
name='hideWalletBalance'
groupClassName='mb-0'
/>
hide my bookmarks from other stackers>}
name='hideBookmarks'
groupClassName='mb-0'
/>
{me.isContributor &&
hide that I'm a stacker.news contributor>}
name='hideIsContributor'
groupClassName='mb-0'
/>}
only load images from proxy
only load images from our image proxy automatically
this prevents IP address leaks to arbitrary sites
if we fail to load an image, the raw link will be shown
You are removing your last auth method. It is recommended you link another auth method before removing
your last auth method. If you'd like to proceed anyway, type the following below
If I logout, even accidentally, I will never be able to access my account again