forked from Kieran/zap.stream
refactor: address review comments
This commit is contained in:
parent
6661c7cb32
commit
faf75eba69
@ -264,13 +264,7 @@ function ChatMessage({
|
|||||||
setShowZapDialog(false);
|
setShowZapDialog(false);
|
||||||
try {
|
try {
|
||||||
const pub = await EventPublisher.nip7();
|
const pub = await EventPublisher.nip7();
|
||||||
const reply = await pub?.generic((eb) => {
|
const reply = await pub?.react(ev, emoji.native || "+1");
|
||||||
eb.kind(EventKind.Reaction)
|
|
||||||
.content(emoji.native || "+1")
|
|
||||||
.tag(["e", ev.id])
|
|
||||||
.tag(["p", ev.pubkey]);
|
|
||||||
return eb;
|
|
||||||
});
|
|
||||||
if (reply) {
|
if (reply) {
|
||||||
console.debug(reply);
|
console.debug(reply);
|
||||||
System.BroadcastEvent(reply);
|
System.BroadcastEvent(reply);
|
||||||
@ -333,11 +327,6 @@ function ChatMessage({
|
|||||||
{zapTarget && (
|
{zapTarget && (
|
||||||
<SendZapsDialog
|
<SendZapsDialog
|
||||||
lnurl={zapTarget}
|
lnurl={zapTarget}
|
||||||
aTag={
|
|
||||||
streamer === ev.pubkey
|
|
||||||
? `${link.kind}:${link.author}:${link.id}`
|
|
||||||
: undefined
|
|
||||||
}
|
|
||||||
eTag={ev.id}
|
eTag={ev.id}
|
||||||
pubkey={ev.pubkey}
|
pubkey={ev.pubkey}
|
||||||
button={
|
button={
|
||||||
|
@ -22,15 +22,7 @@ export function useProfile(link: NostrLink, leaveOpen = false) {
|
|||||||
.kinds([LIVE_STREAM])
|
.kinds([LIVE_STREAM])
|
||||||
.authors([link.id]);
|
.authors([link.id]);
|
||||||
|
|
||||||
const b2 = new RequestBuilder(`profile-host:${link.id.slice(0, 12)}`);
|
b.withFilter().kinds([LIVE_STREAM]).tag("p", [link.id]);
|
||||||
b2.withOptions({
|
|
||||||
leaveOpen,
|
|
||||||
})
|
|
||||||
.withFilter()
|
|
||||||
.kinds([LIVE_STREAM])
|
|
||||||
.tag("p", [link.id]);
|
|
||||||
|
|
||||||
b.add(b2);
|
|
||||||
|
|
||||||
return b;
|
return b;
|
||||||
}, [link, leaveOpen]);
|
}, [link, leaveOpen]);
|
||||||
@ -70,8 +62,14 @@ export function useProfile(link: NostrLink, leaveOpen = false) {
|
|||||||
.map((ev) => parseZap(ev, System.ProfileLoader.Cache))
|
.map((ev) => parseZap(ev, System.ProfileLoader.Cache))
|
||||||
.filter((z) => z && z.valid && z.receiver === link.id);
|
.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 {
|
return {
|
||||||
streams,
|
streams: sortedStreams,
|
||||||
zaps,
|
zaps,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user