Fix zaps on mobile

This commit is contained in:
Jon Staab
2025-07-17 15:29:26 -07:00
parent c87166247c
commit a12eddb47b
3 changed files with 24 additions and 6 deletions
@@ -5,8 +5,10 @@
import Button from "@lib/components/Button.svelte" import Button from "@lib/components/Button.svelte"
import Icon from "@lib/components/Icon.svelte" import Icon from "@lib/components/Icon.svelte"
import EmojiPicker from "@lib/components/EmojiPicker.svelte" import EmojiPicker from "@lib/components/EmojiPicker.svelte"
import ZapButton from "@app/components/ZapButton.svelte"
import EventInfo from "@app/components/EventInfo.svelte" import EventInfo from "@app/components/EventInfo.svelte"
import EventDeleteConfirm from "@app/components/EventDeleteConfirm.svelte" import EventDeleteConfirm from "@app/components/EventDeleteConfirm.svelte"
import {ENABLE_ZAPS} from "@app/state"
import {publishReaction} from "@app/commands" import {publishReaction} from "@app/commands"
import {pushModal} from "@app/modal" import {pushModal} from "@app/modal"
@@ -40,6 +42,12 @@
<Icon size={4} icon="smile-circle" /> <Icon size={4} icon="smile-circle" />
Send Reaction Send Reaction
</Button> </Button>
{#if ENABLE_ZAPS}
<ZapButton replaceState {url} {event} class="btn btn-secondary w-full">
<Icon size={4} icon="bolt" />
Send Zap
</ZapButton>
{/if}
<Button class="btn btn-neutral w-full" onclick={sendReply}> <Button class="btn btn-neutral w-full" onclick={sendReply}>
<Icon size={4} icon="reply" /> <Icon size={4} icon="reply" />
Send Reply Send Reply
+2 -2
View File
@@ -116,7 +116,7 @@
<div>To <ProfileLink {pubkey} class="!text-primary" /></div> <div>To <ProfileLink {pubkey} class="!text-primary" /></div>
{/snippet} {/snippet}
</ModalHeader> </ModalHeader>
<FieldInline> <FieldInline class="!grid-cols-3">
{#snippet label()} {#snippet label()}
Emoji Reaction Emoji Reaction
{/snippet} {/snippet}
@@ -128,7 +128,7 @@
</div> </div>
{/snippet} {/snippet}
</FieldInline> </FieldInline>
<FieldInline> <FieldInline class="!grid-cols-3">
{#snippet label()} {#snippet label()}
Amount Amount
{/snippet} {/snippet}
+14 -4
View File
@@ -1,4 +1,6 @@
<script lang="ts"> <script lang="ts">
import type {Snippet} from "svelte"
import type {TrustedEvent} from "@welshman/util"
import {deriveZapperForPubkey} from "@welshman/app" import {deriveZapperForPubkey} from "@welshman/app"
import Button from "@lib/components/Button.svelte" import Button from "@lib/components/Button.svelte"
import Zap from "@app/components/Zap.svelte" import Zap from "@app/components/Zap.svelte"
@@ -7,17 +9,25 @@
import {pushModal} from "@app/modal" import {pushModal} from "@app/modal"
import {wallet} from "@app/state" import {wallet} from "@app/state"
const {url, event, children, ...props} = $props() type Props = {
url: string
event: TrustedEvent
children: Snippet
replaceState?: boolean
class?: string
}
const {url, event, children, replaceState, ...props}: Props = $props()
const zapper = deriveZapperForPubkey(event.pubkey) const zapper = deriveZapperForPubkey(event.pubkey)
const onClick = () => { const onClick = () => {
if (!$zapper?.allowsNostr) { if (!$zapper?.allowsNostr) {
pushModal(InfoZapperError, {url, pubkey: event.pubkey, eventId: event.id}) pushModal(InfoZapperError, {url, pubkey: event.pubkey, eventId: event.id}, {replaceState})
} else if ($wallet) { } else if ($wallet) {
pushModal(Zap, {url, pubkey: event.pubkey, eventId: event.id}) pushModal(Zap, {url, pubkey: event.pubkey, eventId: event.id}, {replaceState})
} else { } else {
pushModal(WalletConnect) pushModal(WalletConnect, {}, {replaceState})
} }
} }
</script> </script>