mirror of
https://github.com/lumehq/lume.git
synced 2025-09-26 02:47:35 +02:00
add skip metadata flag to note
This commit is contained in:
@@ -27,7 +27,7 @@ export function TrendingNotes() {
|
||||
) : (
|
||||
<div className="relative flex w-full flex-col pt-1.5">
|
||||
{data.notes.map((item) => (
|
||||
<Note key={item.id} event={item.event} />
|
||||
<Note key={item.id} event={item.event} skipMetadata={true} />
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
@@ -12,9 +12,10 @@ import { LumeEvent } from '@utils/types';
|
||||
|
||||
interface Note {
|
||||
event: LumeEvent;
|
||||
skipMetadata?: boolean;
|
||||
}
|
||||
|
||||
export function Note({ event }: Note) {
|
||||
export function Note({ event, skipMetadata = false }: Note) {
|
||||
const isRepost = event.kind === 6;
|
||||
|
||||
const renderParent = useMemo(() => {
|
||||
@@ -70,12 +71,14 @@ export function Note({ event }: Note) {
|
||||
<User pubkey={event.pubkey} time={event.created_at} repost={isRepost} />
|
||||
<div className="-mt-6 pl-[49px]">
|
||||
{renderContent}
|
||||
{!isRepost && (
|
||||
{!isRepost && !skipMetadata ? (
|
||||
<NoteMetadata
|
||||
id={event.event_id}
|
||||
rootID={event.parent_id}
|
||||
eventPubkey={event.pubkey}
|
||||
/>
|
||||
) : (
|
||||
<div className={isRepost ? 'h-0' : 'h-3'} />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -7,6 +7,8 @@ import reactStringReplace from 'react-string-replace';
|
||||
|
||||
import { MentionUser } from '@shared/notes/mentions/user';
|
||||
|
||||
import { LumeEvent } from '@utils/types';
|
||||
|
||||
function isJsonString(str: string[][] | string) {
|
||||
try {
|
||||
if (typeof str === 'string') JSON.parse(str);
|
||||
@@ -16,24 +18,24 @@ function isJsonString(str: string[][] | string) {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function parser(event: Event) {
|
||||
export function parser(event: LumeEvent) {
|
||||
if (isJsonString(event.tags)) {
|
||||
event['tags'] = destr(event.tags);
|
||||
}
|
||||
|
||||
const references = parseReferences(event);
|
||||
const references = parseReferences(event as Event);
|
||||
const urls = getUrls(event.content);
|
||||
|
||||
const content: {
|
||||
original: string;
|
||||
parsed: string | ReactNode[];
|
||||
parsed: ReactNode[];
|
||||
notes: string[];
|
||||
images: string[];
|
||||
videos: string[];
|
||||
links: string[];
|
||||
} = {
|
||||
original: event.content,
|
||||
parsed: event.content,
|
||||
parsed: [event.content],
|
||||
notes: [],
|
||||
images: [],
|
||||
videos: [],
|
||||
|
Reference in New Issue
Block a user