constant onClick param in some Notes
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
8a75b5bce8
commit
ca2cb76380
@ -2,7 +2,7 @@ import "./Thread.css";
|
||||
|
||||
import { EventExt, NostrPrefix, parseNostrLink, TaggedNostrEvent, u256 } from "@snort/system";
|
||||
import classNames from "classnames";
|
||||
import { Fragment, ReactNode, useContext, useMemo, useState } from "react";
|
||||
import { Fragment, ReactNode, useCallback, useContext, useMemo, useState } from "react";
|
||||
import { useIntl } from "react-intl";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
|
||||
@ -233,10 +233,13 @@ export function Thread(props: { onBack?: () => void; disableSpotlight?: boolean
|
||||
[props.disableSpotlight],
|
||||
);
|
||||
|
||||
function navigateThread(e: TaggedNostrEvent) {
|
||||
const navigateThread = useCallback(
|
||||
(e: TaggedNostrEvent) => {
|
||||
thread.setCurrent(e.id);
|
||||
//router.navigate(`/${NostrLink.fromEvent(e).encode()}`, { replace: true })
|
||||
}
|
||||
// navigate(`/${NostrLink.fromEvent(e).encode()}`, { replace: true });
|
||||
},
|
||||
[thread],
|
||||
);
|
||||
|
||||
const parent = useMemo(() => {
|
||||
if (thread.root) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import Fuse from "fuse.js";
|
||||
import { CachedMetadata } from "@snort/system";
|
||||
import Fuse from "fuse.js";
|
||||
|
||||
export type FuzzySearchResult = {
|
||||
pubkey: string;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import "./Deck.css";
|
||||
|
||||
import { NostrLink, TaggedNostrEvent } from "@snort/system";
|
||||
import { createContext, useEffect, useState } from "react";
|
||||
import { createContext, useCallback, useEffect, useState } from "react";
|
||||
import { FormattedMessage } from "react-intl";
|
||||
import { Link, Outlet, useNavigate } from "react-router-dom";
|
||||
|
||||
@ -176,6 +176,13 @@ function ArticlesCol() {
|
||||
}
|
||||
|
||||
function MediaCol({ setThread }: { setThread: (e: NostrLink) => void }) {
|
||||
const noteOnClick = useCallback(
|
||||
e => {
|
||||
setThread(NostrLink.fromEvent(e));
|
||||
},
|
||||
[setThread],
|
||||
);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="flex items-center gap-2 p-2 border-b border-border-color">
|
||||
@ -192,7 +199,7 @@ function MediaCol({ setThread }: { setThread: (e: NostrLink) => void }) {
|
||||
}}
|
||||
displayAs="grid"
|
||||
showDisplayAsSelector={false}
|
||||
noteOnClick={e => setThread(NostrLink.fromEvent(e))}
|
||||
noteOnClick={noteOnClick}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
@ -102,17 +102,17 @@ export function Header() {
|
||||
function NoteTitle({ link }: { link: NostrLink }) {
|
||||
const ev = useEventFeed(link);
|
||||
|
||||
const values = useMemo(() => {
|
||||
return { name: <DisplayName pubkey={ev.data?.pubkey ?? ""} /> };
|
||||
}, [ev.data?.pubkey]);
|
||||
|
||||
if (!ev.data?.pubkey) {
|
||||
return <FormattedMessage defaultMessage="Note" id="qMePPG" />;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<FormattedMessage
|
||||
defaultMessage="Note by {name}"
|
||||
id="ALdW69"
|
||||
values={{ name: <DisplayName pubkey={ev.data.pubkey} /> }}
|
||||
/>
|
||||
<FormattedMessage defaultMessage="Note by {name}" id="ALdW69" values={values} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
@ -2,9 +2,9 @@ import "./ProfilePage.css";
|
||||
|
||||
import { fetchNip05Pubkey, LNURL } from "@snort/shared";
|
||||
import {
|
||||
CachedMetadata,
|
||||
encodeTLVEntries,
|
||||
EventKind,
|
||||
CachedMetadata,
|
||||
NostrPrefix,
|
||||
TLVEntryType,
|
||||
tryParseNostrLink,
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { unixNow } from "@snort/shared";
|
||||
import { NostrLink } from "@snort/system";
|
||||
import { SnortContext } from "@snort/system-react";
|
||||
import { lazy, useContext, useEffect, useState } from "react";
|
||||
import { lazy, useContext, useEffect, useMemo, useState } from "react";
|
||||
import { FormattedMessage } from "react-intl";
|
||||
import { Link, Outlet, RouteObject, useParams } from "react-router-dom";
|
||||
|
||||
@ -164,20 +164,20 @@ export const NotesTab = () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const deckContext = useContext(DeckContext);
|
||||
|
||||
const noteOnClick = useMemo(() => {
|
||||
if (deckContext) {
|
||||
return ev => {
|
||||
deckContext.setThread(NostrLink.fromEvent(ev));
|
||||
};
|
||||
}
|
||||
return undefined;
|
||||
}, [deckContext]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<FollowsHint />
|
||||
<TaskList />
|
||||
<TimelineFollows
|
||||
postsOnly={true}
|
||||
noteOnClick={
|
||||
deckContext
|
||||
? ev => {
|
||||
deckContext.setThread(NostrLink.fromEvent(ev));
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
/>
|
||||
<TimelineFollows postsOnly={true} noteOnClick={noteOnClick} />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { base64 } from "@scure/base";
|
||||
import { removeUndefined, unwrap } from "@snort/shared";
|
||||
import { EventKind, EventPublisher, CachedMetadata, TaggedNostrEvent } from "@snort/system";
|
||||
import { CachedMetadata, EventKind, EventPublisher, TaggedNostrEvent } from "@snort/system";
|
||||
|
||||
import { UserCache } from "@/Cache";
|
||||
import SnortApi from "@/External/SnortApi";
|
||||
|
@ -6,10 +6,10 @@ import { bytesToHex } from "@noble/hashes/utils";
|
||||
import { base32hex, bech32 } from "@scure/base";
|
||||
import { isHex, isOffline } from "@snort/shared";
|
||||
import {
|
||||
CachedMetadata,
|
||||
encodeTLV,
|
||||
EventKind,
|
||||
HexKey,
|
||||
CachedMetadata,
|
||||
NostrEvent,
|
||||
NostrLink,
|
||||
NostrPrefix,
|
||||
|
@ -2,7 +2,7 @@ import { removeUndefined, throwIfOffline } from "@snort/shared";
|
||||
import { mapEventToProfile, NostrEvent, NostrSystem, ProfileLoaderService, socialGraphInstance } from "@snort/system";
|
||||
|
||||
import { RelayMetrics, SystemDb, UserCache, UserRelays } from "@/Cache";
|
||||
import { addEventToFuzzySearch, addProfileToFuzzySearch } from "@/Db/FuzzySearch";
|
||||
import { addEventToFuzzySearch } from "@/Db/FuzzySearch";
|
||||
import { LoginStore } from "@/Utils/Login";
|
||||
import { hasWasm, WasmOptimizer } from "@/Utils/wasm";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user