mirror of
https://github.com/aljazceru/rabbit.git
synced 2025-12-17 22:14:26 +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 { useTranslation } from '@/i18n/useTranslation';
|
||||
import { zapReceipt } from '@/nostr/event';
|
||||
import useEvent from '@/nostr/useEvent';
|
||||
import useProfile from '@/nostr/useProfile';
|
||||
import { fetchLnurlPayRequestMetadata, getLnurlPayRequestUrl, verifyZapReceipt } from '@/nostr/zap';
|
||||
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(() => ({
|
||||
queryKey: ['fetchLnurlPayRequestMetadata', recipientProfile()] as const,
|
||||
queryFn: ({ queryKey }) => {
|
||||
@@ -75,10 +68,8 @@ const ZapReceipt: Component<ZapReceiptProps> = (props) => {
|
||||
return result.success;
|
||||
};
|
||||
|
||||
const isRemoved = () => zappedEventQuery.isSuccess && zappedEvent() == null;
|
||||
|
||||
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 w-6 flex-col items-center">
|
||||
<div class="h-4 w-4 shrink-0 text-amber-500" aria-hidden="true">
|
||||
@@ -114,10 +105,7 @@ const ZapReceipt: Component<ZapReceiptProps> = (props) => {
|
||||
</div>
|
||||
</Show>
|
||||
<div class="notification-event py-1">
|
||||
<Show
|
||||
when={zappedEvent()}
|
||||
fallback={<div class="truncate">{i18n()('general.loading')}</div>}
|
||||
>
|
||||
<Show when={event().zappedEventId() != null}>
|
||||
<EventDisplayById eventId={event().zappedEventId()} />
|
||||
</Show>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user