small fixes and support $ boost sign
This commit is contained in:
@@ -22,5 +22,6 @@ export * from './child';
|
||||
export * from './skeleton';
|
||||
export * from './actions';
|
||||
export * from './mentions/hashtag';
|
||||
export * from './mentions/boost';
|
||||
export * from './stats';
|
||||
export * from './wrapper';
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Link } from 'react-router-dom';
|
||||
import remarkGfm from 'remark-gfm';
|
||||
|
||||
import {
|
||||
Boost,
|
||||
Hashtag,
|
||||
ImagePreview,
|
||||
LinkPreview,
|
||||
@@ -56,6 +57,9 @@ export function TextNote(props: { content?: string }) {
|
||||
if (key.startsWith('tag')) {
|
||||
return <Hashtag tag={key.replace('tag-', '')} />;
|
||||
}
|
||||
if (key.startsWith('boost')) {
|
||||
return <Boost boost={key.replace('boost-', '')} />;
|
||||
}
|
||||
},
|
||||
}}
|
||||
disallowedElements={['h1', 'h2', 'h3', 'h4', 'h5', 'h6']}
|
||||
|
||||
5
src/shared/notes/mentions/boost.tsx
Normal file
5
src/shared/notes/mentions/boost.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
export function Boost({ boost }: { boost: string }) {
|
||||
return (
|
||||
<span className="break-words text-fuchsia-400 hover:text-fuchsia-500">{boost}</span>
|
||||
);
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
import { memo } from 'react';
|
||||
|
||||
import { useStorage } from '@libs/storage/provider';
|
||||
|
||||
import { WidgetKinds, useWidgets } from '@stores/widgets';
|
||||
|
||||
import { useProfile } from '@utils/hooks/useProfile';
|
||||
import { displayNpub } from '@utils/shortenKey';
|
||||
|
||||
export function MentionUser({ pubkey }: { pubkey: string }) {
|
||||
export const MentionUser = memo(function MentionUser({ pubkey }: { pubkey: string }) {
|
||||
const { db } = useStorage();
|
||||
const { user } = useProfile(pubkey);
|
||||
|
||||
@@ -31,11 +32,12 @@ export function MentionUser({ pubkey }: { pubkey: string }) {
|
||||
}
|
||||
className="break-words text-fuchsia-400 hover:text-fuchsia-500"
|
||||
>
|
||||
{user?.name ||
|
||||
user?.display_name ||
|
||||
user?.displayName ||
|
||||
user?.username ||
|
||||
displayNpub(pubkey, 16)}
|
||||
{'@' +
|
||||
(user?.name ||
|
||||
user?.display_name ||
|
||||
user?.displayName ||
|
||||
user?.username ||
|
||||
'unknown')}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user