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