improve hashtag parser

This commit is contained in:
Ren Amamiya
2023-09-01 18:26:22 +07:00
parent e6d35bc635
commit 28939d1733
4 changed files with 30 additions and 11 deletions

View File

@@ -12,8 +12,9 @@ export function MentionUser({ pubkey }: { pubkey: string }) {
const setWidget = useWidgets((state) => state.setWidget);
return (
<button
type="button"
<span
role="button"
tabIndex={0}
onClick={() =>
setWidget(db, {
kind: WidgetKinds.local.user,
@@ -21,9 +22,16 @@ export function MentionUser({ pubkey }: { pubkey: string }) {
content: pubkey,
})
}
onKeyDown={() =>
setWidget(db, {
kind: WidgetKinds.local.user,
title: user?.name || user?.display_name,
content: pubkey,
})
}
className="break-words text-fuchsia-400 hover:text-fuchsia-500"
>
{user?.name || user?.display_name || user?.username || displayNpub(pubkey, 16)}
</button>
</span>
);
}