fix: prevent duplicate clicks before zap or like action completes
This commit is contained in:
@@ -68,6 +68,7 @@ export default function LikeButton({ event }: { event: Event }) {
|
|||||||
<button
|
<button
|
||||||
className="flex items-center enabled:hover:text-primary gap-1 px-3 h-full text-muted-foreground"
|
className="flex items-center enabled:hover:text-primary gap-1 px-3 h-full text-muted-foreground"
|
||||||
title={t('Like')}
|
title={t('Like')}
|
||||||
|
disabled={liking}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (isSmallScreen) {
|
if (isSmallScreen) {
|
||||||
setIsEmojiReactionsOpen(true)
|
setIsEmojiReactionsOpen(true)
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ export default function ZapButton({ event }: { event: Event }) {
|
|||||||
if (!pubkey) {
|
if (!pubkey) {
|
||||||
throw new Error('You need to be logged in to zap')
|
throw new Error('You need to be logged in to zap')
|
||||||
}
|
}
|
||||||
|
if (zapping) return
|
||||||
|
|
||||||
setZapping(true)
|
setZapping(true)
|
||||||
const zapResult = await lightning.zap(pubkey, event, defaultZapSats, defaultZapComment)
|
const zapResult = await lightning.zap(pubkey, event, defaultZapSats, defaultZapComment)
|
||||||
// user canceled
|
// user canceled
|
||||||
@@ -133,6 +135,7 @@ export default function ZapButton({ event }: { event: Event }) {
|
|||||||
: 'cursor-pointer enabled:hover:text-yellow-400'
|
: 'cursor-pointer enabled:hover:text-yellow-400'
|
||||||
)}
|
)}
|
||||||
title={t('Zap')}
|
title={t('Zap')}
|
||||||
|
disabled={disable || zapping}
|
||||||
onMouseDown={handleClickStart}
|
onMouseDown={handleClickStart}
|
||||||
onMouseUp={handleClickEnd}
|
onMouseUp={handleClickEnd}
|
||||||
onMouseLeave={handleMouseLeave}
|
onMouseLeave={handleMouseLeave}
|
||||||
|
|||||||
Reference in New Issue
Block a user