forked from Kieran/zap.stream
refactor: address review comments
This commit is contained in:
parent
669bba5828
commit
0c8054949f
@ -4,7 +4,7 @@ import {
|
||||
NostrPrefix,
|
||||
NostrLink,
|
||||
ParsedZap,
|
||||
TaggedRawEvent,
|
||||
NostrEvent,
|
||||
parseZap,
|
||||
encodeTLV,
|
||||
} from "@snort/system";
|
||||
@ -60,8 +60,8 @@ export function LiveChat({
|
||||
height,
|
||||
}: {
|
||||
link: NostrLink;
|
||||
ev?: TaggedRawEvent;
|
||||
goal?: TaggedRawEvent;
|
||||
ev?: NostrEvent;
|
||||
goal?: NostrEvent;
|
||||
options?: LiveChatOptions;
|
||||
height?: number;
|
||||
}) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { useMemo } from "react";
|
||||
import {
|
||||
RequestBuilder,
|
||||
FlatNoteStore,
|
||||
NoteCollection,
|
||||
NostrEvent,
|
||||
EventKind,
|
||||
NostrLink,
|
||||
@ -11,7 +11,7 @@ import { GOAL } from "const";
|
||||
import { System } from "index";
|
||||
import { findTag } from "utils";
|
||||
|
||||
export function useGoal(link: NostrLink, leaveOpen = false) {
|
||||
export function useZapGoal(link: NostrLink, leaveOpen = false) {
|
||||
const sub = useMemo(() => {
|
||||
const b = new RequestBuilder(`goals:${link.author!.slice(0, 12)}`);
|
||||
b.withOptions({ leaveOpen });
|
||||
@ -21,7 +21,11 @@ export function useGoal(link: NostrLink, leaveOpen = false) {
|
||||
return b;
|
||||
}, [link]);
|
||||
|
||||
const { data } = useRequestBuilder<FlatNoteStore>(System, FlatNoteStore, sub);
|
||||
const { data } = useRequestBuilder<NoteCollection>(
|
||||
System,
|
||||
NoteCollection,
|
||||
sub
|
||||
);
|
||||
|
||||
return data?.at(0);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import { Profile, getName } from "element/profile";
|
||||
import { LiveChat } from "element/live-chat";
|
||||
import AsyncButton from "element/async-button";
|
||||
import { useLogin } from "hooks/login";
|
||||
import { useGoal } from "hooks/goals";
|
||||
import { useZapGoal } from "hooks/goals";
|
||||
import { StreamState, System } from "index";
|
||||
import { SendZapsDialog } from "element/send-zap";
|
||||
import { NostrEvent } from "@snort/system";
|
||||
@ -108,7 +108,7 @@ export function StreamPage() {
|
||||
const params = useParams();
|
||||
const link = parseNostrLink(params.id!);
|
||||
const { data: ev } = useEventFeed(link, true);
|
||||
const goal = useGoal(link, true);
|
||||
const goal = useZapGoal(link, true);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
Loading…
Reference in New Issue
Block a user