mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-03-18 05:41:44 +01:00
Merge branch 'next'
This commit is contained in:
commit
902ffa00ba
.changeset
src
5
.changeset/few-melons-watch.md
Normal file
5
.changeset/few-melons-watch.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"nostrudel": patch
|
||||
---
|
||||
|
||||
Fix stream view crashing when failing to parse zap request
|
5
.changeset/honest-chicken-pretend.md
Normal file
5
.changeset/honest-chicken-pretend.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"nostrudel": patch
|
||||
---
|
||||
|
||||
Fix npub in url getting replaced in post modal
|
@ -1,4 +1,4 @@
|
||||
export const mentionNpubOrNote = /@?((npub1|note1)[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{58})/gi;
|
||||
export const mentionNpubOrNote = /(?:\s|^)(@|nostr:)?((npub1|note1)[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{58})(?:\s|$)/gi;
|
||||
export const matchImageUrls =
|
||||
/https?:\/\/([\dA-z\.-]+\.[A-z\.]{2,12})((?:\/[\+~%\/\.\w\-_]*)?\.(?:svg|gif|png|jpg|jpeg|webp|avif))(\??(?:[\?#\-\+=&;%@\.\w_]*)#?(?:[\-\.\!\/\\\w]*))?/i;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React, { useRef } from "react";
|
||||
import React, { useMemo, useRef } from "react";
|
||||
import { Box, Flex, Text } from "@chakra-ui/react";
|
||||
import { ParsedStream } from "../../../../helpers/nostr/stream";
|
||||
import { UserAvatar } from "../../../../components/user-avatar";
|
||||
@ -15,20 +15,25 @@ function ZapMessage({ zap, stream }: { zap: NostrEvent; stream: ParsedStream })
|
||||
const ref = useRef<HTMLDivElement | null>(null);
|
||||
useRegisterIntersectionEntity(ref, zap.id);
|
||||
|
||||
const { request, payment } = parseZapEvent(zap);
|
||||
if (!payment.amount) return null;
|
||||
const parsed = useMemo(() => {
|
||||
try {
|
||||
return parseZapEvent(zap);
|
||||
} catch (e) {}
|
||||
}, [zap]);
|
||||
|
||||
if (!parsed || !parsed.payment.amount) return null;
|
||||
|
||||
return (
|
||||
<TrustProvider event={request}>
|
||||
<TrustProvider event={parsed.request}>
|
||||
<Flex direction="column" borderRadius="md" borderColor="yellow.400" borderWidth="1px" p="2" ref={ref}>
|
||||
<Flex gap="2">
|
||||
<LightningIcon color="yellow.400" />
|
||||
<UserAvatar pubkey={request.pubkey} size="xs" />
|
||||
<UserLink pubkey={request.pubkey} fontWeight="bold" color="yellow.400" />
|
||||
<Text>zapped {readablizeSats(payment.amount / 1000)} sats</Text>
|
||||
<UserAvatar pubkey={parsed.request.pubkey} size="xs" />
|
||||
<UserLink pubkey={parsed.request.pubkey} fontWeight="bold" color="yellow.400" />
|
||||
<Text>zapped {readablizeSats(parsed.payment.amount / 1000)} sats</Text>
|
||||
</Flex>
|
||||
<Box>
|
||||
<ChatMessageContent event={request} />
|
||||
<ChatMessageContent event={parsed.request} />
|
||||
</Box>
|
||||
</Flex>
|
||||
</TrustProvider>
|
||||
|
Loading…
x
Reference in New Issue
Block a user