convert const function to function
This commit is contained in:
@@ -9,7 +9,7 @@ import { isTagsIncludeID } from '@lume/utils/transform';
|
||||
|
||||
import { useMemo } from 'react';
|
||||
|
||||
export const NoteBase = ({ event }: { event: any }) => {
|
||||
export function NoteBase({ event }: { event: any }) {
|
||||
const content = useMemo(() => noteParser(event), [event]);
|
||||
const checkParentID = isTagsIncludeID(event.parent_id, event.tags);
|
||||
|
||||
@@ -34,4 +34,4 @@ export const NoteBase = ({ event }: { event: any }) => {
|
||||
</div>
|
||||
</NoteWrapper>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import VideoPreview from '@lume/app/note/components/preview/video';
|
||||
import ReactMarkdown from 'react-markdown';
|
||||
import remarkGfm from 'remark-gfm';
|
||||
|
||||
export const Kind1 = ({ content }: { content: any }) => {
|
||||
export function Kind1({ content }: { content: any }) {
|
||||
return (
|
||||
<>
|
||||
<ReactMarkdown
|
||||
@@ -28,4 +28,4 @@ export const Kind1 = ({ content }: { content: any }) => {
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ function isImage(url: string) {
|
||||
return /\.(jpg|jpeg|gif|png|webp|avif)$/.test(url);
|
||||
}
|
||||
|
||||
export const Kind1063 = ({ metadata }: { metadata: string[] }) => {
|
||||
export function Kind1063({ metadata }: { metadata: string[] }) {
|
||||
const url = metadata[0][1];
|
||||
|
||||
return (
|
||||
@@ -12,4 +12,4 @@ export const Kind1063 = ({ metadata }: { metadata: string[] }) => {
|
||||
{isImage(url) && <Image src={url} alt="image" className="h-auto w-full rounded-lg object-cover" />}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { useProfile } from '@lume/utils/hooks/useProfile';
|
||||
import { shortenKey } from '@lume/utils/shortenKey';
|
||||
|
||||
export const MentionUser = (props: { children: any[] }) => {
|
||||
export function MentionUser(props: { children: any[] }) {
|
||||
const pubkey = props.children[0];
|
||||
const { user } = useProfile(pubkey);
|
||||
|
||||
return (
|
||||
<span className="cursor-pointer text-fuchsia-500">@{user?.name || user?.display_name || shortenKey(pubkey)}</span>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { NoteRepostUser } from '@lume/app/note/components/user/repost';
|
||||
import { NoteWrapper } from '@lume/app/note/components/wrapper';
|
||||
import { getQuoteID } from '@lume/utils/transform';
|
||||
|
||||
export const NoteQuoteRepost = ({ event }: { event: any }) => {
|
||||
export function NoteQuoteRepost({ event }: { event: any }) {
|
||||
const rootID = getQuoteID(event.tags);
|
||||
|
||||
return (
|
||||
@@ -17,4 +17,4 @@ export const NoteQuoteRepost = ({ event }: { event: any }) => {
|
||||
</div>
|
||||
</NoteWrapper>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export const NoteSkeleton = () => {
|
||||
export function NoteSkeleton() {
|
||||
return (
|
||||
<div className="flex h-min flex-col pb-3">
|
||||
<div className="flex items-center gap-2.5">
|
||||
@@ -17,4 +17,4 @@ export const NoteSkeleton = () => {
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import relativeTime from 'dayjs/plugin/relativeTime';
|
||||
|
||||
dayjs.extend(relativeTime);
|
||||
|
||||
export const NoteDefaultUser = ({ pubkey, time }: { pubkey: string; time: number }) => {
|
||||
export function NoteDefaultUser({ pubkey, time }: { pubkey: string; time: number }) {
|
||||
const { user } = useProfile(pubkey);
|
||||
|
||||
return (
|
||||
@@ -34,4 +34,4 @@ export const NoteDefaultUser = ({ pubkey, time }: { pubkey: string; time: number
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import relativeTime from 'dayjs/plugin/relativeTime';
|
||||
|
||||
dayjs.extend(relativeTime);
|
||||
|
||||
export const NoteRepostUser = ({ pubkey, time }: { pubkey: string; time: number }) => {
|
||||
export function NoteRepostUser({ pubkey, time }: { pubkey: string; time: number }) {
|
||||
const { user } = useProfile(pubkey);
|
||||
|
||||
return (
|
||||
@@ -32,4 +32,4 @@ export const NoteRepostUser = ({ pubkey, time }: { pubkey: string; time: number
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { navigate } from 'vite-plugin-ssr/client/router';
|
||||
|
||||
export const NoteWrapper = ({
|
||||
export function NoteWrapper({
|
||||
children,
|
||||
href,
|
||||
className,
|
||||
@@ -8,7 +8,7 @@ export const NoteWrapper = ({
|
||||
children: React.ReactNode;
|
||||
href: string;
|
||||
className: string;
|
||||
}) => {
|
||||
}) {
|
||||
const openThread = (event: any, href: string) => {
|
||||
const selection = window.getSelection();
|
||||
if (selection.toString().length === 0) {
|
||||
@@ -23,4 +23,4 @@ export const NoteWrapper = ({
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user