make anon posting less hidden, add anon info button explainer
This commit is contained in:
parent
cbfd6998a6
commit
081c5fef0b
@ -8,6 +8,9 @@ import { useFormikContext } from 'formik'
|
|||||||
import { SSR, ANON_COMMENT_FEE, ANON_POST_FEE } from '../lib/constants'
|
import { SSR, ANON_COMMENT_FEE, ANON_POST_FEE } from '../lib/constants'
|
||||||
import { numWithUnits } from '../lib/format'
|
import { numWithUnits } from '../lib/format'
|
||||||
import { useMe } from './me'
|
import { useMe } from './me'
|
||||||
|
import AnonIcon from '../svgs/spy-fill.svg'
|
||||||
|
import { useShowModal } from './modal'
|
||||||
|
import Link from 'next/link'
|
||||||
|
|
||||||
function Receipt ({ cost, repetition, hasImgLink, baseFee, parentId, boost }) {
|
function Receipt ({ cost, repetition, hasImgLink, baseFee, parentId, boost }) {
|
||||||
return (
|
return (
|
||||||
@ -43,6 +46,28 @@ function Receipt ({ cost, repetition, hasImgLink, baseFee, parentId, boost }) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function AnonInfo () {
|
||||||
|
const showModal = useShowModal()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<AnonIcon
|
||||||
|
className='fill-muted ms-2 theme' height={22} width={22}
|
||||||
|
onClick={
|
||||||
|
(e) =>
|
||||||
|
showModal(onClose =>
|
||||||
|
<div><span className='fw-bold'>Hey sneaky! You are posting without an account.</span>
|
||||||
|
<ol className='mt-3'>
|
||||||
|
<li>You'll pay by invoice</li>
|
||||||
|
<li>Your content will be content-joined (get it?!) under the <Link href='/anon' target='_blank'>@anon</Link> account</li>
|
||||||
|
<li>Any sats your content earns will go toward <Link href='/rewards' target='_blank'>rewards</Link></li>
|
||||||
|
<li>We won't be able to notify about replies</li>
|
||||||
|
</ol>
|
||||||
|
</div>)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
export default function FeeButton ({ parentId, hasImgLink, baseFee, ChildButton, variant, text, alwaysShow, disabled }) {
|
export default function FeeButton ({ parentId, hasImgLink, baseFee, ChildButton, variant, text, alwaysShow, disabled }) {
|
||||||
const me = useMe()
|
const me = useMe()
|
||||||
baseFee = me ? baseFee : (parentId ? ANON_COMMENT_FEE : ANON_POST_FEE)
|
baseFee = me ? baseFee : (parentId ? ANON_COMMENT_FEE : ANON_POST_FEE)
|
||||||
@ -61,10 +86,11 @@ export default function FeeButton ({ parentId, hasImgLink, baseFee, ChildButton,
|
|||||||
|
|
||||||
const show = alwaysShow || !formik?.isSubmitting
|
const show = alwaysShow || !formik?.isSubmitting
|
||||||
return (
|
return (
|
||||||
<div className='d-flex align-items-center'>
|
<div className={styles.feeButton}>
|
||||||
<ActionTooltip overlayText={numWithUnits(cost, { abbreviate: false })}>
|
<ActionTooltip overlayText={numWithUnits(cost, { abbreviate: false })}>
|
||||||
<ChildButton variant={variant} disabled={disabled}>{text}{cost > baseFee && show && <small> {numWithUnits(cost, { abbreviate: false })}</small>}</ChildButton>
|
<ChildButton variant={variant} disabled={disabled}>{text}{cost > 1 && show && <small> {numWithUnits(cost, { abbreviate: false })}</small>}</ChildButton>
|
||||||
</ActionTooltip>
|
</ActionTooltip>
|
||||||
|
{!me && <AnonInfo />}
|
||||||
{cost > baseFee && show &&
|
{cost > baseFee && show &&
|
||||||
<Info>
|
<Info>
|
||||||
<Receipt baseFee={baseFee} hasImgLink={hasImgLink} repetition={repetition} cost={cost} parentId={parentId} boost={boost} />
|
<Receipt baseFee={baseFee} hasImgLink={hasImgLink} repetition={repetition} cost={cost} parentId={parentId} boost={boost} />
|
||||||
|
@ -6,6 +6,15 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.feeButton {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.feeButton small {
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
.receipt td {
|
.receipt td {
|
||||||
padding: .25rem .1rem;
|
padding: .25rem .1rem;
|
||||||
background-color: var(--theme-inputBg);
|
background-color: var(--theme-inputBg);
|
||||||
|
@ -23,6 +23,7 @@ import BackArrow from '../svgs/arrow-left-line.svg'
|
|||||||
import { SSR, SUBS } from '../lib/constants'
|
import { SSR, SUBS } from '../lib/constants'
|
||||||
import { useLightning } from './lightning'
|
import { useLightning } from './lightning'
|
||||||
import { HAS_NOTIFICATIONS } from '../fragments/notifications'
|
import { HAS_NOTIFICATIONS } from '../fragments/notifications'
|
||||||
|
import AnonIcon from '../svgs/spy-fill.svg'
|
||||||
|
|
||||||
function WalletSummary ({ me }) {
|
function WalletSummary ({ me }) {
|
||||||
if (!me) return null
|
if (!me) return null
|
||||||
@ -216,6 +217,9 @@ function NavItems ({ className, sub, prefix }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function PostItem ({ className, prefix }) {
|
function PostItem ({ className, prefix }) {
|
||||||
|
const me = useMe()
|
||||||
|
|
||||||
|
if (me) {
|
||||||
return (
|
return (
|
||||||
<Link href={prefix + '/post'} className={`${className} btn btn-md btn-primary px-3 py-1 `}>
|
<Link href={prefix + '/post'} className={`${className} btn btn-md btn-primary px-3 py-1 `}>
|
||||||
post
|
post
|
||||||
@ -223,6 +227,16 @@ function PostItem ({ className, prefix }) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Link
|
||||||
|
href={prefix + '/post'}
|
||||||
|
className={`${className} ${styles.postAnon} btn btn-md btn-outline-grey-darkmode d-flex align-items-center px-3 py-0 py-lg-1`}
|
||||||
|
>
|
||||||
|
<AnonIcon className='me-1 fill-secondary' width={16} height={16} /> post
|
||||||
|
</Link>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
export default function Header ({ sub }) {
|
export default function Header ({ sub }) {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const path = router.asPath.split('?')[0]
|
const path = router.asPath.split('?')[0]
|
||||||
|
@ -9,6 +9,22 @@
|
|||||||
color: var(--theme-brandColor) !important;
|
color: var(--theme-brandColor) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.postAnon {
|
||||||
|
border-width: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.postAnon svg {
|
||||||
|
fill: var(--bs-grey-darkmode);
|
||||||
|
}
|
||||||
|
|
||||||
|
.postAnon:hover, .postAnon:active, .postAnon:focus-visible {
|
||||||
|
color: var(--bs-white) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.postAnon:hover svg, .postAnon:active svg, .postAnon:focus-visible svg {
|
||||||
|
fill: var(--bs-white);
|
||||||
|
}
|
||||||
|
|
||||||
.navLinkButton {
|
.navLinkButton {
|
||||||
border: 2px solid;
|
border: 2px solid;
|
||||||
padding: 0.2rem .9rem !important;
|
padding: 0.2rem .9rem !important;
|
||||||
|
@ -4,7 +4,7 @@ import ThumbDown from '../svgs/thumb-down-fill.svg'
|
|||||||
|
|
||||||
function InvoiceDefaultStatus ({ status }) {
|
function InvoiceDefaultStatus ({ status }) {
|
||||||
return (
|
return (
|
||||||
<div className='d-flex mt-2 justify-content-center'>
|
<div className='d-flex mt-2 justify-content-center align-items-center'>
|
||||||
<Moon className='spin fill-grey' />
|
<Moon className='spin fill-grey' />
|
||||||
<div className='ms-3 text-muted' style={{ fontWeight: '600' }}>{status}</div>
|
<div className='ms-3 text-muted' style={{ fontWeight: '600' }}>{status}</div>
|
||||||
</div>
|
</div>
|
||||||
@ -13,7 +13,7 @@ function InvoiceDefaultStatus ({ status }) {
|
|||||||
|
|
||||||
function InvoiceConfirmedStatus ({ status }) {
|
function InvoiceConfirmedStatus ({ status }) {
|
||||||
return (
|
return (
|
||||||
<div className='d-flex mt-2 justify-content-center'>
|
<div className='d-flex mt-2 justify-content-center align-items-center'>
|
||||||
<Check className='fill-success' />
|
<Check className='fill-success' />
|
||||||
<div className='ms-3 text-success' style={{ fontWeight: '600' }}>{status}</div>
|
<div className='ms-3 text-success' style={{ fontWeight: '600' }}>{status}</div>
|
||||||
</div>
|
</div>
|
||||||
@ -22,7 +22,7 @@ function InvoiceConfirmedStatus ({ status }) {
|
|||||||
|
|
||||||
function InvoiceFailedStatus ({ status }) {
|
function InvoiceFailedStatus ({ status }) {
|
||||||
return (
|
return (
|
||||||
<div className='d-flex mt-2 justify-content-center'>
|
<div className='d-flex mt-2 justify-content-center align-items-center'>
|
||||||
<ThumbDown className='fill-danger' />
|
<ThumbDown className='fill-danger' />
|
||||||
<div className='ms-3 text-danger' style={{ fontWeight: '600' }}>{status}</div>
|
<div className='ms-3 text-danger' style={{ fontWeight: '600' }}>{status}</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -64,7 +64,7 @@ const Contacts = ({ invoiceHash, invoiceHmac }) => {
|
|||||||
const subject = `Support request for payment hash: ${invoiceHash}`
|
const subject = `Support request for payment hash: ${invoiceHash}`
|
||||||
const body = 'Hi, I successfully paid for <insert action> but the action did not work.'
|
const body = 'Hi, I successfully paid for <insert action> but the action did not work.'
|
||||||
return (
|
return (
|
||||||
<div className='d-flex flex-column justify-content-center'>
|
<div className='d-flex flex-column justify-content-center mt-2'>
|
||||||
<span>Payment hash</span>
|
<span>Payment hash</span>
|
||||||
<div className='w-100'>
|
<div className='w-100'>
|
||||||
<CopyInput type='text' placeholder={invoiceHash} readOnly noForm />
|
<CopyInput type='text' placeholder={invoiceHash} readOnly noForm />
|
||||||
@ -121,7 +121,7 @@ const ActionInvoice = ({ id, hash, hmac, errorCount, repeat, ...props }) => {
|
|||||||
return <QrSkeleton status='loading' />
|
return <QrSkeleton status='loading' />
|
||||||
}
|
}
|
||||||
|
|
||||||
let errorStatus = 'Something went wrong. Please try again.'
|
let errorStatus = 'Something went wrong trying to perform the action after payment.'
|
||||||
if (errorCount > 1) {
|
if (errorCount > 1) {
|
||||||
errorStatus = 'Something still went wrong.\nPlease contact admins for support or to request a refund.'
|
errorStatus = 'Something still went wrong.\nPlease contact admins for support or to request a refund.'
|
||||||
}
|
}
|
||||||
@ -131,7 +131,9 @@ const ActionInvoice = ({ id, hash, hmac, errorCount, repeat, ...props }) => {
|
|||||||
{errorCount > 0
|
{errorCount > 0
|
||||||
? (
|
? (
|
||||||
<>
|
<>
|
||||||
|
<div className='my-3'>
|
||||||
<InvoiceStatus variant='failed' status={errorStatus} />
|
<InvoiceStatus variant='failed' status={errorStatus} />
|
||||||
|
</div>
|
||||||
{errorCount === 1
|
{errorCount === 1
|
||||||
? <div className='d-flex flex-row mt-3 justify-content-center'><Button variant='info' onClick={repeat}>Retry</Button></div>
|
? <div className='d-flex flex-row mt-3 justify-content-center'><Button variant='info' onClick={repeat}>Retry</Button></div>
|
||||||
: <Contacts invoiceHash={hash} invoiceHmac={hmac} />}
|
: <Contacts invoiceHash={hash} invoiceHmac={hmac} />}
|
||||||
|
1
svgs/spy-fill.svg
Normal file
1
svgs/spy-fill.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17 13C19.2091 13 21 14.7909 21 17C21 19.2091 19.2091 21 17 21C14.8578 21 13 19.21 13 17H11C11 19.2091 9.20914 21 7 21C4.79086 21 3 19.2091 3 17C3 14.7909 4.79086 13 7 13C8.48052 13 9.77317 13.8043 10.4648 14.9999H13.5352C14.2268 13.8043 15.5195 13 17 13ZM2 12V10H4V7C4 4.79086 5.79086 3 8 3H16C18.2091 3 20 4.79086 20 7V10H22V12H2Z"></path></svg>
|
After Width: | Height: | Size: 416 B |
Loading…
x
Reference in New Issue
Block a user