Return full context in useMe
Ran search and replace: s/const me = useMe()/const { me } = useMe()/ s/const refreshMe = useMeRefresh()/const { refreshMe } = useMe()/ + removed import of `useMeRefresh` manually
This commit is contained in:
parent
051ba7397a
commit
0e04daebfb
|
@ -20,7 +20,7 @@ export function AdvPostInitial ({ forward, boost }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function AdvPostForm ({ children }) {
|
export default function AdvPostForm ({ children }) {
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { merge } = useFeeButton()
|
const { merge } = useFeeButton()
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { BALANCE_LIMIT_MSATS } from '../lib/constants'
|
||||||
import { msatsToSats, numWithUnits } from '../lib/format'
|
import { msatsToSats, numWithUnits } from '../lib/format'
|
||||||
|
|
||||||
export function WelcomeBanner () {
|
export function WelcomeBanner () {
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const toaster = useToast()
|
const toaster = useToast()
|
||||||
const [hidden, setHidden] = useState(true)
|
const [hidden, setHidden] = useState(true)
|
||||||
const handleClose = async () => {
|
const handleClose = async () => {
|
||||||
|
|
|
@ -25,7 +25,7 @@ export function BountyForm ({
|
||||||
}) {
|
}) {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const client = useApolloClient()
|
const client = useApolloClient()
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const toaster = useToast()
|
const toaster = useToast()
|
||||||
const schema = bountySchema({ client, me, existingBoost: item?.boost })
|
const schema = bountySchema({ client, me, existingBoost: item?.boost })
|
||||||
const [upsertBounty] = useMutation(
|
const [upsertBounty] = useMutation(
|
||||||
|
|
|
@ -100,7 +100,7 @@ export default function Comment ({
|
||||||
rootText, noComments, noReply, truncate, depth
|
rootText, noComments, noReply, truncate, depth
|
||||||
}) {
|
}) {
|
||||||
const [edit, setEdit] = useState()
|
const [edit, setEdit] = useState()
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const isHiddenFreebie = !me?.privates?.wildWestMode && !me?.privates?.greeterMode && !item.mine && item.freebie && !item.freedFreebie
|
const isHiddenFreebie = !me?.privates?.wildWestMode && !me?.privates?.greeterMode && !item.mine && item.freebie && !item.freedFreebie
|
||||||
const [collapse, setCollapse] = useState(
|
const [collapse, setCollapse] = useState(
|
||||||
(isHiddenFreebie || item?.user?.meMute || (item?.outlawed && !me?.privates?.wildWestMode)) && !includeParent
|
(isHiddenFreebie || item?.user?.meMute || (item?.outlawed && !me?.privates?.wildWestMode)) && !includeParent
|
||||||
|
|
|
@ -24,7 +24,7 @@ export function DiscussionForm ({
|
||||||
}) {
|
}) {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const client = useApolloClient()
|
const client = useApolloClient()
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const schema = discussionSchema({ client, me, existingBoost: item?.boost })
|
const schema = discussionSchema({ client, me, existingBoost: item?.boost })
|
||||||
// if Web Share Target API was used
|
// if Web Share Target API was used
|
||||||
const shareTitle = router.query.title
|
const shareTitle = router.query.title
|
||||||
|
|
|
@ -110,7 +110,7 @@ function FreebieDialog () {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function FeeButton ({ ChildButton = SubmitButton, variant, text, disabled }) {
|
export default function FeeButton ({ ChildButton = SubmitButton, variant, text, disabled }) {
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const { lines, total, disabled: ctxDisabled } = useFeeButton()
|
const { lines, total, disabled: ctxDisabled } = useFeeButton()
|
||||||
// freebies: there's only a base cost and we don't have enough sats
|
// freebies: there's only a base cost and we don't have enough sats
|
||||||
const free = total === lines.baseCost?.modifier(0) && lines.baseCost?.allowFreebies && me?.privates?.sats < total
|
const free = total === lines.baseCost?.modifier(0) && lines.baseCost?.allowFreebies && me?.privates?.sats < total
|
||||||
|
|
|
@ -159,7 +159,7 @@ function NavProfileMenu ({ me, dropNavKey }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function StackerCorner ({ dropNavKey }) {
|
function StackerCorner ({ dropNavKey }) {
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
|
|
||||||
const walletLimitReached = me.privates?.sats >= msatsToSats(BALANCE_LIMIT_MSATS)
|
const walletLimitReached = me.privates?.sats >= msatsToSats(BALANCE_LIMIT_MSATS)
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ function NavItems ({ className, sub, prefix }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function PostItem ({ className, prefix }) {
|
function PostItem ({ className, prefix }) {
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
|
|
||||||
if (me) {
|
if (me) {
|
||||||
return (
|
return (
|
||||||
|
@ -302,7 +302,7 @@ export default function Header ({ sub }) {
|
||||||
const prefix = sub ? `/~${sub}` : ''
|
const prefix = sub ? `/~${sub}` : ''
|
||||||
const topNavKey = path.split('/')[sub ? 2 : 1] ?? ''
|
const topNavKey = path.split('/')[sub ? 2 : 1] ?? ''
|
||||||
const dropNavKey = path.split('/').slice(sub ? 2 : 1).join('/')
|
const dropNavKey = path.split('/').slice(sub ? 2 : 1).join('/')
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container as='header' className='px-sm-0'>
|
<Container as='header' className='px-sm-0'>
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { abbrNum, numWithUnits } from '../lib/format'
|
||||||
import { useMe } from './me'
|
import { useMe } from './me'
|
||||||
|
|
||||||
export default function HiddenWalletSummary ({ abbreviate, fixedWidth }) {
|
export default function HiddenWalletSummary ({ abbreviate, fixedWidth }) {
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const [hover, setHover] = useState(false)
|
const [hover, setHover] = useState(false)
|
||||||
|
|
||||||
// prevent layout shifts when hovering by fixing width to initial rendered width
|
// prevent layout shifts when hovering by fixing width to initial rendered width
|
||||||
|
|
|
@ -20,7 +20,7 @@ export function decodeOriginalUrl (imgproxyUrl) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function ImageOriginal ({ src, topLevel, nofollow, tab, children, onClick, ...props }) {
|
function ImageOriginal ({ src, topLevel, nofollow, tab, children, onClick, ...props }) {
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const [showImage, setShowImage] = useState(false)
|
const [showImage, setShowImage] = useState(false)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
@ -159,7 +159,7 @@ const defaultOptions = {
|
||||||
// there's lots of state cascading paired with logic
|
// there's lots of state cascading paired with logic
|
||||||
// independent of the state, and it's hard to follow
|
// independent of the state, and it's hard to follow
|
||||||
export const useInvoiceable = (onSubmit, options = defaultOptions) => {
|
export const useInvoiceable = (onSubmit, options = defaultOptions) => {
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const [createInvoice, { data }] = useMutation(gql`
|
const [createInvoice, { data }] = useMutation(gql`
|
||||||
mutation createInvoice($amount: Int!) {
|
mutation createInvoice($amount: Int!) {
|
||||||
createInvoice(amount: $amount, hodlInvoice: true, expireSecs: 180) {
|
createInvoice(amount: $amount, hodlInvoice: true, expireSecs: 180) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ const addCustomTip = (amount) => {
|
||||||
|
|
||||||
export default function ItemAct ({ onClose, itemId, down, children }) {
|
export default function ItemAct ({ onClose, itemId, down, children }) {
|
||||||
const inputRef = useRef(null)
|
const inputRef = useRef(null)
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const [oValue, setOValue] = useState()
|
const [oValue, setOValue] = useState()
|
||||||
const strike = useLightning()
|
const strike = useLightning()
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ import { numWithUnits } from '../lib/format'
|
||||||
import { useQuoteReply } from './use-quote-reply'
|
import { useQuoteReply } from './use-quote-reply'
|
||||||
|
|
||||||
function BioItem ({ item, handleClick }) {
|
function BioItem ({ item, handleClick }) {
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
if (!item.text) {
|
if (!item.text) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ export default function ItemInfo ({
|
||||||
onQuoteReply, nofollow, extraBadges, nested
|
onQuoteReply, nofollow, extraBadges, nested
|
||||||
}) {
|
}) {
|
||||||
const editThreshold = new Date(item.createdAt).getTime() + 10 * 60000
|
const editThreshold = new Date(item.createdAt).getTime() + 10 * 60000
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const [canEdit, setCanEdit] =
|
const [canEdit, setCanEdit] =
|
||||||
useState(item.mine && (Date.now() < editThreshold))
|
useState(item.mine && (Date.now() < editThreshold))
|
||||||
|
|
|
@ -19,7 +19,7 @@ import { ItemButtonBar } from './post'
|
||||||
export function LinkForm ({ item, sub, editThreshold, children }) {
|
export function LinkForm ({ item, sub, editThreshold, children }) {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const client = useApolloClient()
|
const client = useApolloClient()
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const toaster = useToast()
|
const toaster = useToast()
|
||||||
const schema = linkSchema({ client, me, existingBoost: item?.boost })
|
const schema = linkSchema({ client, me, existingBoost: item?.boost })
|
||||||
// if Web Share Target API was used
|
// if Web Share Target API was used
|
||||||
|
|
|
@ -39,7 +39,7 @@ export function detectOS () {
|
||||||
export const LoggerContext = createContext()
|
export const LoggerContext = createContext()
|
||||||
|
|
||||||
export function LoggerProvider ({ children }) {
|
export function LoggerProvider ({ children }) {
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const [name, setName] = useState()
|
const [name, setName] = useState()
|
||||||
const [os, setOS] = useState()
|
const [os, setOS] = useState()
|
||||||
|
|
||||||
|
|
|
@ -15,18 +15,12 @@ export function MeProvider ({ me, children }) {
|
||||||
const futureMe = data?.me ?? (data?.me === null ? null : me)
|
const futureMe = data?.me ?? (data?.me === null ? null : me)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MeContext.Provider value={{ me: futureMe, refetch }}>
|
<MeContext.Provider value={{ me: futureMe, refreshMe: refetch }}>
|
||||||
{children}
|
{children}
|
||||||
</MeContext.Provider>
|
</MeContext.Provider>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useMe () {
|
export function useMe () {
|
||||||
const { me } = useContext(MeContext)
|
return useContext(MeContext)
|
||||||
return me
|
|
||||||
}
|
|
||||||
|
|
||||||
export function useMeRefresh () {
|
|
||||||
const { refetch } = useContext(MeContext)
|
|
||||||
return refetch
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { payOrLoginError, useInvoiceModal } from './invoice'
|
||||||
import { useAct } from './item-act'
|
import { useAct } from './item-act'
|
||||||
|
|
||||||
export default function PayBounty ({ children, item }) {
|
export default function PayBounty ({ children, item }) {
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const showModal = useShowModal()
|
const showModal = useShowModal()
|
||||||
const root = useRoot()
|
const root = useRoot()
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ import { ItemButtonBar } from './post'
|
||||||
export function PollForm ({ item, sub, editThreshold, children }) {
|
export function PollForm ({ item, sub, editThreshold, children }) {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const client = useApolloClient()
|
const client = useApolloClient()
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const toaster = useToast()
|
const toaster = useToast()
|
||||||
const schema = pollSchema({ client, me, existingBoost: item?.boost })
|
const schema = pollSchema({ client, me, existingBoost: item?.boost })
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import { POLL_COST } from '../lib/constants'
|
||||||
import { payOrLoginError, useInvoiceModal } from './invoice'
|
import { payOrLoginError, useInvoiceModal } from './invoice'
|
||||||
|
|
||||||
export default function Poll ({ item }) {
|
export default function Poll ({ item }) {
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const [pollVote] = useMutation(
|
const [pollVote] = useMutation(
|
||||||
gql`
|
gql`
|
||||||
mutation pollVote($id: ID!, $hash: String, $hmac: String) {
|
mutation pollVote($id: ID!, $hash: String, $hmac: String) {
|
||||||
|
|
|
@ -16,7 +16,7 @@ import Delete from './delete'
|
||||||
import CancelButton from './cancel-button'
|
import CancelButton from './cancel-button'
|
||||||
|
|
||||||
export function PostForm ({ type, sub, children }) {
|
export function PostForm ({ type, sub, children }) {
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const [errorMessage, setErrorMessage] = useState()
|
const [errorMessage, setErrorMessage] = useState()
|
||||||
|
|
||||||
const prefix = sub?.name ? `/~${sub.name}` : ''
|
const prefix = sub?.name ? `/~${sub.name}` : ''
|
||||||
|
|
|
@ -18,7 +18,7 @@ export function usePrice () {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function PriceProvider ({ price, children }) {
|
export function PriceProvider ({ price, children }) {
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const fiatCurrency = me?.privates?.fiatCurrency
|
const fiatCurrency = me?.privates?.fiatCurrency
|
||||||
const { data } = useQuery(PRICE, {
|
const { data } = useQuery(PRICE, {
|
||||||
variables: { fiatCurrency },
|
variables: { fiatCurrency },
|
||||||
|
|
|
@ -34,7 +34,7 @@ export function ReplyOnAnotherPage ({ item }) {
|
||||||
|
|
||||||
export default forwardRef(function Reply ({ item, onSuccess, replyOpen, children, placeholder, onQuoteReply, onCancelQuote, quote }, ref) {
|
export default forwardRef(function Reply ({ item, onSuccess, replyOpen, children, placeholder, onQuoteReply, onCancelQuote, quote }, ref) {
|
||||||
const [reply, setReply] = useState(replyOpen || quote)
|
const [reply, setReply] = useState(replyOpen || quote)
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const parentId = item.id
|
const parentId = item.id
|
||||||
const replyInput = useRef(null)
|
const replyInput = useRef(null)
|
||||||
const toaster = useToast()
|
const toaster = useToast()
|
||||||
|
|
|
@ -17,7 +17,7 @@ const referrurl = (ipath, me) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Share ({ path, title, className = '' }) {
|
export default function Share ({ path, title, className = '' }) {
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const toaster = useToast()
|
const toaster = useToast()
|
||||||
const url = referrurl(path, me)
|
const url = referrurl(path, me)
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ export default function Share ({ path, title, className = '' }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function CopyLinkDropdownItem ({ item }) {
|
export function CopyLinkDropdownItem ({ item }) {
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const toaster = useToast()
|
const toaster = useToast()
|
||||||
const url = referrurl(`/items/${item.id}`, me)
|
const url = referrurl(`/items/${item.id}`, me)
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { createContext, useCallback, useContext, useEffect, useState } from 'rea
|
||||||
import AnonIcon from '../svgs/spy-fill.svg'
|
import AnonIcon from '../svgs/spy-fill.svg'
|
||||||
import { useRouter } from 'next/router'
|
import { useRouter } from 'next/router'
|
||||||
import cookie from 'cookie'
|
import cookie from 'cookie'
|
||||||
import { useMe, useMeRefresh } from './me'
|
import { useMe } from './me'
|
||||||
import Image from 'react-bootstrap/Image'
|
import Image from 'react-bootstrap/Image'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import { SSR } from '../lib/constants'
|
import { SSR } from '../lib/constants'
|
||||||
|
@ -14,7 +14,7 @@ const AccountContext = createContext()
|
||||||
const b64Decode = str => Buffer.from(str, 'base64').toString('utf-8')
|
const b64Decode = str => Buffer.from(str, 'base64').toString('utf-8')
|
||||||
|
|
||||||
export const AccountProvider = ({ children }) => {
|
export const AccountProvider = ({ children }) => {
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const [accounts, setAccounts] = useState([])
|
const [accounts, setAccounts] = useState([])
|
||||||
const [isAnon, setIsAnon] = useState(true)
|
const [isAnon, setIsAnon] = useState(true)
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ export const useAccounts = () => useContext(AccountContext)
|
||||||
|
|
||||||
const AnonAccount = ({ selected, onClick }) => {
|
const AnonAccount = ({ selected, onClick }) => {
|
||||||
const { isAnon, setIsAnon } = useAccounts()
|
const { isAnon, setIsAnon } = useAccounts()
|
||||||
const refreshMe = useMeRefresh()
|
const { refreshMe } = useMe()
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className='d-flex flex-column me-2 my-1 text-center'
|
className='d-flex flex-column me-2 my-1 text-center'
|
||||||
|
@ -85,10 +85,10 @@ const AnonAccount = ({ selected, onClick }) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const Account = ({ account, className }) => {
|
const Account = ({ account, className }) => {
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const [name, setName] = useState(account.name)
|
const [name, setName] = useState(account.name)
|
||||||
const [src, setSrc] = useState(account.photoId || '/dorian400.jpg')
|
const [src, setSrc] = useState(account.photoId || '/dorian400.jpg')
|
||||||
const refreshMe = useMeRefresh()
|
const { refreshMe } = useMe()
|
||||||
const { setIsAnon } = useAccounts()
|
const { setIsAnon } = useAccounts()
|
||||||
useQuery(USER,
|
useQuery(USER,
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,7 +15,7 @@ import { numWithUnits } from '../lib/format'
|
||||||
import { Dropdown } from 'react-bootstrap'
|
import { Dropdown } from 'react-bootstrap'
|
||||||
|
|
||||||
const UpvotePopover = ({ target, show, handleClose }) => {
|
const UpvotePopover = ({ target, show, handleClose }) => {
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
return (
|
return (
|
||||||
<Overlay
|
<Overlay
|
||||||
show={show}
|
show={show}
|
||||||
|
@ -73,7 +73,7 @@ export default function UpVote ({ item, className }) {
|
||||||
const [voteShow, _setVoteShow] = useState(false)
|
const [voteShow, _setVoteShow] = useState(false)
|
||||||
const [tipShow, _setTipShow] = useState(false)
|
const [tipShow, _setTipShow] = useState(false)
|
||||||
const ref = useRef()
|
const ref = useRef()
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const [setWalkthrough] = useMutation(
|
const [setWalkthrough] = useMutation(
|
||||||
gql`
|
gql`
|
||||||
mutation setWalkthrough($upvotePopover: Boolean, $tipPopover: Boolean) {
|
mutation setWalkthrough($upvotePopover: Boolean, $tipPopover: Boolean) {
|
||||||
|
|
|
@ -154,7 +154,7 @@ function NymEdit ({ user, setEditting }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function NymView ({ user, isMe, setEditting }) {
|
function NymView ({ user, isMe, setEditting }) {
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
return (
|
return (
|
||||||
<div className='d-flex align-items-center mb-2'>
|
<div className='d-flex align-items-center mb-2'>
|
||||||
<div className={styles.username}>@{user.name}<Hat className='' user={user} badge /></div>
|
<div className={styles.username}>@{user.name}<Hat className='' user={user} badge /></div>
|
||||||
|
@ -181,7 +181,7 @@ function HeaderNym ({ user, isMe }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function HeaderHeader ({ user }) {
|
function HeaderHeader ({ user }) {
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const showModal = useShowModal()
|
const showModal = useShowModal()
|
||||||
const toaster = useToast()
|
const toaster = useToast()
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ export default function User ({ ssrData }) {
|
||||||
const [create, setCreate] = useState(false)
|
const [create, setCreate] = useState(false)
|
||||||
const [edit, setEdit] = useState(false)
|
const [edit, setEdit] = useState(false)
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
|
|
||||||
const { data } = useQuery(USER_FULL, { variables: { ...router.query } })
|
const { data } = useQuery(USER_FULL, { variables: { ...router.query } })
|
||||||
if (!data && !ssrData) return <PageLoading />
|
if (!data && !ssrData) return <PageLoading />
|
||||||
|
|
|
@ -36,7 +36,7 @@ export const getServerSideProps = getGetServerSideProps({ query: REFERRALS, auth
|
||||||
|
|
||||||
export default function Referrals ({ ssrData }) {
|
export default function Referrals ({ ssrData }) {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
|
|
||||||
const select = async values => {
|
const select = async values => {
|
||||||
const { when, ...query } = values
|
const { when, ...query } = values
|
||||||
|
|
|
@ -35,7 +35,7 @@ function bech32encode (hexString) {
|
||||||
|
|
||||||
export default function Settings ({ ssrData }) {
|
export default function Settings ({ ssrData }) {
|
||||||
const toaster = useToast()
|
const toaster = useToast()
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const [setSettings] = useMutation(SET_SETTINGS, {
|
const [setSettings] = useMutation(SET_SETTINGS, {
|
||||||
update (cache, { data: { setSettings } }) {
|
update (cache, { data: { setSettings } }) {
|
||||||
cache.modify({
|
cache.modify({
|
||||||
|
|
|
@ -59,7 +59,7 @@ export default function Wallet () {
|
||||||
}
|
}
|
||||||
|
|
||||||
function YouHaveSats () {
|
function YouHaveSats () {
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const limitReached = me?.privates?.sats >= msatsToSats(BALANCE_LIMIT_MSATS)
|
const limitReached = me?.privates?.sats >= msatsToSats(BALANCE_LIMIT_MSATS)
|
||||||
return (
|
return (
|
||||||
<h2 className={`${me ? 'visible' : 'invisible'} ${limitReached ? 'text-warning' : 'text-success'}`}>
|
<h2 className={`${me ? 'visible' : 'invisible'} ${limitReached ? 'text-warning' : 'text-success'}`}>
|
||||||
|
@ -97,7 +97,7 @@ export function WalletForm () {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function FundForm () {
|
export function FundForm () {
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const [showAlert, setShowAlert] = useState(true)
|
const [showAlert, setShowAlert] = useState(true)
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const [createInvoice, { called, error }] = useMutation(gql`
|
const [createInvoice, { called, error }] = useMutation(gql`
|
||||||
|
@ -200,7 +200,7 @@ export function SelectedWithdrawalForm () {
|
||||||
|
|
||||||
export function InvWithdrawal () {
|
export function InvWithdrawal () {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
|
|
||||||
const [createWithdrawl, { called, error }] = useMutation(CREATE_WITHDRAWL)
|
const [createWithdrawl, { called, error }] = useMutation(CREATE_WITHDRAWL)
|
||||||
|
|
||||||
|
@ -340,7 +340,7 @@ export function LnWithdrawal () {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function LnAddrWithdrawal () {
|
export function LnAddrWithdrawal () {
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const [sendToLnAddr, { called, error }] = useMutation(SEND_TO_LNADDR)
|
const [sendToLnAddr, { called, error }] = useMutation(SEND_TO_LNADDR)
|
||||||
const defaultOptions = { min: 1 }
|
const defaultOptions = { min: 1 }
|
||||||
|
|
|
@ -114,7 +114,7 @@ function LoadWithdrawl () {
|
||||||
function PrivacyOption ({ wd }) {
|
function PrivacyOption ({ wd }) {
|
||||||
if (!wd.bolt11) return
|
if (!wd.bolt11) return
|
||||||
|
|
||||||
const me = useMe()
|
const { me } = useMe()
|
||||||
const keepUntil = datePivot(new Date(wd.createdAt), { days: INVOICE_RETENTION_DAYS })
|
const keepUntil = datePivot(new Date(wd.createdAt), { days: INVOICE_RETENTION_DAYS })
|
||||||
const oldEnough = new Date() >= keepUntil
|
const oldEnough = new Date() >= keepUntil
|
||||||
if (!oldEnough) {
|
if (!oldEnough) {
|
||||||
|
|
Loading…
Reference in New Issue