fix: hide unknown event json

This commit is contained in:
Kieran 2024-08-26 16:22:26 +03:00
parent 1f3e048f10
commit eec52efc3e
No known key found for this signature in database
GPG Key ID: DE71CEB3925BE941
2 changed files with 8 additions and 8 deletions

View File

@ -4,7 +4,7 @@ import { ReactNode, useState } from "react";
import Icon from "@/Components/Icons/Icon";
interface CollapsedProps {
text?: string;
text?: ReactNode;
children: ReactNode;
collapsed: boolean;
setCollapsed(b: boolean): void;

View File

@ -1,12 +1,13 @@
import { EventKind, NostrLink, TaggedNostrEvent } from "@snort/system";
import classNames from "classnames";
import React, { useCallback, useEffect, useState } from "react";
import { useCallback, useEffect, useState } from "react";
import { useInView } from "react-intersection-observer";
import { FormattedMessage } from "react-intl";
import { useNavigate } from "react-router-dom";
import { LRUCache } from "typescript-lru-cache";
import { Relay } from "@/Cache";
import { CollapsedSection } from "@/Components/Collapsed";
import NoteHeader from "@/Components/Event/Note/NoteHeader";
import NoteQuote from "@/Components/Event/Note/NoteQuote";
import { NoteText } from "@/Components/Event/Note/NoteText";
@ -179,12 +180,11 @@ function handleNonTextNote(ev: TaggedNostrEvent) {
return <Reaction ev={ev} />;
} else {
return (
<>
<h4>
<FormattedMessage {...messages.UnknownEventKind} values={{ kind: ev.kind }} />
</h4>
<pre>{JSON.stringify(ev, undefined, " ")}</pre>
</>
<div className="card">
<CollapsedSection title={<FormattedMessage {...messages.UnknownEventKind} values={{ kind: ev.kind }} />}>
<pre className="text-xs">{JSON.stringify(ev, undefined, " ")}</pre>
</CollapsedSection>
</div>
);
}
}