diff --git a/packages/app/.eslintrc.cjs b/packages/app/.eslintrc.cjs index eff9da50..f864b73a 100644 --- a/packages/app/.eslintrc.cjs +++ b/packages/app/.eslintrc.cjs @@ -19,7 +19,7 @@ module.exports = { "react-refresh/only-export-components": "warn", "simple-import-sort/imports": "error", "simple-import-sort/exports": "error", - "@typescript-eslint/no-unused-vars": "warn", + "@typescript-eslint/no-unused-vars": "error", }, root: true, ignorePatterns: ["build/", "*.test.ts", "*.js"], diff --git a/packages/app/package.json b/packages/app/package.json index 386716bc..11f7c0d4 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -95,6 +95,7 @@ "@vitejs/plugin-react": "^4.2.0", "@webbtc/webln-types": "^2.1.0", "@webscopeio/react-textarea-autocomplete": "^4.9.2", + "@welldone-software/why-did-you-render": "^8.0.1", "autoprefixer": "^10.4.16", "config": "^3.3.9", "eslint": "^8.48.0", diff --git a/packages/app/src/Components/Event/Create/NoteCreator.tsx b/packages/app/src/Components/Event/Create/NoteCreator.tsx index 8c7d0d90..8082e001 100644 --- a/packages/app/src/Components/Event/Create/NoteCreator.tsx +++ b/packages/app/src/Components/Event/Create/NoteCreator.tsx @@ -296,7 +296,6 @@ export function NoteCreator() { return ( - {root ? : null} + {root ? : null} {!root && refEvent ? (

diff --git a/packages/app/src/Components/Event/ReactionsModal.tsx b/packages/app/src/Components/Event/ReactionsModal.tsx index 579243e9..e8bc15f9 100644 --- a/packages/app/src/Components/Event/ReactionsModal.tsx +++ b/packages/app/src/Components/Event/ReactionsModal.tsx @@ -1,6 +1,6 @@ import "./Reactions.css"; -import { NostrLink, ParsedZap, socialGraphInstance, TaggedNostrEvent } from "@snort/system"; +import { NostrLink, socialGraphInstance, TaggedNostrEvent } from "@snort/system"; import { useEventReactions, useReactions } from "@snort/system-react"; import { useEffect, useMemo, useState } from "react"; import { FormattedMessage, useIntl } from "react-intl"; diff --git a/packages/app/src/Components/Event/Thread.tsx b/packages/app/src/Components/Event/Thread.tsx index b6afbcdc..177084c4 100644 --- a/packages/app/src/Components/Event/Thread.tsx +++ b/packages/app/src/Components/Event/Thread.tsx @@ -1,6 +1,6 @@ import "./Thread.css"; -import { EventExt, NostrLink, NostrPrefix, parseNostrLink, TaggedNostrEvent, u256 } from "@snort/system"; +import { EventExt, NostrPrefix, parseNostrLink, TaggedNostrEvent, u256 } from "@snort/system"; import classNames from "classnames"; import { Fragment, ReactNode, useContext, useMemo, useState } from "react"; import { useIntl } from "react-intl"; @@ -11,7 +11,6 @@ import Collapsed from "@/Components/Collapsed"; import Note from "@/Components/Event/Note"; import NoteGhost from "@/Components/Event/NoteGhost"; import { chainKey, ThreadContext, ThreadContextWrapper } from "@/Hooks/useThreadContext"; -import { getAllLinkReactions } from "@/Utils"; import messages from "../messages"; @@ -32,12 +31,11 @@ interface SubthreadProps { isLastSubthread?: boolean; active: u256; notes: readonly TaggedNostrEvent[]; - related: readonly TaggedNostrEvent[]; chains: Map>; onNavigate: (e: TaggedNostrEvent) => void; } -const Subthread = ({ active, notes, related, chains, onNavigate }: SubthreadProps) => { +const Subthread = ({ active, notes, chains, onNavigate }: SubthreadProps) => { const renderSubthread = (a: TaggedNostrEvent, idx: number) => { const isLastSubthread = idx === notes.length - 1; const replies = getReplies(a.id, chains); @@ -60,7 +58,6 @@ const Subthread = ({ active, notes, related, chains, onNavigate }: SubthreadProp active={active} isLastSubthread={isLastSubthread} notes={replies} - related={related} chains={chains} onNavigate={onNavigate} /> @@ -77,7 +74,7 @@ interface ThreadNoteProps extends Omit { isLast: boolean; } -const ThreadNote = ({ active, note, isLast, isLastSubthread, related, chains, onNavigate }: ThreadNoteProps) => { +const ThreadNote = ({ active, note, isLast, isLastSubthread, chains, onNavigate }: ThreadNoteProps) => { const { formatMessage } = useIntl(); const replies = getReplies(note.id, chains); const activeInReplies = replies.map(r => r.id).includes(active); @@ -108,7 +105,6 @@ const ThreadNote = ({ active, note, isLast, isLastSubthread, related, chains, on active={active} isLastSubthread={isLastSubthread} notes={replies} - related={related} chains={chains} onNavigate={onNavigate} /> @@ -118,7 +114,7 @@ const ThreadNote = ({ active, note, isLast, isLastSubthread, related, chains, on ); }; -const TierTwo = ({ active, isLastSubthread, notes, related, chains, onNavigate }: SubthreadProps) => { +const TierTwo = ({ active, isLastSubthread, notes, chains, onNavigate }: SubthreadProps) => { const [first, ...rest] = notes; return ( @@ -128,7 +124,6 @@ const TierTwo = ({ active, isLastSubthread, notes, related, chains, onNavigate } onNavigate={onNavigate} note={first} chains={chains} - related={related} isLastSubthread={isLastSubthread} isLast={rest.length === 0} /> @@ -142,7 +137,6 @@ const TierTwo = ({ active, isLastSubthread, notes, related, chains, onNavigate } onNavigate={onNavigate} note={r} chains={chains} - related={related} isLastSubthread={isLastSubthread} isLast={lastReply} /> @@ -152,7 +146,7 @@ const TierTwo = ({ active, isLastSubthread, notes, related, chains, onNavigate } ); }; -const TierThree = ({ active, isLastSubthread, notes, related, chains, onNavigate }: SubthreadProps) => { +const TierThree = ({ active, isLastSubthread, notes, chains, onNavigate }: SubthreadProps) => { const [first, ...rest] = notes; const replies = getReplies(first.id, chains); const hasMultipleNotes = rest.length > 0 || replies.length > 0; @@ -171,7 +165,6 @@ const TierThree = ({ active, isLastSubthread, notes, related, chains, onNavigate className={classNames("thread-note", { "is-last-note": isLastSubthread && isLast })} data={first} key={first.id} - related={related} threadChains={chains} />

@@ -182,7 +175,6 @@ const TierThree = ({ active, isLastSubthread, notes, related, chains, onNavigate active={active} isLastSubthread={isLastSubthread} notes={replies} - related={related} chains={chains} onNavigate={onNavigate} /> @@ -275,18 +267,7 @@ export function Thread(props: { onBack?: () => void; disableSpotlight?: boolean } const replies = thread.chains.get(from); if (replies && thread.current) { - return ( - NostrLink.fromEvent(a)), - )} - chains={thread.chains} - onNavigate={navigateThread} - /> - ); + return ; } } diff --git a/packages/app/src/Components/Feed/Articles.tsx b/packages/app/src/Components/Feed/Articles.tsx index 6f7fec29..d9a97a58 100644 --- a/packages/app/src/Components/Feed/Articles.tsx +++ b/packages/app/src/Components/Feed/Articles.tsx @@ -1,5 +1,3 @@ -import { NostrLink } from "@snort/system"; -import { useReactions } from "@snort/system-react"; import { useContext } from "react"; import { useArticles } from "@/Feed/ArticlesFeed"; @@ -11,12 +9,6 @@ import Note from "../Event/Note"; export default function Articles() { const data = useArticles(); const deck = useContext(DeckContext); - const related = useReactions( - "articles:reactions", - data.data?.map(v => NostrLink.fromEvent(v)) ?? [], - undefined, - true, - ); return ( <> @@ -24,7 +16,6 @@ export default function Articles() { NostrLink.fromEvent(a)) ?? []); return ( { //nothing diff --git a/packages/app/src/Components/Feed/Timeline.tsx b/packages/app/src/Components/Feed/Timeline.tsx index 995dc7dd..bda996d8 100644 --- a/packages/app/src/Components/Feed/Timeline.tsx +++ b/packages/app/src/Components/Feed/Timeline.tsx @@ -97,7 +97,6 @@ const Timeline = (props: TimelineProps) => { refTime: mainFeed.at(0)?.created_at ?? unixNow(), }, ]} - related={feed.related ?? []} latest={latestAuthors} showLatest={t => onShowLatest(t)} displayAs={displayAs} diff --git a/packages/app/src/Components/Feed/TimelineFollows.tsx b/packages/app/src/Components/Feed/TimelineFollows.tsx index 7b8f30e5..e7056fbb 100644 --- a/packages/app/src/Components/Feed/TimelineFollows.tsx +++ b/packages/app/src/Components/Feed/TimelineFollows.tsx @@ -1,8 +1,8 @@ import "./Timeline.css"; import { unixNow } from "@snort/shared"; -import { EventKind, NostrEvent, NostrLink, TaggedNostrEvent } from "@snort/system"; -import { SnortContext, useReactions } from "@snort/system-react"; +import { EventKind, NostrEvent, TaggedNostrEvent } from "@snort/system"; +import { SnortContext } from "@snort/system-react"; import { ReactNode, useCallback, useContext, useMemo, useState, useSyncExternalStore } from "react"; import { Link } from "react-router-dom"; @@ -38,12 +38,6 @@ const TimelineFollows = (props: TimelineFollowsProps) => { cb => FollowsFeed.hook(cb, "*"), () => FollowsFeed.snapshot(), ); - const reactions = useReactions( - "follows-feed-reactions", - feed.map(a => NostrLink.fromEvent(a)), - undefined, - true, - ); const system = useContext(SnortContext); const { muted, isEventMuted } = useModeration(); @@ -118,7 +112,6 @@ const TimelineFollows = (props: TimelineFollowsProps) => { /> onShowLatest(t)} noteOnClick={props.noteOnClick} diff --git a/packages/app/src/Components/Feed/TimelineFragment.tsx b/packages/app/src/Components/Feed/TimelineFragment.tsx index 6661af01..2f85b6b4 100644 --- a/packages/app/src/Components/Feed/TimelineFragment.tsx +++ b/packages/app/src/Components/Feed/TimelineFragment.tsx @@ -1,8 +1,7 @@ import { TaggedNostrEvent } from "@snort/system"; -import { ReactNode, useCallback } from "react"; +import { ReactNode } from "react"; import Note from "@/Components/Event/Note"; -import { findTag } from "@/Utils"; export interface TimelineFragment { events: Array; @@ -12,7 +11,6 @@ export interface TimelineFragment { export interface TimelineFragProps { frag: TimelineFragment; - related: Array; index: number; noteRenderer?: (ev: TaggedNostrEvent) => ReactNode; noteOnClick?: (ev: TaggedNostrEvent) => void; diff --git a/packages/app/src/Components/Feed/TimelineRenderer.tsx b/packages/app/src/Components/Feed/TimelineRenderer.tsx index ffdf94a1..f9f0bd04 100644 --- a/packages/app/src/Components/Feed/TimelineRenderer.tsx +++ b/packages/app/src/Components/Feed/TimelineRenderer.tsx @@ -14,7 +14,6 @@ import ProfileImage from "@/Components/User/ProfileImage"; export interface TimelineRendererProps { frags: Array; - related: Array; /** * List of pubkeys who have posted recently */ @@ -96,7 +95,6 @@ export function TimelineRenderer(props: TimelineRendererProps) { (displayAsInitial); const { isEventMuted } = useModeration(); - const related = useReactions("trending", trendingNotesData?.map(a => NostrLink.fromEvent(a)) ?? [], undefined, true); const [modalThread, setModalThread] = useState(undefined); if (error && !trendingNotesData) return ; @@ -78,7 +76,6 @@ export default function TrendingNotes({ count = Infinity, small = false }: { cou { +const Bookmarks = ({ pubkey, bookmarks }: BookmarksProps) => { const [onlyPubkey, setOnlyPubkey] = useState("all"); const { publicKey } = useLogin(s => ({ publicKey: s.publicKey })); const ps = useMemo(() => { @@ -46,7 +45,6 @@ const Bookmarks = ({ pubkey, bookmarks, related }: BookmarksProps) => { ); diff --git a/packages/app/src/Pages/DeckLayout.tsx b/packages/app/src/Pages/DeckLayout.tsx index 00b85abc..d74eed75 100644 --- a/packages/app/src/Pages/DeckLayout.tsx +++ b/packages/app/src/Pages/DeckLayout.tsx @@ -130,7 +130,7 @@ export function SnortDeckLayout() { className="long-form" onClick={() => setDeckState({})}>
e.stopPropagation()}> - +
diff --git a/packages/app/src/Pages/Layout/NavSidebar.tsx b/packages/app/src/Pages/Layout/NavSidebar.tsx index 502a872e..3c1a5b1b 100644 --- a/packages/app/src/Pages/Layout/NavSidebar.tsx +++ b/packages/app/src/Pages/Layout/NavSidebar.tsx @@ -1,6 +1,6 @@ import { useUserProfile } from "@snort/system-react"; import classNames from "classnames"; -import { useEffect, useState } from "react"; +import { useEffect, useMemo, useState } from "react"; import { FormattedMessage, FormattedNumber, useIntl } from "react-intl"; import { Link, useNavigate } from "react-router-dom"; @@ -89,6 +89,12 @@ const WalletBalance = () => { } }, [wallet]); + const msgValues = useMemo(() => { + return { + amount: , + }; + }, [balance, rates]); + return (
@@ -101,15 +107,7 @@ const WalletBalance = () => {
- - ), - }} - /> +
); diff --git a/packages/app/src/Pages/Profile/ProfilePage.tsx b/packages/app/src/Pages/Profile/ProfilePage.tsx index 88858828..cad9233a 100644 --- a/packages/app/src/Pages/Profile/ProfilePage.tsx +++ b/packages/app/src/Pages/Profile/ProfilePage.tsx @@ -5,7 +5,6 @@ import { encodeTLVEntries, EventKind, MetadataCache, - NostrLink, NostrPrefix, TLVEntryType, tryParseNostrLink, @@ -54,7 +53,7 @@ import ProfileTab, { RelaysTab, ZapsProfileTab, } from "@/Pages/Profile/ProfileTab"; -import { findTag, getLinkReactions, hexToBech32, parseId, unwrap } from "@/Utils"; +import { findTag, hexToBech32, parseId, unwrap } from "@/Utils"; import { EmailRegex } from "@/Utils/Const"; import { ZapTarget } from "@/Utils/Zapper"; diff --git a/packages/app/src/Pages/Profile/ProfileTab.tsx b/packages/app/src/Pages/Profile/ProfileTab.tsx index b733cdd4..4bb1884a 100644 --- a/packages/app/src/Pages/Profile/ProfileTab.tsx +++ b/packages/app/src/Pages/Profile/ProfileTab.tsx @@ -1,5 +1,4 @@ import { HexKey, NostrLink, NostrPrefix } from "@snort/system"; -import { useReactions } from "@snort/system-react"; import { FormattedMessage } from "react-intl"; import { default as ZapElement } from "@/Components/Event/Zap"; @@ -61,8 +60,7 @@ export function RelaysTab({ id }: { id: HexKey }) { export function BookMarksTab({ id }: { id: HexKey }) { const bookmarks = useBookmarkList(id); - const reactions = useReactions(`bookmark:reactions:{id}`, bookmarks.map(NostrLink.fromEvent)); - return ; + return ; } const ProfileTab = { diff --git a/packages/app/src/Pages/settings/WalletSettings.tsx b/packages/app/src/Pages/settings/WalletSettings.tsx index 233041ef..15ddaaa5 100644 --- a/packages/app/src/Pages/settings/WalletSettings.tsx +++ b/packages/app/src/Pages/settings/WalletSettings.tsx @@ -5,7 +5,6 @@ import { useNavigate } from "react-router-dom"; import LndLogo from "@/assets/img/lnd-logo.png"; import AlbyIcon from "@/Components/Icons/Alby"; import BlueWallet from "@/Components/Icons/BlueWallet"; -import CashuIcon from "@/Components/Icons/Cashu"; import Icon from "@/Components/Icons/Icon"; import NostrIcon from "@/Components/Icons/Nostrich"; diff --git a/packages/system/package.json b/packages/system/package.json index 3503f618..fde412a8 100644 --- a/packages/system/package.json +++ b/packages/system/package.json @@ -25,7 +25,6 @@ "@types/node": "^20.5.9", "@types/uuid": "^9.0.2", "@types/ws": "^8.5.5", - "@welldone-software/why-did-you-render": "^8.0.1", "jest": "^29.5.0", "jest-environment-jsdom": "^29.5.0", "ts-jest": "^29.1.0", diff --git a/packages/system/src/nostr-system.ts b/packages/system/src/nostr-system.ts index 3e819acc..9828f35e 100644 --- a/packages/system/src/nostr-system.ts +++ b/packages/system/src/nostr-system.ts @@ -320,7 +320,6 @@ export class NostrSystem extends EventEmitter implements Syst fNew.forEach(f => { const alreadyHave = inMemoryDB.findArray(f).map(e => { - console.log("got from inMemoryDB", e); this.HandleEvent(e); return e.id; }); diff --git a/yarn.lock b/yarn.lock index e099375d..1ed262fb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2954,6 +2954,7 @@ __metadata: "@void-cat/api": ^1.0.12 "@webbtc/webln-types": ^2.1.0 "@webscopeio/react-textarea-autocomplete": ^4.9.2 + "@welldone-software/why-did-you-render": ^8.0.1 autoprefixer: ^10.4.16 classnames: ^2.3.2 comlink: ^4.4.1 @@ -3080,7 +3081,6 @@ __metadata: "@types/node": ^20.5.9 "@types/uuid": ^9.0.2 "@types/ws": ^8.5.5 - "@welldone-software/why-did-you-render": ^8.0.1 debug: ^4.3.4 eventemitter3: ^5.0.1 isomorphic-ws: ^5.0.0