refactor: address review comments

This commit is contained in:
Alejandro Gomez 2023-07-04 19:30:41 +02:00
parent 6661c7cb32
commit faf75eba69
No known key found for this signature in database
GPG Key ID: 4DF39E566658C817
2 changed files with 9 additions and 22 deletions

View File

@ -264,13 +264,7 @@ function ChatMessage({
setShowZapDialog(false);
try {
const pub = await EventPublisher.nip7();
const reply = await pub?.generic((eb) => {
eb.kind(EventKind.Reaction)
.content(emoji.native || "+1")
.tag(["e", ev.id])
.tag(["p", ev.pubkey]);
return eb;
});
const reply = await pub?.react(ev, emoji.native || "+1");
if (reply) {
console.debug(reply);
System.BroadcastEvent(reply);
@ -333,11 +327,6 @@ function ChatMessage({
{zapTarget && (
<SendZapsDialog
lnurl={zapTarget}
aTag={
streamer === ev.pubkey
? `${link.kind}:${link.author}:${link.id}`
: undefined
}
eTag={ev.id}
pubkey={ev.pubkey}
button={

View File

@ -22,15 +22,7 @@ export function useProfile(link: NostrLink, leaveOpen = false) {
.kinds([LIVE_STREAM])
.authors([link.id]);
const b2 = new RequestBuilder(`profile-host:${link.id.slice(0, 12)}`);
b2.withOptions({
leaveOpen,
})
.withFilter()
.kinds([LIVE_STREAM])
.tag("p", [link.id]);
b.add(b2);
b.withFilter().kinds([LIVE_STREAM]).tag("p", [link.id]);
return b;
}, [link, leaveOpen]);
@ -70,8 +62,14 @@ export function useProfile(link: NostrLink, leaveOpen = false) {
.map((ev) => parseZap(ev, System.ProfileLoader.Cache))
.filter((z) => z && z.valid && z.receiver === link.id);
const sortedStreams = useMemo(() => {
const sorted = [...streams];
sorted.sort((a, b) => b.created_at - a.created_at);
return sorted;
}, [streams]);
return {
streams,
streams: sortedStreams,
zaps,
};
}