mirror of
https://github.com/aljazceru/rabbit.git
synced 2025-12-18 14:34:25 +01:00
fix: support profile zap
This commit is contained in:
@@ -10,7 +10,6 @@ import useConfig from '@/core/useConfig';
|
|||||||
import useModalState from '@/hooks/useModalState';
|
import useModalState from '@/hooks/useModalState';
|
||||||
import { useTranslation } from '@/i18n/useTranslation';
|
import { useTranslation } from '@/i18n/useTranslation';
|
||||||
import { zapReceipt } from '@/nostr/event';
|
import { zapReceipt } from '@/nostr/event';
|
||||||
import useEvent from '@/nostr/useEvent';
|
|
||||||
import useProfile from '@/nostr/useProfile';
|
import useProfile from '@/nostr/useProfile';
|
||||||
import { fetchLnurlPayRequestMetadata, getLnurlPayRequestUrl, verifyZapReceipt } from '@/nostr/zap';
|
import { fetchLnurlPayRequestMetadata, getLnurlPayRequestUrl, verifyZapReceipt } from '@/nostr/zap';
|
||||||
import ensureNonNull from '@/utils/ensureNonNull';
|
import ensureNonNull from '@/utils/ensureNonNull';
|
||||||
@@ -36,12 +35,6 @@ const ZapReceipt: Component<ZapReceiptProps> = (props) => {
|
|||||||
})),
|
})),
|
||||||
);
|
);
|
||||||
|
|
||||||
const { event: zappedEvent, query: zappedEventQuery } = useEvent(() =>
|
|
||||||
ensureNonNull([event().zappedEventId()] as const)(([eventIdNonNull]) => ({
|
|
||||||
eventId: eventIdNonNull,
|
|
||||||
})),
|
|
||||||
);
|
|
||||||
|
|
||||||
const lnurlQuery = createQuery(() => ({
|
const lnurlQuery = createQuery(() => ({
|
||||||
queryKey: ['fetchLnurlPayRequestMetadata', recipientProfile()] as const,
|
queryKey: ['fetchLnurlPayRequestMetadata', recipientProfile()] as const,
|
||||||
queryFn: ({ queryKey }) => {
|
queryFn: ({ queryKey }) => {
|
||||||
@@ -75,10 +68,8 @@ const ZapReceipt: Component<ZapReceiptProps> = (props) => {
|
|||||||
return result.success;
|
return result.success;
|
||||||
};
|
};
|
||||||
|
|
||||||
const isRemoved = () => zappedEventQuery.isSuccess && zappedEvent() == null;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Show when={!isRemoved() && !shouldMuteEvent(props.event) && verified()}>
|
<Show when={!shouldMuteEvent(props.event) && verified()}>
|
||||||
<div class="flex items-center gap-1 text-sm">
|
<div class="flex items-center gap-1 text-sm">
|
||||||
<div class="flex w-6 flex-col items-center">
|
<div class="flex w-6 flex-col items-center">
|
||||||
<div class="h-4 w-4 shrink-0 text-amber-500" aria-hidden="true">
|
<div class="h-4 w-4 shrink-0 text-amber-500" aria-hidden="true">
|
||||||
@@ -114,10 +105,7 @@ const ZapReceipt: Component<ZapReceiptProps> = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
<div class="notification-event py-1">
|
<div class="notification-event py-1">
|
||||||
<Show
|
<Show when={event().zappedEventId() != null}>
|
||||||
when={zappedEvent()}
|
|
||||||
fallback={<div class="truncate">{i18n()('general.loading')}</div>}
|
|
||||||
>
|
|
||||||
<EventDisplayById eventId={event().zappedEventId()} />
|
<EventDisplayById eventId={event().zappedEventId()} />
|
||||||
</Show>
|
</Show>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user