refactor: upgrade
This commit is contained in:
@ -1,10 +1,10 @@
|
||||
import { useMemo } from "react";
|
||||
|
||||
import { TaggedNostrEvent, EventKind, NoteCollection, RequestBuilder } from "@snort/system";
|
||||
import { EventKind, NoteCollection, RequestBuilder, TaggedNostrEvent } from "@snort/system";
|
||||
import { useRequestBuilder } from "@snort/system-react";
|
||||
|
||||
import { findTag, toAddress, getTagValues } from "utils";
|
||||
import type { Badge } from "types";
|
||||
import { findTag, getTagValues, toAddress } from "@/utils";
|
||||
import type { Badge } from "@/types";
|
||||
|
||||
export function useBadges(
|
||||
pubkey: string,
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { useMemo } from "react";
|
||||
|
||||
import { TaggedNostrEvent, ReplaceableNoteStore, NoteCollection, RequestBuilder } from "@snort/system";
|
||||
import { NoteCollection, ReplaceableNoteStore, RequestBuilder, TaggedNostrEvent } from "@snort/system";
|
||||
import { useRequestBuilder } from "@snort/system-react";
|
||||
|
||||
import { USER_CARDS, CARD } from "const";
|
||||
import { findTag } from "utils";
|
||||
import { CARD, USER_CARDS } from "@/const";
|
||||
import { findTag } from "@/utils";
|
||||
|
||||
export function useUserCards(pubkey: string, userCards: Array<string[]>, leaveOpen = false): TaggedNostrEvent[] {
|
||||
const related = useMemo(() => {
|
||||
|
@ -1,9 +1,10 @@
|
||||
import { unwrap } from "@snort/shared";
|
||||
import { NostrEvent, NostrLink, NostrPrefix, NoteCollection, RequestBuilder, TaggedNostrEvent } from "@snort/system";
|
||||
import { useRequestBuilder } from "@snort/system-react";
|
||||
import { LIVE_STREAM } from "const";
|
||||
import { useMemo } from "react";
|
||||
|
||||
import { LIVE_STREAM } from "@/const";
|
||||
|
||||
export function useCurrentStreamFeed(link: NostrLink, leaveOpen = false, evPreload?: NostrEvent) {
|
||||
const author = link.type === NostrPrefix.Address ? unwrap(link.author) : link.id;
|
||||
const sub = useMemo(() => {
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { useMemo } from "react";
|
||||
import uniqBy from "lodash.uniqby";
|
||||
|
||||
import { RequestBuilder, ReplaceableNoteStore, NoteCollection, NostrEvent } from "@snort/system";
|
||||
import { NostrEvent, NoteCollection, ReplaceableNoteStore, RequestBuilder } from "@snort/system";
|
||||
import { useRequestBuilder } from "@snort/system-react";
|
||||
import { findTag } from "utils";
|
||||
import { EMOJI_PACK, USER_EMOJIS } from "const";
|
||||
import type { EmojiPack, Tags, EmojiTag } from "types";
|
||||
import { findTag } from "@/utils";
|
||||
import { EMOJI_PACK, USER_EMOJIS } from "@/const";
|
||||
import type { EmojiPack, EmojiTag, Tags } from "@/types";
|
||||
|
||||
function cleanShortcode(shortcode?: string) {
|
||||
return shortcode?.replace(/\s+/g, "_").replace(/_$/, "");
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { useMemo } from "react";
|
||||
import { NostrPrefix, RequestBuilder, ReplaceableNoteStore, NostrLink } from "@snort/system";
|
||||
import { NostrLink, NostrPrefix, ReplaceableNoteStore, RequestBuilder } from "@snort/system";
|
||||
import { useRequestBuilder } from "@snort/system-react";
|
||||
|
||||
export default function useEventFeed(link: NostrLink, leaveOpen = false) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { useMemo } from "react";
|
||||
|
||||
import { NostrPrefix, ReplaceableNoteStore, RequestBuilder, type NostrLink } from "@snort/system";
|
||||
import { type NostrLink, NostrPrefix, ReplaceableNoteStore, RequestBuilder } from "@snort/system";
|
||||
import { useRequestBuilder } from "@snort/system-react";
|
||||
|
||||
export function useAddress(kind: number, pubkey: string, identifier: string) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { useMemo } from "react";
|
||||
import { RequestBuilder, FlatNoteStore, ReplaceableNoteStore } from "@snort/system";
|
||||
import { FlatNoteStore, ReplaceableNoteStore, RequestBuilder } from "@snort/system";
|
||||
import { useRequestBuilder } from "@snort/system-react";
|
||||
import { GOAL } from "const";
|
||||
import { GOAL } from "@/const";
|
||||
|
||||
export function useZapGoal(id?: string) {
|
||||
const sub = useMemo(() => {
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { useMemo } from "react";
|
||||
|
||||
import { RequestBuilder, ReplaceableNoteStore } from "@snort/system";
|
||||
import { ReplaceableNoteStore, RequestBuilder } from "@snort/system";
|
||||
import { useRequestBuilder } from "@snort/system-react";
|
||||
|
||||
import { MUTED } from "const";
|
||||
import { getTagValues } from "utils";
|
||||
import { MUTED } from "@/const";
|
||||
import { getTagValues } from "@/utils";
|
||||
|
||||
export function useMutedPubkeys(host?: string, leaveOpen = false) {
|
||||
const mutedSub = useMemo(() => {
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { NostrLink, RequestBuilder, NoteCollection } from "@snort/system";
|
||||
import { NostrLink, NoteCollection, RequestBuilder } from "@snort/system";
|
||||
import { useReactions, useRequestBuilder } from "@snort/system-react";
|
||||
import { unixNow } from "@snort/shared";
|
||||
import { useMemo } from "react";
|
||||
import { LIVE_STREAM_CHAT, WEEK } from "const";
|
||||
import { LIVE_STREAM_CHAT, WEEK } from "@/const";
|
||||
|
||||
export function useLiveChatFeed(link?: NostrLink, eZaps?: Array<string>, limit = 100) {
|
||||
const since = useMemo(() => unixNow() - WEEK, [link?.id]);
|
||||
|
@ -4,10 +4,10 @@ import { NostrEvent, NoteCollection, RequestBuilder } from "@snort/system";
|
||||
import { useRequestBuilder } from "@snort/system-react";
|
||||
|
||||
import { unixNow } from "@snort/shared";
|
||||
import { LIVE_STREAM } from "const";
|
||||
import { StreamState } from "index";
|
||||
import { findTag, getHost } from "utils";
|
||||
import { WEEK } from "const";
|
||||
import { LIVE_STREAM } from "@/const";
|
||||
import { StreamState } from "@/index";
|
||||
import { findTag, getHost } from "@/utils";
|
||||
import { WEEK } from "@/const";
|
||||
|
||||
export function useStreamsFeed(tag?: string) {
|
||||
const since = useMemo(() => unixNow() - WEEK, [tag]);
|
||||
|
@ -1,13 +1,13 @@
|
||||
import { useSyncExternalStore, useMemo, useState, useEffect } from "react";
|
||||
import { useEffect, useMemo, useState, useSyncExternalStore } from "react";
|
||||
|
||||
import { EventKind, NoteCollection, RequestBuilder } from "@snort/system";
|
||||
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 { getPublisher } from "login";
|
||||
import { Login } from "index";
|
||||
import { useUserEmojiPacks } from "@/hooks/emoji";
|
||||
import { MUTED, USER_CARDS, USER_EMOJIS } from "@/const";
|
||||
import type { Tags } from "@/types";
|
||||
import { getPublisher } from "@/login";
|
||||
import { Login } from "@/index";
|
||||
|
||||
export function useLogin() {
|
||||
const session = useSyncExternalStore(
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { useMemo } from "react";
|
||||
import { RequestBuilder, NoteCollection, NostrLink } from "@snort/system";
|
||||
import { NostrLink, NoteCollection, RequestBuilder } from "@snort/system";
|
||||
import { useRequestBuilder } from "@snort/system-react";
|
||||
import { LIVE_STREAM } from "const";
|
||||
import { LIVE_STREAM } from "@/const";
|
||||
import { useZaps } from "./zaps";
|
||||
|
||||
export function useProfile(link: NostrLink, leaveOpen = false) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { fetchNip05Pubkey } from "@snort/shared";
|
||||
import { NostrLink, tryParseNostrLink, NostrPrefix } from "@snort/system";
|
||||
import { useState, useEffect } from "react";
|
||||
import { NostrLink, NostrPrefix, tryParseNostrLink } from "@snort/system";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useParams } from "react-router-dom";
|
||||
|
||||
export function useStreamLink() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { StreamProviderStore } from "providers";
|
||||
import { StreamProviderStore } from "@/providers";
|
||||
import { useSyncExternalStore } from "react";
|
||||
|
||||
export function useStreamProvider() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { useMemo } from "react";
|
||||
import { NostrLink, RequestBuilder, EventKind, NoteCollection, parseZap } from "@snort/system";
|
||||
import { EventKind, NostrLink, NoteCollection, RequestBuilder, parseZap } from "@snort/system";
|
||||
import { useRequestBuilder } from "@snort/system-react";
|
||||
|
||||
export function useZaps(link?: NostrLink, leaveOpen = false) {
|
||||
|
Reference in New Issue
Block a user