convert const function to function

This commit is contained in:
Ren Amamiya
2023-05-10 15:48:24 +07:00
parent ae5ff0c48f
commit 1a30c10806
32 changed files with 87 additions and 79 deletions

View File

@@ -1,7 +1,7 @@
import CancelIcon from '@lume/shared/icons/cancel';
import HideIcon from '@lume/shared/icons/hide';
import { RelayContext } from '@lume/shared/relayProvider';
import Tooltip from '@lume/shared/tooltip';
import { Tooltip } from '@lume/shared/tooltip';
import { channelMessagesAtom } from '@lume/stores/channel';
import { WRITEONLY_RELAYS } from '@lume/stores/constants';
import { dateToUnix } from '@lume/utils/getDate';

View File

@@ -1,7 +1,7 @@
import CancelIcon from '@lume/shared/icons/cancel';
import MuteIcon from '@lume/shared/icons/mute';
import { RelayContext } from '@lume/shared/relayProvider';
import Tooltip from '@lume/shared/tooltip';
import { Tooltip } from '@lume/shared/tooltip';
import { channelMessagesAtom } from '@lume/stores/channel';
import { WRITEONLY_RELAYS } from '@lume/stores/constants';
import { dateToUnix } from '@lume/utils/getDate';

View File

@@ -1,5 +1,5 @@
import ReplyMessageIcon from '@lume/shared/icons/replyMessage';
import Tooltip from '@lume/shared/tooltip';
import { Tooltip } from '@lume/shared/tooltip';
import { channelReplyAtom } from '@lume/stores/channel';
import { useSetAtom } from 'jotai';

View File

@@ -1,6 +1,6 @@
import { CreateViewModal } from '@lume/app/daily/components/views/createModal';
export const Header = () => {
export function Header() {
return (
<div className="flex w-full gap-4">
<button className="from-zinc-90 inline-flex h-11 items-center overflow-hidden border-b border-fuchsia-500 hover:bg-zinc-900">
@@ -42,4 +42,4 @@ export const Header = () => {
<CreateViewModal />
</div>
);
};
}

View File

@@ -1,16 +1,10 @@
import CancelIcon from '@lume/shared/icons/cancel';
import PlusIcon from '@lume/shared/icons/plus';
//import { getNoteAuthors } from '@lume/utils/storage';
import { Dialog, Transition } from '@headlessui/react';
import { Fragment, useState } from 'react';
//import useSWR from 'swr';
//const fetcher = () => getNoteAuthors();
export const CreateViewModal = () => {
//const { data, error }: any = useSWR('authors', fetcher);
export function CreateViewModal() {
const [isOpen, setIsOpen] = useState(false);
const closeModal = () => {
@@ -89,4 +83,4 @@ export const CreateViewModal = () => {
</Transition>
</>
);
};
}

View File

@@ -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>
);
};
}

View File

@@ -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 }) => {
)}
</>
);
};
}

View File

@@ -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>
);
};
}

View File

@@ -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>
);
};
}

View File

@@ -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>
);
};
}

View File

@@ -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>
);
};
}

View File

@@ -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>
);
};
}

View File

@@ -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>
);
};
}

View File

@@ -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>
);
};
}