Yarn upgrade
@snort/system upgrade Setup ts-load for react-intl
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import { useMemo } from "react";
|
||||
|
||||
import {
|
||||
TaggedRawEvent,
|
||||
TaggedNostrEvent,
|
||||
EventKind,
|
||||
NoteCollection,
|
||||
RequestBuilder,
|
||||
@ -9,14 +9,13 @@ import {
|
||||
import { useRequestBuilder } from "@snort/system-react";
|
||||
|
||||
import { findTag, toAddress, getTagValues } from "utils";
|
||||
import { System } from "index";
|
||||
import type { Badge } from "types";
|
||||
|
||||
export function useBadges(
|
||||
pubkey: string,
|
||||
since: number,
|
||||
leaveOpen = true
|
||||
): { badges: Badge[]; awards: TaggedRawEvent[] } {
|
||||
): { badges: Badge[]; awards: TaggedNostrEvent[] } {
|
||||
const rb = useMemo(() => {
|
||||
const rb = new RequestBuilder(`badges:${pubkey.slice(0, 12)}`);
|
||||
rb.withOptions({ leaveOpen });
|
||||
@ -28,11 +27,7 @@ export function useBadges(
|
||||
return rb;
|
||||
}, [pubkey, since]);
|
||||
|
||||
const { data: badgeEvents } = useRequestBuilder<NoteCollection>(
|
||||
System,
|
||||
NoteCollection,
|
||||
rb
|
||||
);
|
||||
const { data: badgeEvents } = useRequestBuilder(NoteCollection, rb);
|
||||
|
||||
const rawBadges = useMemo(() => {
|
||||
if (badgeEvents) {
|
||||
@ -59,11 +54,7 @@ export function useBadges(
|
||||
return rb;
|
||||
}, [rawBadges]);
|
||||
|
||||
const acceptedStream = useRequestBuilder<NoteCollection>(
|
||||
System,
|
||||
NoteCollection,
|
||||
acceptedSub
|
||||
);
|
||||
const acceptedStream = useRequestBuilder(NoteCollection, acceptedSub);
|
||||
const acceptedEvents = acceptedStream.data ?? [];
|
||||
|
||||
const badges = useMemo(() => {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { useMemo } from "react";
|
||||
|
||||
import {
|
||||
TaggedRawEvent,
|
||||
TaggedNostrEvent,
|
||||
ReplaceableNoteStore,
|
||||
NoteCollection,
|
||||
RequestBuilder,
|
||||
@ -10,13 +10,12 @@ import { useRequestBuilder } from "@snort/system-react";
|
||||
|
||||
import { USER_CARDS, CARD } from "const";
|
||||
import { findTag } from "utils";
|
||||
import { System } from "index";
|
||||
|
||||
export function useUserCards(
|
||||
pubkey: string,
|
||||
userCards: Array<string[]>,
|
||||
leaveOpen = false
|
||||
): TaggedRawEvent[] {
|
||||
): TaggedNostrEvent[] {
|
||||
const related = useMemo(() => {
|
||||
// filtering to only show CARD kinds for now, but in the future we could link and render anything
|
||||
if (userCards?.length > 0) {
|
||||
@ -49,11 +48,7 @@ export function useUserCards(
|
||||
return rb;
|
||||
}, [pubkey, related]);
|
||||
|
||||
const { data } = useRequestBuilder<NoteCollection>(
|
||||
System,
|
||||
NoteCollection,
|
||||
subRelated
|
||||
);
|
||||
const { data } = useRequestBuilder(NoteCollection, subRelated);
|
||||
|
||||
const cards = useMemo(() => {
|
||||
return related
|
||||
@ -68,13 +63,16 @@ export function useUserCards(
|
||||
);
|
||||
})
|
||||
.filter((e) => e)
|
||||
.map((e) => e as TaggedRawEvent);
|
||||
.map((e) => e as TaggedNostrEvent);
|
||||
}, [related, data]);
|
||||
|
||||
return cards;
|
||||
}
|
||||
|
||||
export function useCards(pubkey: string, leaveOpen = false): TaggedRawEvent[] {
|
||||
export function useCards(
|
||||
pubkey: string,
|
||||
leaveOpen = false
|
||||
): TaggedNostrEvent[] {
|
||||
const sub = useMemo(() => {
|
||||
const b = new RequestBuilder(`user-cards:${pubkey.slice(0, 12)}`);
|
||||
b.withOptions({
|
||||
@ -86,11 +84,7 @@ export function useCards(pubkey: string, leaveOpen = false): TaggedRawEvent[] {
|
||||
return b;
|
||||
}, [pubkey, leaveOpen]);
|
||||
|
||||
const { data: userCards } = useRequestBuilder<ReplaceableNoteStore>(
|
||||
System,
|
||||
ReplaceableNoteStore,
|
||||
sub
|
||||
);
|
||||
const { data: userCards } = useRequestBuilder(ReplaceableNoteStore, sub);
|
||||
|
||||
const related = useMemo(() => {
|
||||
// filtering to only show CARD kinds for now, but in the future we could link and render anything
|
||||
@ -124,11 +118,7 @@ export function useCards(pubkey: string, leaveOpen = false): TaggedRawEvent[] {
|
||||
return rb;
|
||||
}, [pubkey, related]);
|
||||
|
||||
const { data } = useRequestBuilder<NoteCollection>(
|
||||
System,
|
||||
NoteCollection,
|
||||
subRelated
|
||||
);
|
||||
const { data } = useRequestBuilder(NoteCollection, subRelated);
|
||||
const cardEvents = data ?? [];
|
||||
|
||||
const cards = useMemo(() => {
|
||||
@ -144,7 +134,7 @@ export function useCards(pubkey: string, leaveOpen = false): TaggedRawEvent[] {
|
||||
);
|
||||
})
|
||||
.filter((e) => e)
|
||||
.map((e) => e as TaggedRawEvent);
|
||||
.map((e) => e as TaggedNostrEvent);
|
||||
}, [related, cardEvents]);
|
||||
|
||||
return cards;
|
||||
|
@ -5,11 +5,10 @@ import {
|
||||
NostrPrefix,
|
||||
NoteCollection,
|
||||
RequestBuilder,
|
||||
TaggedRawEvent,
|
||||
TaggedNostrEvent,
|
||||
} from "@snort/system";
|
||||
import { useRequestBuilder } from "@snort/system-react";
|
||||
import { LIVE_STREAM } from "const";
|
||||
import { System } from "index";
|
||||
import { useMemo } from "react";
|
||||
|
||||
export function useCurrentStreamFeed(
|
||||
@ -42,10 +41,10 @@ export function useCurrentStreamFeed(
|
||||
return b;
|
||||
}, [link.id, leaveOpen]);
|
||||
|
||||
const q = useRequestBuilder(System, NoteCollection, sub);
|
||||
const q = useRequestBuilder(NoteCollection, sub);
|
||||
|
||||
if (evPreload) {
|
||||
q.add(evPreload as TaggedRawEvent);
|
||||
q.add(evPreload as TaggedNostrEvent);
|
||||
}
|
||||
|
||||
return useMemo(() => {
|
||||
|
@ -8,7 +8,6 @@ import {
|
||||
NostrEvent,
|
||||
} from "@snort/system";
|
||||
import { useRequestBuilder } from "@snort/system-react";
|
||||
import { System } from "index";
|
||||
import { findTag } from "utils";
|
||||
import { EMOJI_PACK, USER_EMOJIS } from "const";
|
||||
import type { EmojiPack, Tags, EmojiTag } from "types";
|
||||
@ -64,11 +63,7 @@ export function useUserEmojiPacks(pubkey?: string, userEmoji?: Tags) {
|
||||
return rb;
|
||||
}, [pubkey, related]);
|
||||
|
||||
const { data: relatedData } = useRequestBuilder<NoteCollection>(
|
||||
System,
|
||||
NoteCollection,
|
||||
subRelated
|
||||
);
|
||||
const { data: relatedData } = useRequestBuilder(NoteCollection, subRelated);
|
||||
|
||||
const emojiPacks = useMemo(() => {
|
||||
return relatedData ?? [];
|
||||
@ -92,11 +87,7 @@ export default function useEmoji(pubkey?: string) {
|
||||
return rb;
|
||||
}, [pubkey]);
|
||||
|
||||
const { data: userEmoji } = useRequestBuilder<ReplaceableNoteStore>(
|
||||
System,
|
||||
ReplaceableNoteStore,
|
||||
sub
|
||||
);
|
||||
const { data: userEmoji } = useRequestBuilder(ReplaceableNoteStore, sub);
|
||||
|
||||
const emojis = useUserEmojiPacks(pubkey, userEmoji?.tags ?? []);
|
||||
return emojis;
|
||||
|
@ -7,8 +7,6 @@ import {
|
||||
} from "@snort/system";
|
||||
import { useRequestBuilder } from "@snort/system-react";
|
||||
|
||||
import { System } from "index";
|
||||
|
||||
export default function useEventFeed(link: NostrLink, leaveOpen = false) {
|
||||
const sub = useMemo(() => {
|
||||
const b = new RequestBuilder(`event:${link.id.slice(0, 12)}`);
|
||||
@ -35,9 +33,5 @@ export default function useEventFeed(link: NostrLink, leaveOpen = false) {
|
||||
return b;
|
||||
}, [link, leaveOpen]);
|
||||
|
||||
return useRequestBuilder<ReplaceableNoteStore>(
|
||||
System,
|
||||
ReplaceableNoteStore,
|
||||
sub
|
||||
);
|
||||
return useRequestBuilder(ReplaceableNoteStore, sub);
|
||||
}
|
||||
|
@ -8,8 +8,6 @@ import {
|
||||
} from "@snort/system";
|
||||
import { useRequestBuilder } from "@snort/system-react";
|
||||
|
||||
import { System } from "index";
|
||||
|
||||
export function useAddress(kind: number, pubkey: string, identifier: string) {
|
||||
const sub = useMemo(() => {
|
||||
const b = new RequestBuilder(`event:${kind}:${identifier}`);
|
||||
@ -17,11 +15,7 @@ export function useAddress(kind: number, pubkey: string, identifier: string) {
|
||||
return b;
|
||||
}, [kind, pubkey, identifier]);
|
||||
|
||||
const { data } = useRequestBuilder<ReplaceableNoteStore>(
|
||||
System,
|
||||
ReplaceableNoteStore,
|
||||
sub
|
||||
);
|
||||
const { data } = useRequestBuilder(ReplaceableNoteStore, sub);
|
||||
|
||||
return data;
|
||||
}
|
||||
@ -49,11 +43,7 @@ export function useEvent(link: NostrLink) {
|
||||
return b;
|
||||
}, [link]);
|
||||
|
||||
const { data } = useRequestBuilder<ReplaceableNoteStore>(
|
||||
System,
|
||||
ReplaceableNoteStore,
|
||||
sub
|
||||
);
|
||||
const { data } = useRequestBuilder(ReplaceableNoteStore, sub);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
@ -24,11 +24,7 @@ export function useZaps(goal: NostrEvent, leaveOpen = false) {
|
||||
return b;
|
||||
}, [goal, leaveOpen]);
|
||||
|
||||
const { data } = useRequestBuilder<NoteCollection>(
|
||||
System,
|
||||
NoteCollection,
|
||||
sub
|
||||
);
|
||||
const { data } = useRequestBuilder(NoteCollection, sub);
|
||||
|
||||
return (
|
||||
data
|
||||
@ -49,11 +45,7 @@ export function useZapGoal(host: string, link?: NostrLink, leaveOpen = false) {
|
||||
return b;
|
||||
}, [link, leaveOpen]);
|
||||
|
||||
const { data } = useRequestBuilder<ReplaceableNoteStore>(
|
||||
System,
|
||||
ReplaceableNoteStore,
|
||||
sub
|
||||
);
|
||||
const { data } = useRequestBuilder(ReplaceableNoteStore, sub);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import { useRequestBuilder } from "@snort/system-react";
|
||||
|
||||
import { MUTED } from "const";
|
||||
import { getTagValues } from "utils";
|
||||
import { System } from "index";
|
||||
|
||||
export function useMutedPubkeys(host?: string, leaveOpen = false) {
|
||||
const mutedSub = useMemo(() => {
|
||||
@ -16,11 +15,7 @@ export function useMutedPubkeys(host?: string, leaveOpen = false) {
|
||||
return rb;
|
||||
}, [host]);
|
||||
|
||||
const { data: muted } = useRequestBuilder<ReplaceableNoteStore>(
|
||||
System,
|
||||
ReplaceableNoteStore,
|
||||
mutedSub
|
||||
);
|
||||
const { data: muted } = useRequestBuilder(ReplaceableNoteStore, mutedSub);
|
||||
const mutedPubkeys = useMemo(() => {
|
||||
return new Set(getTagValues(muted?.tags ?? [], "p"));
|
||||
}, [muted]);
|
||||
|
@ -2,11 +2,10 @@ import {
|
||||
NostrLink,
|
||||
RequestBuilder,
|
||||
EventKind,
|
||||
FlatNoteStore,
|
||||
NoteCollection,
|
||||
} from "@snort/system";
|
||||
import { useRequestBuilder } from "@snort/system-react";
|
||||
import { unixNow } from "@snort/shared";
|
||||
import { System } from "index";
|
||||
import { useMemo } from "react";
|
||||
import { LIVE_STREAM_CHAT, WEEK } from "const";
|
||||
|
||||
@ -27,7 +26,7 @@ export function useLiveChatFeed(link: NostrLink, eZaps?: Array<string>) {
|
||||
return rb;
|
||||
}, [link.id, since, eZaps]);
|
||||
|
||||
const feed = useRequestBuilder<FlatNoteStore>(System, FlatNoteStore, sub);
|
||||
const feed = useRequestBuilder(NoteCollection, sub);
|
||||
|
||||
const messages = useMemo(() => {
|
||||
return (feed.data ?? []).filter((ev) => ev.kind === LIVE_STREAM_CHAT);
|
||||
@ -52,11 +51,7 @@ export function useLiveChatFeed(link: NostrLink, eZaps?: Array<string>) {
|
||||
return rb;
|
||||
}, [etags]);
|
||||
|
||||
const reactionsSub = useRequestBuilder<FlatNoteStore>(
|
||||
System,
|
||||
FlatNoteStore,
|
||||
esub
|
||||
);
|
||||
const reactionsSub = useRequestBuilder(NoteCollection, esub);
|
||||
|
||||
const reactions = reactionsSub.data ?? [];
|
||||
|
||||
|
@ -5,7 +5,7 @@ import { useRequestBuilder } from "@snort/system-react";
|
||||
|
||||
import { unixNow } from "@snort/shared";
|
||||
import { LIVE_STREAM } from "const";
|
||||
import { System, StreamState } from "index";
|
||||
import { StreamState } from "index";
|
||||
import { findTag } from "utils";
|
||||
import { WEEK } from "const";
|
||||
|
||||
@ -34,7 +34,7 @@ export function useStreamsFeed(tag?: string) {
|
||||
return bStart > aStart ? 1 : -1;
|
||||
}
|
||||
|
||||
const feed = useRequestBuilder<NoteCollection>(System, NoteCollection, rb);
|
||||
const feed = useRequestBuilder(NoteCollection, rb);
|
||||
const feedSorted = useMemo(() => {
|
||||
if (feed.data) {
|
||||
if (__XXX) {
|
||||
|
@ -6,8 +6,8 @@ import { useRequestBuilder } from "@snort/system-react";
|
||||
import { useUserEmojiPacks } from "hooks/emoji";
|
||||
import { MUTED, USER_CARDS, USER_EMOJIS } from "const";
|
||||
import type { Tags } from "types";
|
||||
import { System, Login } from "index";
|
||||
import { getPublisher } from "login";
|
||||
import { Login } from "index";
|
||||
|
||||
export function useLogin() {
|
||||
const session = useSyncExternalStore(
|
||||
@ -42,11 +42,7 @@ export function useLoginEvents(pubkey?: string, leaveOpen = false) {
|
||||
return b;
|
||||
}, [pubkey, leaveOpen]);
|
||||
|
||||
const { data } = useRequestBuilder<NoteCollection>(
|
||||
System,
|
||||
NoteCollection,
|
||||
sub
|
||||
);
|
||||
const { data } = useRequestBuilder(NoteCollection, sub);
|
||||
|
||||
useEffect(() => {
|
||||
if (!data) {
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { useMemo } from "react";
|
||||
import {
|
||||
RequestBuilder,
|
||||
FlatNoteStore,
|
||||
NoteCollection,
|
||||
NostrLink,
|
||||
EventKind,
|
||||
@ -27,11 +26,7 @@ export function useProfile(link: NostrLink, leaveOpen = false) {
|
||||
return b;
|
||||
}, [link, leaveOpen]);
|
||||
|
||||
const { data: streamsData } = useRequestBuilder<NoteCollection>(
|
||||
System,
|
||||
NoteCollection,
|
||||
sub
|
||||
);
|
||||
const { data: streamsData } = useRequestBuilder(NoteCollection, sub);
|
||||
const streams = streamsData ?? [];
|
||||
|
||||
const addresses = useMemo(() => {
|
||||
@ -52,11 +47,7 @@ export function useProfile(link: NostrLink, leaveOpen = false) {
|
||||
return b;
|
||||
}, [link, addresses, leaveOpen]);
|
||||
|
||||
const { data: zapsData } = useRequestBuilder<FlatNoteStore>(
|
||||
System,
|
||||
FlatNoteStore,
|
||||
zapsSub
|
||||
);
|
||||
const { data: zapsData } = useRequestBuilder(NoteCollection, zapsSub);
|
||||
const zaps = (zapsData ?? [])
|
||||
.map((ev) => parseZap(ev, System.ProfileLoader.Cache))
|
||||
.filter((z) => z && z.valid && z.receiver === link.id);
|
||||
|
Reference in New Issue
Block a user