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