This commit is contained in:
Ren Amamiya
2023-08-04 08:51:26 +07:00
parent 2e47415160
commit ac50cd1373
16 changed files with 108 additions and 78 deletions

View File

@@ -23,6 +23,14 @@ export const MentionNote = memo(function MentionNote({ id }: { id: string }) {
}
};
if (!id) {
return (
<div className="mb-2 mt-3 cursor-default rounded-lg bg-white/10 px-3 py-3">
<p className="break-all">Failed to fetch event: {id}</p>
</div>
);
}
return (
<div
onClick={(e) => openThread(e, id)}
@@ -56,14 +64,14 @@ export const MentionNote = memo(function MentionNote({ id }: { id: string }) {
},
}}
>
{data?.content?.parsed?.length > 160
? data.content.parsed.substring(0, 160) + '...'
: data.content.parsed}
{data?.content?.original?.length > 160
? data.content.original.substring(0, 160) + '...'
: data.content.original}
</ReactMarkdown>
</div>
</>
) : (
<p>Failed to fetch event</p>
<p className="break-all">Failed to fetch event: {id}</p>
)}
</div>
);

View File

@@ -20,7 +20,11 @@ export function MentionUser({ pubkey }: { pubkey: string }) {
}
className="break-words font-normal text-blue-400 no-underline hover:text-blue-500"
>
{'@' + user?.name || user?.displayName || displayNpub(pubkey, 16)}
{user?.nip05 ||
user?.name ||
user?.display_name ||
user?.username ||
displayNpub(pubkey, 16)}
</button>
);
}