refactor: reactions grouping and other fixes

This commit is contained in:
2024-01-09 16:40:31 +00:00
parent 4455651d47
commit 80fa5a132b
58 changed files with 344 additions and 501 deletions

View File

@ -1,5 +1,5 @@
import { dedupe } from "@snort/shared";
import { EventKind, NoteCollection, RequestBuilder } from "@snort/system";
import { EventKind, RequestBuilder } from "@snort/system";
import { useRequestBuilder } from "@snort/system-react";
import classNames from "classnames";
import { useMemo } from "react";
@ -59,8 +59,8 @@ export function HashTagHeader({ tag, events, className }: { tag: string; events?
rb.withFilter().kinds([EventKind.InterestsList]).tag("t", [tag.toLowerCase()]);
return rb;
}, [tag]);
const followsTag = useRequestBuilder(NoteCollection, sub);
const pubkeys = dedupe((followsTag.data ?? []).map(a => a.pubkey));
const followsTag = useRequestBuilder(sub);
const pubkeys = dedupe(followsTag.map(a => a.pubkey));
return (
<div className={classNames("flex flex-col", className)}>

View File

@ -103,10 +103,10 @@ function NoteTitle({ link }: { link: NostrLink }) {
const ev = useEventFeed(link);
const values = useMemo(() => {
return { name: <DisplayName pubkey={ev.data?.pubkey ?? ""} /> };
}, [ev.data?.pubkey]);
return { name: <DisplayName pubkey={ev?.pubkey ?? ""} /> };
}, [ev?.pubkey]);
if (!ev.data?.pubkey) {
if (!ev?.pubkey) {
return <FormattedMessage defaultMessage="Note" id="qMePPG" />;
}

View File

@ -6,8 +6,8 @@ import ProfilePreview from "@/Components/User/ProfilePreview";
export default function Nip28ChatProfile({ id, onClick }: { id: string; onClick: (id: string) => void }) {
const channel = useEventFeed(new NostrLink(CONFIG.eventLinkPrefix, id, 40));
if (channel?.data) {
const meta = JSON.parse(channel.data.content) as UserMetadata;
if (channel) {
const meta = JSON.parse(channel.content) as UserMetadata;
return (
<ProfilePreview
pubkey=""

View File

@ -252,7 +252,7 @@ function NotificationGroup({ evs, onClick }: { evs: Array<TaggedNostrEvent>; onC
}
function NotificationContext({ link, onClick }: { link: NostrLink; onClick: () => void }) {
const { data: ev } = useEventFeed(link);
const ev = useEventFeed(link);
if (link.type === NostrPrefix.PublicKey) {
return <ProfilePreview pubkey={link.id} actions={<></>} />;
}

View File

@ -415,7 +415,6 @@ const PreferencesPage = () => {
value={perf.reactionEmoji}
onChange={e => {
const split = e.target.value.match(/[\p{L}\S]{1}/u);
console.debug(e.target.value, split);
updatePreferences(id, {
...perf,
reactionEmoji: split?.[0] ?? "",

View File

@ -19,7 +19,6 @@ export default function AlbyOAuth() {
async function setupWallet(token: string) {
try {
const auth = await alby.getToken(token);
console.debug(auth);
const connection = new AlbyWallet(auth, () => {});
const info = await connection.getInfo();