mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-03-29 11:12:12 +01:00
fix usernames on notes showing @
This commit is contained in:
parent
33d57ddc71
commit
fe0fd2197c
@ -199,7 +199,7 @@ const embeds: EmbedType[] = [
|
||||
switch (match[2]) {
|
||||
case "npub1":
|
||||
const id = normalizeToHex(match[1]);
|
||||
return id ? <UserLink color="blue.500" pubkey={id} /> : match[0];
|
||||
return id ? <UserLink color="blue.500" pubkey={id} showAt /> : match[0];
|
||||
default:
|
||||
return match[0];
|
||||
}
|
||||
@ -215,7 +215,7 @@ const embeds: EmbedType[] = [
|
||||
|
||||
if (tag) {
|
||||
if (tag[0] === "p" && tag[1]) {
|
||||
return <UserLink color="blue.500" pubkey={tag[1]} />;
|
||||
return <UserLink color="blue.500" pubkey={tag[1]} showAt />;
|
||||
}
|
||||
if (tag[0] === "e" && tag[1]) {
|
||||
return <NoteLink color="blue.500" noteId={tag[1]} />;
|
||||
|
@ -6,15 +6,17 @@ import { useUserMetadata } from "../hooks/use-user-metadata";
|
||||
|
||||
export type UserLinkProps = LinkProps & {
|
||||
pubkey: string;
|
||||
showAt?: boolean;
|
||||
};
|
||||
|
||||
export const UserLink = ({ pubkey, ...props }: UserLinkProps) => {
|
||||
export const UserLink = ({ pubkey, showAt, ...props }: UserLinkProps) => {
|
||||
const metadata = useUserMetadata(pubkey);
|
||||
const npub = normalizeToBech32(pubkey, Bech32Prefix.Pubkey);
|
||||
|
||||
return (
|
||||
<Link as={RouterLink} to={`/u/${npub}`} whiteSpace="nowrap" {...props}>
|
||||
@{getUserDisplayName(metadata, pubkey)}
|
||||
{showAt && "@"}
|
||||
{getUserDisplayName(metadata, pubkey)}
|
||||
</Link>
|
||||
);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user