From 8256bc46a707e14650b035d6f6b3d992d1008a62 Mon Sep 17 00:00:00 2001 From: Ren Amamiya <123083837+reyamir@users.noreply.github.com> Date: Tue, 30 May 2023 10:33:00 +0700 Subject: [PATCH] no more default export --- src/app/auth/layout.tsx | 4 +- src/app/auth/pages/create/index.page.tsx | 3 +- .../auth/pages/create/step-3/index.page.tsx | 2 +- src/app/auth/pages/index.page.tsx | 3 +- src/app/channel/components/blacklist.tsx | 8 +-- src/app/channel/components/createModal.tsx | 5 +- src/app/channel/components/item.tsx | 2 +- src/app/channel/components/list.tsx | 6 +- src/app/channel/components/member.tsx | 2 - src/app/channel/components/messages/form.tsx | 8 +-- .../components/messages/hideButton.tsx | 3 +- .../components/messages/muteButton.tsx | 3 +- .../components/messages/replyButton.tsx | 2 +- .../channel/components/messages/userReply.tsx | 2 +- src/app/channel/components/metadata.tsx | 6 +- src/app/channel/components/mutedItem.tsx | 5 +- src/app/channel/components/updateModal.tsx | 5 +- src/app/channel/layout.tsx | 6 +- src/app/channel/pages/index.page.tsx | 6 +- src/app/chat/components/list.tsx | 2 +- src/app/chat/layout.tsx | 4 +- src/app/note/components/base.tsx | 2 +- src/app/note/components/kind1.tsx | 5 +- src/app/note/components/mentions/note.tsx | 4 -- src/app/note/components/metadata.tsx | 8 +-- src/app/note/components/metadata/like.tsx | 4 +- src/app/note/components/metadata/reply.tsx | 7 +-- src/app/note/components/metadata/repost.tsx | 4 +- src/app/note/components/metadata/zap.tsx | 3 +- src/app/note/components/parent.tsx | 6 +- src/app/note/components/preview/image.tsx | 2 +- src/app/note/components/preview/video.tsx | 2 +- src/app/note/components/quoteRepost.tsx | 1 - src/app/note/components/replies/form.tsx | 2 +- src/app/note/components/replies/item.tsx | 5 +- src/app/note/components/replies/list.tsx | 10 +-- src/app/note/components/rootNote.tsx | 6 +- src/app/note/components/user/reply.tsx | 2 +- src/app/note/layout.tsx | 6 +- src/app/note/pages/index.page.tsx | 8 +-- src/app/prefetch/pages/index.page.tsx | 2 +- src/app/space/components/create.tsx | 3 +- src/app/space/layout.tsx | 4 +- src/app/threads/layout.tsx | 4 +- src/shared/accounts/active.tsx | 3 +- src/shared/accounts/inactive.tsx | 2 +- src/shared/activeLink.tsx | 3 +- src/shared/appHeader.tsx | 5 +- src/shared/composer/imageUploader.tsx | 6 +- src/shared/composer/modal.tsx | 10 +-- src/shared/composer/types/post.tsx | 5 +- src/shared/eventCollector.tsx | 4 +- src/shared/icons/arrowLeft.tsx | 2 +- src/shared/icons/arrowRight.tsx | 2 +- src/shared/icons/bell.tsx | 2 +- src/shared/icons/cancel.tsx | 2 +- src/shared/icons/checkCircle.tsx | 2 +- src/shared/icons/chevronDown.tsx | 2 +- src/shared/icons/chevronRight.tsx | 2 +- src/shared/icons/compose.tsx | 2 +- src/shared/icons/copy.tsx | 2 +- src/shared/icons/edit.tsx | 2 +- src/shared/icons/eyeOff.tsx | 2 +- src/shared/icons/eyeOn.tsx | 2 +- src/shared/icons/heartbeat.tsx | 2 +- src/shared/icons/hide.tsx | 2 +- src/shared/icons/index.tsx | 31 ++++++++++ src/shared/icons/like.tsx | 2 +- src/shared/icons/lume.tsx | 2 +- src/shared/icons/mute.tsx | 2 +- src/shared/icons/myspace.tsx | 2 +- src/shared/icons/navArrowDown.tsx | 2 +- src/shared/icons/plus.tsx | 2 +- src/shared/icons/plusCircle.tsx | 2 +- src/shared/icons/refresh.tsx | 2 +- src/shared/icons/reply.tsx | 2 +- src/shared/icons/replyMessage.tsx | 2 +- src/shared/icons/repost.tsx | 2 +- src/shared/icons/threads.tsx | 2 +- src/shared/icons/trash.tsx | 2 +- src/shared/icons/world.tsx | 2 +- src/shared/icons/zap.tsx | 2 +- src/shared/multiAccounts.tsx | 13 ++-- src/shared/navigation.tsx | 12 ++-- src/shared/profile/followers.tsx | 26 -------- src/shared/profile/follows.tsx | 25 -------- src/shared/profile/metadata.tsx | 61 ------------------- src/shared/profile/notes.tsx | 27 -------- tsconfig.json | 1 - 89 files changed, 154 insertions(+), 325 deletions(-) create mode 100644 src/shared/icons/index.tsx delete mode 100644 src/shared/profile/followers.tsx delete mode 100644 src/shared/profile/follows.tsx delete mode 100644 src/shared/profile/metadata.tsx delete mode 100644 src/shared/profile/notes.tsx diff --git a/src/app/auth/layout.tsx b/src/app/auth/layout.tsx index 2fbe18b5..186e0b0e 100644 --- a/src/app/auth/layout.tsx +++ b/src/app/auth/layout.tsx @@ -1,6 +1,4 @@ -import ArrowLeftIcon from "@icons/arrowLeft"; -import ArrowRightIcon from "@icons/arrowRight"; - +import { ArrowLeftIcon, ArrowRightIcon } from "@shared/icons"; import useSWR from "swr"; const fetcher = async () => { diff --git a/src/app/auth/pages/create/index.page.tsx b/src/app/auth/pages/create/index.page.tsx index 49198744..42de366c 100644 --- a/src/app/auth/pages/create/index.page.tsx +++ b/src/app/auth/pages/create/index.page.tsx @@ -1,5 +1,4 @@ -import EyeOffIcon from "@icons/eyeOff"; -import EyeOnIcon from "@icons/eyeOn"; +import { EyeOffIcon, EyeOnIcon } from "@shared/icons"; import { createAccount } from "@utils/storage"; import { generatePrivateKey, getPublicKey, nip19 } from "nostr-tools"; import { useMemo, useState } from "react"; diff --git a/src/app/auth/pages/create/step-3/index.page.tsx b/src/app/auth/pages/create/step-3/index.page.tsx index f223595d..5b8dba4b 100644 --- a/src/app/auth/pages/create/step-3/index.page.tsx +++ b/src/app/auth/pages/create/step-3/index.page.tsx @@ -1,5 +1,5 @@ import { User } from "@app/auth/components/user"; -import CheckCircleIcon from "@icons/checkCircle"; +import { CheckCircleIcon } from "@shared/icons"; import { RelayContext } from "@shared/relayProvider"; import { useActiveAccount } from "@stores/accounts"; import { WRITEONLY_RELAYS } from "@stores/constants"; diff --git a/src/app/auth/pages/index.page.tsx b/src/app/auth/pages/index.page.tsx index d96f5948..7ee0b1a0 100644 --- a/src/app/auth/pages/index.page.tsx +++ b/src/app/auth/pages/index.page.tsx @@ -1,7 +1,6 @@ +import { ArrowRightIcon } from "@shared/icons"; import { Image } from "@shared/image"; -import ArrowRightIcon from "@icons/arrowRight"; - const PLEBS = [ "https://133332.xyz/p.jpg", "https://void.cat/d/3Bp6jSHURFNQ9u3pK8nwtq.webp", diff --git a/src/app/channel/components/blacklist.tsx b/src/app/channel/components/blacklist.tsx index c71b1718..b6e579fb 100644 --- a/src/app/channel/components/blacklist.tsx +++ b/src/app/channel/components/blacklist.tsx @@ -1,11 +1,9 @@ -import MutedItem from "@app/channel/components/mutedItem"; - -import MuteIcon from "@icons/mute"; - +import { MutedItem } from "@app/channel/components/mutedItem"; import { Popover, Transition } from "@headlessui/react"; +import { MuteIcon } from "@shared/icons"; import { Fragment } from "react"; -export default function ChannelBlackList({ blacklist }: { blacklist: any }) { +export function ChannelBlackList({ blacklist }: { blacklist: any }) { return ( {({ open }) => ( diff --git a/src/app/channel/components/createModal.tsx b/src/app/channel/components/createModal.tsx index 9140bd2e..bd155f6b 100644 --- a/src/app/channel/components/createModal.tsx +++ b/src/app/channel/components/createModal.tsx @@ -1,7 +1,6 @@ import { Dialog, Transition } from "@headlessui/react"; -import CancelIcon from "@icons/cancel"; -import PlusIcon from "@icons/plus"; import { AvatarUploader } from "@shared/avatarUploader"; +import { CancelIcon, PlusIcon } from "@shared/icons"; import { Image } from "@shared/image"; import { RelayContext } from "@shared/relayProvider"; import { useActiveAccount } from "@stores/accounts"; @@ -13,7 +12,7 @@ import { Fragment, useContext, useEffect, useState } from "react"; import { useForm } from "react-hook-form"; import { navigate } from "vite-plugin-ssr/client/router"; -export default function ChannelCreateModal() { +export function ChannelCreateModal() { const pool: any = useContext(RelayContext); const account = useActiveAccount((state: any) => state.account); diff --git a/src/app/channel/components/item.tsx b/src/app/channel/components/item.tsx index 6270c73f..d80504e1 100644 --- a/src/app/channel/components/item.tsx +++ b/src/app/channel/components/item.tsx @@ -4,7 +4,7 @@ import { usePageContext } from "@utils/hooks/usePageContext"; import { twMerge } from "tailwind-merge"; -export default function ChannelsListItem({ data }: { data: any }) { +export function ChannelsListItem({ data }: { data: any }) { const channel: any = useChannelProfile(data.event_id, data.pubkey); const pageContext = usePageContext(); diff --git a/src/app/channel/components/list.tsx b/src/app/channel/components/list.tsx index 6a3c5891..c97b41dc 100644 --- a/src/app/channel/components/list.tsx +++ b/src/app/channel/components/list.tsx @@ -1,9 +1,9 @@ -import ChannelCreateModal from "@app/channel/components/createModal"; -import ChannelsListItem from "@app/channel/components/item"; +import { ChannelCreateModal } from "@app/channel/components/createModal"; +import { ChannelsListItem } from "@app/channel/components/item"; import { useChannels } from "@stores/channels"; import { useEffect } from "react"; -export default function ChannelsList() { +export function ChannelsList() { const channels = useChannels((state: any) => state.channels); const fetchChannels = useChannels((state: any) => state.fetch); diff --git a/src/app/channel/components/member.tsx b/src/app/channel/components/member.tsx index 301f587a..10e99660 100644 --- a/src/app/channel/components/member.tsx +++ b/src/app/channel/components/member.tsx @@ -1,7 +1,5 @@ import { Image } from "@shared/image"; - import { DEFAULT_AVATAR } from "@stores/constants"; - import { useProfile } from "@utils/hooks/useProfile"; export function Member({ pubkey }: { pubkey: string }) { diff --git a/src/app/channel/components/messages/form.tsx b/src/app/channel/components/messages/form.tsx index fa7108c3..db63e7d5 100644 --- a/src/app/channel/components/messages/form.tsx +++ b/src/app/channel/components/messages/form.tsx @@ -1,5 +1,5 @@ -import UserReply from "@app/channel/components/messages/userReply"; -import CancelIcon from "@icons/cancel"; +import { UserReply } from "@app/channel/components/messages/userReply"; +import { CancelIcon } from "@shared/icons"; import { RelayContext } from "@shared/relayProvider"; import { useActiveAccount } from "@stores/accounts"; import { useChannelMessages } from "@stores/channels"; @@ -8,9 +8,7 @@ import { dateToUnix } from "@utils/date"; import { getEventHash, getSignature } from "nostr-tools"; import { useContext, useState } from "react"; -export default function ChannelMessageForm({ - channelID, -}: { channelID: string }) { +export function ChannelMessageForm({ channelID }: { channelID: string }) { const pool: any = useContext(RelayContext); const account = useActiveAccount((state: any) => state.account); diff --git a/src/app/channel/components/messages/hideButton.tsx b/src/app/channel/components/messages/hideButton.tsx index 1ad1dd35..5ba32919 100644 --- a/src/app/channel/components/messages/hideButton.tsx +++ b/src/app/channel/components/messages/hideButton.tsx @@ -1,6 +1,5 @@ import { Dialog, Transition } from "@headlessui/react"; -import CancelIcon from "@icons/cancel"; -import HideIcon from "@icons/hide"; +import { CancelIcon, HideIcon } from "@shared/icons"; import { RelayContext } from "@shared/relayProvider"; import { Tooltip } from "@shared/tooltip"; import { useActiveAccount } from "@stores/accounts"; diff --git a/src/app/channel/components/messages/muteButton.tsx b/src/app/channel/components/messages/muteButton.tsx index e1a0ad79..e6d42a87 100644 --- a/src/app/channel/components/messages/muteButton.tsx +++ b/src/app/channel/components/messages/muteButton.tsx @@ -1,6 +1,5 @@ import { Dialog, Transition } from "@headlessui/react"; -import CancelIcon from "@icons/cancel"; -import MuteIcon from "@icons/mute"; +import { CancelIcon, MuteIcon } from "@shared/icons"; import { RelayContext } from "@shared/relayProvider"; import { Tooltip } from "@shared/tooltip"; import { useActiveAccount } from "@stores/accounts"; diff --git a/src/app/channel/components/messages/replyButton.tsx b/src/app/channel/components/messages/replyButton.tsx index ae606cea..3f3f7fc3 100644 --- a/src/app/channel/components/messages/replyButton.tsx +++ b/src/app/channel/components/messages/replyButton.tsx @@ -1,4 +1,4 @@ -import ReplyMessageIcon from "@icons/replyMessage"; +import { ReplyMessageIcon } from "@shared/icons"; import { Tooltip } from "@shared/tooltip"; import { useChannelMessages } from "@stores/channels"; diff --git a/src/app/channel/components/messages/userReply.tsx b/src/app/channel/components/messages/userReply.tsx index 3d8a87a2..99d77bbb 100644 --- a/src/app/channel/components/messages/userReply.tsx +++ b/src/app/channel/components/messages/userReply.tsx @@ -3,7 +3,7 @@ import { DEFAULT_AVATAR } from "@stores/constants"; import { useProfile } from "@utils/hooks/useProfile"; import { shortenKey } from "@utils/shortenKey"; -export default function UserReply({ pubkey }: { pubkey: string }) { +export function UserReply({ pubkey }: { pubkey: string }) { const { user, isError, isLoading } = useProfile(pubkey); return ( diff --git a/src/app/channel/components/metadata.tsx b/src/app/channel/components/metadata.tsx index a5493dcd..d219c3ef 100644 --- a/src/app/channel/components/metadata.tsx +++ b/src/app/channel/components/metadata.tsx @@ -1,11 +1,7 @@ import { useChannelProfile } from "@app/channel/hooks/useChannelProfile"; - +import { CopyIcon } from "@shared/icons"; import { Image } from "@shared/image"; - -import CopyIcon from "@icons/copy"; - import { DEFAULT_AVATAR } from "@stores/constants"; - import { nip19 } from "nostr-tools"; export function ChannelMetadata({ diff --git a/src/app/channel/components/mutedItem.tsx b/src/app/channel/components/mutedItem.tsx index 4530dcd0..c49a7461 100644 --- a/src/app/channel/components/mutedItem.tsx +++ b/src/app/channel/components/mutedItem.tsx @@ -1,13 +1,10 @@ import { Image } from "@shared/image"; - import { DEFAULT_AVATAR } from "@stores/constants"; - import { useProfile } from "@utils/hooks/useProfile"; import { shortenKey } from "@utils/shortenKey"; - import { useState } from "react"; -export default function MutedItem({ data }: { data: any }) { +export function MutedItem({ data }: { data: any }) { const { user, isError, isLoading } = useProfile(data.content); const [status, setStatus] = useState(data.status); diff --git a/src/app/channel/components/updateModal.tsx b/src/app/channel/components/updateModal.tsx index 16267372..454d2f3e 100644 --- a/src/app/channel/components/updateModal.tsx +++ b/src/app/channel/components/updateModal.tsx @@ -1,7 +1,6 @@ import { Dialog, Transition } from "@headlessui/react"; -import CancelIcon from "@icons/cancel"; -import EditIcon from "@icons/edit"; import { AvatarUploader } from "@shared/avatarUploader"; +import { CancelIcon, EditIcon } from "@shared/icons"; import { Image } from "@shared/image"; import { RelayContext } from "@shared/relayProvider"; import { useActiveAccount } from "@stores/accounts"; @@ -12,7 +11,7 @@ import { getEventHash, getSignature } from "nostr-tools"; import { Fragment, useContext, useEffect, useState } from "react"; import { useForm } from "react-hook-form"; -export default function ChannelUpdateModal({ id }: { id: string }) { +export function ChannelUpdateModal({ id }: { id: string }) { const pool: any = useContext(RelayContext); const account = useActiveAccount((state: any) => state.account); diff --git a/src/app/channel/layout.tsx b/src/app/channel/layout.tsx index 3e654982..2acd7224 100644 --- a/src/app/channel/layout.tsx +++ b/src/app/channel/layout.tsx @@ -1,6 +1,6 @@ -import AppHeader from "@shared/appHeader"; -import MultiAccounts from "@shared/multiAccounts"; -import Navigation from "@shared/navigation"; +import { AppHeader } from "@shared/appHeader"; +import { MultiAccounts } from "@shared/multiAccounts"; +import { Navigation } from "@shared/navigation"; export function LayoutChannel({ children }: { children: React.ReactNode }) { return ( diff --git a/src/app/channel/pages/index.page.tsx b/src/app/channel/pages/index.page.tsx index a4a00755..c8b9ad15 100644 --- a/src/app/channel/pages/index.page.tsx +++ b/src/app/channel/pages/index.page.tsx @@ -1,9 +1,9 @@ -import ChannelBlackList from "@app/channel/components/blacklist"; +import { ChannelBlackList } from "@app/channel/components/blacklist"; import { ChannelMembers } from "@app/channel/components/members"; import { ChannelMessageList } from "@app/channel/components/messageList"; -import ChannelMessageForm from "@app/channel/components/messages/form"; +import { ChannelMessageForm } from "@app/channel/components/messages/form"; import { ChannelMetadata } from "@app/channel/components/metadata"; -import ChannelUpdateModal from "@app/channel/components/updateModal"; +import { ChannelUpdateModal } from "@app/channel/components/updateModal"; import { RelayContext } from "@shared/relayProvider"; import { useActiveAccount } from "@stores/accounts"; import { useChannelMessages } from "@stores/channels"; diff --git a/src/app/chat/components/list.tsx b/src/app/chat/components/list.tsx index f1998fd3..581fdce0 100644 --- a/src/app/chat/components/list.tsx +++ b/src/app/chat/components/list.tsx @@ -3,7 +3,7 @@ import { useActiveAccount } from "@stores/accounts"; import { useChats } from "@stores/chats"; import { useEffect } from "react"; -export default function ChatsList() { +export function ChatsList() { const account = useActiveAccount((state: any) => state.account); const chats = useChats((state: any) => state.chats); const fetchChats = useChats((state: any) => state.fetch); diff --git a/src/app/chat/layout.tsx b/src/app/chat/layout.tsx index 72cef2cd..ab8a91a7 100644 --- a/src/app/chat/layout.tsx +++ b/src/app/chat/layout.tsx @@ -1,5 +1,5 @@ -import MultiAccounts from "@shared/multiAccounts"; -import Navigation from "@shared/navigation"; +import { MultiAccounts } from "@shared/multiAccounts"; +import { Navigation } from "@shared/navigation"; export function LayoutChat({ children }: { children: React.ReactNode }) { return ( diff --git a/src/app/note/components/base.tsx b/src/app/note/components/base.tsx index ea814a27..23b4abfe 100644 --- a/src/app/note/components/base.tsx +++ b/src/app/note/components/base.tsx @@ -1,6 +1,6 @@ import { Kind1 } from "@app/note/components/kind1"; import { Kind1063 } from "@app/note/components/kind1063"; -import NoteMetadata from "@app/note/components/metadata"; +import { NoteMetadata } from "@app/note/components/metadata"; import { NoteParent } from "@app/note/components/parent"; import { NoteDefaultUser } from "@app/note/components/user/default"; import { NoteWrapper } from "@app/note/components/wrapper"; diff --git a/src/app/note/components/kind1.tsx b/src/app/note/components/kind1.tsx index cec67a0f..fea64304 100644 --- a/src/app/note/components/kind1.tsx +++ b/src/app/note/components/kind1.tsx @@ -1,8 +1,7 @@ import { MentionNote } from "@app/note/components/mentions/note"; import { MentionUser } from "@app/note/components/mentions/user"; -import ImagePreview from "@app/note/components/preview/image"; -import VideoPreview from "@app/note/components/preview/video"; - +import { ImagePreview } from "@app/note/components/preview/image"; +import { VideoPreview } from "@app/note/components/preview/video"; import ReactMarkdown from "react-markdown"; import remarkGfm from "remark-gfm"; diff --git a/src/app/note/components/mentions/note.tsx b/src/app/note/components/mentions/note.tsx index c2fc1c0e..42361d67 100644 --- a/src/app/note/components/mentions/note.tsx +++ b/src/app/note/components/mentions/note.tsx @@ -3,13 +3,9 @@ import { Kind1063 } from "@app/note/components/kind1063"; import { NoteSkeleton } from "@app/note/components/skeleton"; import { NoteDefaultUser } from "@app/note/components/user/default"; import { NoteWrapper } from "@app/note/components/wrapper"; - import { RelayContext } from "@shared/relayProvider"; - import { READONLY_RELAYS } from "@stores/constants"; - import { noteParser } from "@utils/parser"; - import { memo, useContext } from "react"; import useSWRSubscription from "swr/subscription"; diff --git a/src/app/note/components/metadata.tsx b/src/app/note/components/metadata.tsx index c8a32ec2..7b6593e6 100644 --- a/src/app/note/components/metadata.tsx +++ b/src/app/note/components/metadata.tsx @@ -1,13 +1,13 @@ -import NoteReply from "@app/note/components/metadata/reply"; -import NoteRepost from "@app/note/components/metadata/repost"; -import NoteZap from "@app/note/components/metadata/zap"; +import { NoteReply } from "@app/note/components/metadata/reply"; +import { NoteRepost } from "@app/note/components/metadata/repost"; +import { NoteZap } from "@app/note/components/metadata/zap"; import { RelayContext } from "@shared/relayProvider"; import { READONLY_RELAYS } from "@stores/constants"; import { decode } from "light-bolt11-decoder"; import { useContext, useState } from "react"; import useSWRSubscription from "swr/subscription"; -export default function NoteMetadata({ +export function NoteMetadata({ id, eventPubkey, }: { diff --git a/src/app/note/components/metadata/like.tsx b/src/app/note/components/metadata/like.tsx index 955ca5b3..090d4202 100644 --- a/src/app/note/components/metadata/like.tsx +++ b/src/app/note/components/metadata/like.tsx @@ -1,4 +1,4 @@ -import LikeIcon from "@icons/like"; +import { LikeIcon } from "@shared/icons"; import { RelayContext } from "@shared/relayProvider"; import { useActiveAccount } from "@stores/accounts"; import { WRITEONLY_RELAYS } from "@stores/constants"; @@ -6,7 +6,7 @@ import { dateToUnix } from "@utils/date"; import { getEventHash, getSignature } from "nostr-tools"; import { useContext, useEffect, useState } from "react"; -export default function NoteLike({ +export function NoteLike({ id, pubkey, likes, diff --git a/src/app/note/components/metadata/reply.tsx b/src/app/note/components/metadata/reply.tsx index 7ccd9f5c..260b787e 100644 --- a/src/app/note/components/metadata/reply.tsx +++ b/src/app/note/components/metadata/reply.tsx @@ -1,5 +1,5 @@ import { Dialog, Transition } from "@headlessui/react"; -import ReplyIcon from "@icons/reply"; +import { ReplyIcon } from "@shared/icons"; import { Image } from "@shared/image"; import { RelayContext } from "@shared/relayProvider"; import { useActiveAccount } from "@stores/accounts"; @@ -9,10 +9,7 @@ import { compactNumber } from "@utils/number"; import { getEventHash, getSignature } from "nostr-tools"; import { Fragment, useContext, useEffect, useState } from "react"; -export default function NoteReply({ - id, - replies, -}: { id: string; replies: number }) { +export function NoteReply({ id, replies }: { id: string; replies: number }) { const pool: any = useContext(RelayContext); const account = useActiveAccount((state: any) => state.account); diff --git a/src/app/note/components/metadata/repost.tsx b/src/app/note/components/metadata/repost.tsx index 0bfa3bfb..8c66f5e7 100644 --- a/src/app/note/components/metadata/repost.tsx +++ b/src/app/note/components/metadata/repost.tsx @@ -1,4 +1,4 @@ -import RepostIcon from "@icons/repost"; +import { RepostIcon } from "@shared/icons"; import { RelayContext } from "@shared/relayProvider"; import { useActiveAccount } from "@stores/accounts"; import { WRITEONLY_RELAYS } from "@stores/constants"; @@ -7,7 +7,7 @@ import { compactNumber } from "@utils/number"; import { getEventHash, getSignature } from "nostr-tools"; import { useContext, useEffect, useState } from "react"; -export default function NoteRepost({ +export function NoteRepost({ id, pubkey, reposts, diff --git a/src/app/note/components/metadata/zap.tsx b/src/app/note/components/metadata/zap.tsx index acd97b16..8052c50f 100644 --- a/src/app/note/components/metadata/zap.tsx +++ b/src/app/note/components/metadata/zap.tsx @@ -1,8 +1,7 @@ -import ZapIcon from "@shared/icons/zap"; import { compactNumber } from "@utils/number"; import { useEffect, useState } from "react"; -export default function NoteZap({ zaps }: { zaps: number }) { +export function NoteZap({ zaps }: { zaps: number }) { const [count, setCount] = useState(0); useEffect(() => { diff --git a/src/app/note/components/parent.tsx b/src/app/note/components/parent.tsx index fff8dfe0..20e2cd9d 100644 --- a/src/app/note/components/parent.tsx +++ b/src/app/note/components/parent.tsx @@ -1,15 +1,11 @@ import { Kind1 } from "@app/note/components/kind1"; import { Kind1063 } from "@app/note/components/kind1063"; -import NoteMetadata from "@app/note/components/metadata"; +import { NoteMetadata } from "@app/note/components/metadata"; import { NoteSkeleton } from "@app/note/components/skeleton"; import { NoteDefaultUser } from "@app/note/components/user/default"; - import { RelayContext } from "@shared/relayProvider"; - import { READONLY_RELAYS } from "@stores/constants"; - import { noteParser } from "@utils/parser"; - import { memo, useContext } from "react"; import useSWRSubscription from "swr/subscription"; diff --git a/src/app/note/components/preview/image.tsx b/src/app/note/components/preview/image.tsx index 783f3286..596364f1 100644 --- a/src/app/note/components/preview/image.tsx +++ b/src/app/note/components/preview/image.tsx @@ -1,6 +1,6 @@ import { Image } from "@shared/image"; -export default function ImagePreview({ urls }: { urls: string[] }) { +export function ImagePreview({ urls }: { urls: string[] }) { return (
diff --git a/src/app/note/components/preview/video.tsx b/src/app/note/components/preview/video.tsx index a020c510..1b7557fa 100644 --- a/src/app/note/components/preview/video.tsx +++ b/src/app/note/components/preview/video.tsx @@ -1,6 +1,6 @@ import { MediaOutlet, MediaPlayer } from "@vidstack/react"; -export default function VideoPreview({ urls }: { urls: string[] }) { +export function VideoPreview({ urls }: { urls: string[] }) { return (
e.stopPropagation()} diff --git a/src/app/note/components/quoteRepost.tsx b/src/app/note/components/quoteRepost.tsx index 1dbb9f20..b127e3a1 100644 --- a/src/app/note/components/quoteRepost.tsx +++ b/src/app/note/components/quoteRepost.tsx @@ -1,7 +1,6 @@ import { RootNote } from "@app/note/components/rootNote"; import { NoteRepostUser } from "@app/note/components/user/repost"; import { NoteWrapper } from "@app/note/components/wrapper"; - import { getQuoteID } from "@utils/transform"; export function NoteQuoteRepost({ event }: { event: any }) { diff --git a/src/app/note/components/replies/form.tsx b/src/app/note/components/replies/form.tsx index a922048a..589a01fe 100644 --- a/src/app/note/components/replies/form.tsx +++ b/src/app/note/components/replies/form.tsx @@ -6,7 +6,7 @@ import { dateToUnix } from "@utils/date"; import { getEventHash, getSignature } from "nostr-tools"; import { useContext, useState } from "react"; -export default function NoteReplyForm({ id }: { id: string }) { +export function NoteReplyForm({ id }: { id: string }) { const pool: any = useContext(RelayContext); const account = useActiveAccount((state: any) => state.account); diff --git a/src/app/note/components/replies/item.tsx b/src/app/note/components/replies/item.tsx index 6ac5ce4d..c9bdd517 100644 --- a/src/app/note/components/replies/item.tsx +++ b/src/app/note/components/replies/item.tsx @@ -1,9 +1,8 @@ import { Kind1 } from "@app/note/components/kind1"; -import NoteReplyUser from "@app/note/components/user/reply"; - +import { NoteReplyUser } from "@app/note/components/user/reply"; import { noteParser } from "@utils/parser"; -export default function Reply({ data }: { data: any }) { +export function Reply({ data }: { data: any }) { const content = noteParser(data); return ( diff --git a/src/app/note/components/replies/list.tsx b/src/app/note/components/replies/list.tsx index 7d549fd4..0d756c9d 100644 --- a/src/app/note/components/replies/list.tsx +++ b/src/app/note/components/replies/list.tsx @@ -1,16 +1,12 @@ -import NoteReplyForm from "@app/note/components/replies/form"; -import Reply from "@app/note/components/replies/item"; - +import { NoteReplyForm } from "@app/note/components/replies/form"; +import { Reply } from "@app/note/components/replies/item"; import { RelayContext } from "@shared/relayProvider"; - import { READONLY_RELAYS } from "@stores/constants"; - import { sortEvents } from "@utils/transform"; - import { useContext } from "react"; import useSWRSubscription from "swr/subscription"; -export default function RepliesList({ id }: { id: string }) { +export function RepliesList({ id }: { id: string }) { const pool: any = useContext(RelayContext); const { data, error } = useSWRSubscription( diff --git a/src/app/note/components/rootNote.tsx b/src/app/note/components/rootNote.tsx index 255cdd25..5cd4b326 100644 --- a/src/app/note/components/rootNote.tsx +++ b/src/app/note/components/rootNote.tsx @@ -1,15 +1,11 @@ import { Kind1 } from "@app/note/components/kind1"; import { Kind1063 } from "@app/note/components/kind1063"; -import NoteMetadata from "@app/note/components/metadata"; +import { NoteMetadata } from "@app/note/components/metadata"; import { NoteSkeleton } from "@app/note/components/skeleton"; import { NoteDefaultUser } from "@app/note/components/user/default"; - import { RelayContext } from "@shared/relayProvider"; - import { READONLY_RELAYS } from "@stores/constants"; - import { noteParser } from "@utils/parser"; - import { memo, useContext } from "react"; import useSWRSubscription from "swr/subscription"; import { navigate } from "vite-plugin-ssr/client/router"; diff --git a/src/app/note/components/user/reply.tsx b/src/app/note/components/user/reply.tsx index 0edda36b..591c3621 100644 --- a/src/app/note/components/user/reply.tsx +++ b/src/app/note/components/user/reply.tsx @@ -7,7 +7,7 @@ import relativeTime from "dayjs/plugin/relativeTime"; dayjs.extend(relativeTime); -export default function NoteReplyUser({ +export function NoteReplyUser({ pubkey, time, }: { pubkey: string; time: number }) { diff --git a/src/app/note/layout.tsx b/src/app/note/layout.tsx index b4f1782b..85df0483 100644 --- a/src/app/note/layout.tsx +++ b/src/app/note/layout.tsx @@ -1,6 +1,6 @@ -import AppHeader from "@shared/appHeader"; -import MultiAccounts from "@shared/multiAccounts"; -import Navigation from "@shared/navigation"; +import { AppHeader } from "@shared/appHeader"; +import { MultiAccounts } from "@shared/multiAccounts"; +import { Navigation } from "@shared/navigation"; export function LayoutNewsfeed({ children }: { children: React.ReactNode }) { return ( diff --git a/src/app/note/pages/index.page.tsx b/src/app/note/pages/index.page.tsx index 6a464e3c..6bf1ce73 100644 --- a/src/app/note/pages/index.page.tsx +++ b/src/app/note/pages/index.page.tsx @@ -1,15 +1,11 @@ import { Kind1 } from "@app/note/components/kind1"; -import NoteMetadata from "@app/note/components/metadata"; -import RepliesList from "@app/note/components/replies/list"; +import { NoteMetadata } from "@app/note/components/metadata"; +import { RepliesList } from "@app/note/components/replies/list"; import { NoteDefaultUser } from "@app/note/components/user/default"; - import { RelayContext } from "@shared/relayProvider"; - import { READONLY_RELAYS } from "@stores/constants"; - import { usePageContext } from "@utils/hooks/usePageContext"; import { noteParser } from "@utils/parser"; - import { useContext } from "react"; import useSWRSubscription from "swr/subscription"; diff --git a/src/app/prefetch/pages/index.page.tsx b/src/app/prefetch/pages/index.page.tsx index b689627f..145f8c2d 100644 --- a/src/app/prefetch/pages/index.page.tsx +++ b/src/app/prefetch/pages/index.page.tsx @@ -1,4 +1,4 @@ -import LumeIcon from "@icons/lume"; +import { LumeIcon } from "@shared/icons"; import { RelayContext } from "@shared/relayProvider"; import { useActiveAccount } from "@stores/accounts"; import { READONLY_RELAYS } from "@stores/constants"; diff --git a/src/app/space/components/create.tsx b/src/app/space/components/create.tsx index 40aa7465..8f231781 100644 --- a/src/app/space/components/create.tsx +++ b/src/app/space/components/create.tsx @@ -1,7 +1,6 @@ import { BlockImageUploader } from "./imageUploader"; import { Dialog, Transition } from "@headlessui/react"; -import CancelIcon from "@icons/cancel"; -import PlusIcon from "@icons/plus"; +import { CancelIcon, PlusIcon } from "@shared/icons"; import { Image } from "@shared/image"; import { useActiveAccount } from "@stores/accounts"; import { DEFAULT_AVATAR } from "@stores/constants"; diff --git a/src/app/space/layout.tsx b/src/app/space/layout.tsx index b2ca9b0c..00abfbb7 100644 --- a/src/app/space/layout.tsx +++ b/src/app/space/layout.tsx @@ -1,5 +1,5 @@ -import MultiAccounts from "@shared/multiAccounts"; -import Navigation from "@shared/navigation"; +import { MultiAccounts } from "@shared/multiAccounts"; +import { Navigation } from "@shared/navigation"; export function LayoutSpace({ children }: { children: React.ReactNode }) { return ( diff --git a/src/app/threads/layout.tsx b/src/app/threads/layout.tsx index ad04db56..06b9472d 100644 --- a/src/app/threads/layout.tsx +++ b/src/app/threads/layout.tsx @@ -1,5 +1,5 @@ -import MultiAccounts from "@shared/multiAccounts"; -import Navigation from "@shared/navigation"; +import { MultiAccounts } from "@shared/multiAccounts"; +import { Navigation } from "@shared/navigation"; export function LayoutNewsfeed({ children }: { children: React.ReactNode }) { return ( diff --git a/src/shared/accounts/active.tsx b/src/shared/accounts/active.tsx index 47d53abe..c36ff196 100644 --- a/src/shared/accounts/active.tsx +++ b/src/shared/accounts/active.tsx @@ -1,9 +1,8 @@ import { Image } from "@shared/image"; - import { DEFAULT_AVATAR } from "@stores/constants"; import { useProfile } from "@utils/hooks/useProfile"; -export default function ActiveAccount({ data }: { data: any }) { +export function ActiveAccount({ data }: { data: any }) { const { user } = useProfile(data.pubkey); return ( diff --git a/src/shared/accounts/inactive.tsx b/src/shared/accounts/inactive.tsx index 33ea14d0..6f084953 100644 --- a/src/shared/accounts/inactive.tsx +++ b/src/shared/accounts/inactive.tsx @@ -3,7 +3,7 @@ import { Image } from "@shared/image"; import { DEFAULT_AVATAR } from "@stores/constants"; import { useProfile } from "@utils/hooks/useProfile"; -export default function InactiveAccount({ data }: { data: any }) { +export function InactiveAccount({ data }: { data: any }) { const { user } = useProfile(data.npub); return ( diff --git a/src/shared/activeLink.tsx b/src/shared/activeLink.tsx index ddc20510..8ec3e4ea 100644 --- a/src/shared/activeLink.tsx +++ b/src/shared/activeLink.tsx @@ -1,8 +1,7 @@ import { usePageContext } from "@utils/hooks/usePageContext"; - import { twMerge } from "tailwind-merge"; -export default function ActiveLink({ +export function ActiveLink({ href, className, activeClassName, diff --git a/src/shared/appHeader.tsx b/src/shared/appHeader.tsx index e7001de4..2f55d2c1 100644 --- a/src/shared/appHeader.tsx +++ b/src/shared/appHeader.tsx @@ -1,6 +1,5 @@ -import ArrowLeftIcon from "@icons/arrowLeft"; -import ArrowRightIcon from "@icons/arrowRight"; -import EventCollector from "@shared/eventCollector"; +import { EventCollector } from "@shared/eventCollector"; +import { ArrowLeftIcon, ArrowRightIcon } from "@shared/icons"; export function AppHeader() { const goBack = () => { diff --git a/src/shared/composer/imageUploader.tsx b/src/shared/composer/imageUploader.tsx index 07761166..87e66a29 100644 --- a/src/shared/composer/imageUploader.tsx +++ b/src/shared/composer/imageUploader.tsx @@ -1,10 +1,8 @@ -import PlusCircleIcon from "@shared/icons/plusCircle"; - -import { createBlobFromFile } from "@utils/createBlobFromFile"; - +import { PlusCircleIcon } from "@shared/icons"; import { open } from "@tauri-apps/api/dialog"; import { listen } from "@tauri-apps/api/event"; import { Body, fetch } from "@tauri-apps/api/http"; +import { createBlobFromFile } from "@utils/createBlobFromFile"; import { useCallback, useEffect, useState } from "react"; import { Transforms } from "slate"; import { useSlateStatic } from "slate-react"; diff --git a/src/shared/composer/modal.tsx b/src/shared/composer/modal.tsx index 2d3987b2..8d61791b 100644 --- a/src/shared/composer/modal.tsx +++ b/src/shared/composer/modal.tsx @@ -1,10 +1,12 @@ import { Dialog, Transition } from "@headlessui/react"; -import CancelIcon from "@icons/cancel"; -import ChevronDownIcon from "@icons/chevronDown"; -import ChevronRightIcon from "@icons/chevronRight"; -import ComposeIcon from "@icons/compose"; import { Post } from "@shared/composer/types/post"; import { User } from "@shared/composer/user"; +import { + CancelIcon, + ChevronDownIcon, + ChevronRightIcon, + ComposeIcon, +} from "@shared/icons"; import { useActiveAccount } from "@stores/accounts"; import { Fragment, useState } from "react"; diff --git a/src/shared/composer/types/post.tsx b/src/shared/composer/types/post.tsx index ebfe90e9..dbe3522a 100644 --- a/src/shared/composer/types/post.tsx +++ b/src/shared/composer/types/post.tsx @@ -1,11 +1,8 @@ import { ImageUploader } from "@shared/composer/imageUploader"; -import TrashIcon from "@shared/icons/trash"; +import { TrashIcon } from "@shared/icons"; import { RelayContext } from "@shared/relayProvider"; - import { WRITEONLY_RELAYS } from "@stores/constants"; - import { dateToUnix } from "@utils/date"; - import { getEventHash, getSignature } from "nostr-tools"; import { useCallback, useContext, useMemo, useState } from "react"; import { Node, Transforms, createEditor } from "slate"; diff --git a/src/shared/eventCollector.tsx b/src/shared/eventCollector.tsx index 5509bc68..224b9607 100644 --- a/src/shared/eventCollector.tsx +++ b/src/shared/eventCollector.tsx @@ -1,4 +1,4 @@ -import HeartBeatIcon from "@icons/heartbeat"; +import { HeartBeatIcon } from "@shared/icons"; import { RelayContext } from "@shared/relayProvider"; import { useActiveAccount } from "@stores/accounts"; import { READONLY_RELAYS } from "@stores/constants"; @@ -8,7 +8,7 @@ import { getParentID, nip02ToArray } from "@utils/transform"; import { useContext } from "react"; import useSWRSubscription from "swr/subscription"; -export default function EventCollector() { +export function EventCollector() { const pool: any = useContext(RelayContext); const account = useActiveAccount((state: any) => state.account); diff --git a/src/shared/icons/arrowLeft.tsx b/src/shared/icons/arrowLeft.tsx index a2e30fa9..ebe02c0d 100644 --- a/src/shared/icons/arrowLeft.tsx +++ b/src/shared/icons/arrowLeft.tsx @@ -1,6 +1,6 @@ import { SVGProps } from "react"; -export default function ArrowLeftIcon( +export function ArrowLeftIcon( props: JSX.IntrinsicAttributes & SVGProps, ) { return ( diff --git a/src/shared/icons/arrowRight.tsx b/src/shared/icons/arrowRight.tsx index 0d1d9ebd..cd71c563 100644 --- a/src/shared/icons/arrowRight.tsx +++ b/src/shared/icons/arrowRight.tsx @@ -1,6 +1,6 @@ import { SVGProps } from "react"; -export default function ArrowRightIcon( +export function ArrowRightIcon( props: JSX.IntrinsicAttributes & SVGProps, ) { return ( diff --git a/src/shared/icons/bell.tsx b/src/shared/icons/bell.tsx index 4298213f..4614ca9a 100644 --- a/src/shared/icons/bell.tsx +++ b/src/shared/icons/bell.tsx @@ -1,6 +1,6 @@ import { SVGProps } from "react"; -export default function BellIcon( +export function BellIcon( props: JSX.IntrinsicAttributes & SVGProps, ) { return ( diff --git a/src/shared/icons/cancel.tsx b/src/shared/icons/cancel.tsx index 50a6087d..063e8cb4 100644 --- a/src/shared/icons/cancel.tsx +++ b/src/shared/icons/cancel.tsx @@ -1,6 +1,6 @@ import { SVGProps } from "react"; -export default function CancelIcon( +export function CancelIcon( props: JSX.IntrinsicAttributes & SVGProps, ) { return ( diff --git a/src/shared/icons/checkCircle.tsx b/src/shared/icons/checkCircle.tsx index b1e3e331..442a4d08 100644 --- a/src/shared/icons/checkCircle.tsx +++ b/src/shared/icons/checkCircle.tsx @@ -1,6 +1,6 @@ import { SVGProps } from "react"; -export default function CheckCircleIcon( +export function CheckCircleIcon( props: JSX.IntrinsicAttributes & SVGProps, ) { return ( diff --git a/src/shared/icons/chevronDown.tsx b/src/shared/icons/chevronDown.tsx index b4ddc09e..c72ccf1b 100644 --- a/src/shared/icons/chevronDown.tsx +++ b/src/shared/icons/chevronDown.tsx @@ -1,6 +1,6 @@ import { SVGProps } from "react"; -export default function ChevronDownIcon( +export function ChevronDownIcon( props: JSX.IntrinsicAttributes & SVGProps, ) { return ( diff --git a/src/shared/icons/chevronRight.tsx b/src/shared/icons/chevronRight.tsx index f0562e35..06a4cdac 100644 --- a/src/shared/icons/chevronRight.tsx +++ b/src/shared/icons/chevronRight.tsx @@ -1,6 +1,6 @@ import { SVGProps } from "react"; -export default function ChevronRightIcon( +export function ChevronRightIcon( props: JSX.IntrinsicAttributes & SVGProps, ) { return ( diff --git a/src/shared/icons/compose.tsx b/src/shared/icons/compose.tsx index 0f4981fb..47a90044 100644 --- a/src/shared/icons/compose.tsx +++ b/src/shared/icons/compose.tsx @@ -1,6 +1,6 @@ import { SVGProps } from "react"; -export default function ComposeIcon( +export function ComposeIcon( props: JSX.IntrinsicAttributes & SVGProps, ) { return ( diff --git a/src/shared/icons/copy.tsx b/src/shared/icons/copy.tsx index 67215e30..c8b1a171 100644 --- a/src/shared/icons/copy.tsx +++ b/src/shared/icons/copy.tsx @@ -1,6 +1,6 @@ import { SVGProps } from "react"; -export default function CopyIcon( +export function CopyIcon( props: JSX.IntrinsicAttributes & SVGProps, ) { return ( diff --git a/src/shared/icons/edit.tsx b/src/shared/icons/edit.tsx index 48a3735a..46317299 100644 --- a/src/shared/icons/edit.tsx +++ b/src/shared/icons/edit.tsx @@ -1,6 +1,6 @@ import { SVGProps } from "react"; -export default function EditIcon( +export function EditIcon( props: JSX.IntrinsicAttributes & SVGProps, ) { return ( diff --git a/src/shared/icons/eyeOff.tsx b/src/shared/icons/eyeOff.tsx index 41dd6973..64431a26 100644 --- a/src/shared/icons/eyeOff.tsx +++ b/src/shared/icons/eyeOff.tsx @@ -1,6 +1,6 @@ import { SVGProps } from "react"; -export default function EyeOffIcon( +export function EyeOffIcon( props: JSX.IntrinsicAttributes & SVGProps, ) { return ( diff --git a/src/shared/icons/eyeOn.tsx b/src/shared/icons/eyeOn.tsx index 132f23a2..403bfe45 100644 --- a/src/shared/icons/eyeOn.tsx +++ b/src/shared/icons/eyeOn.tsx @@ -1,6 +1,6 @@ import { SVGProps } from "react"; -export default function EyeOnIcon( +export function EyeOnIcon( props: JSX.IntrinsicAttributes & SVGProps, ) { return ( diff --git a/src/shared/icons/heartbeat.tsx b/src/shared/icons/heartbeat.tsx index a43d339d..bc9bf980 100644 --- a/src/shared/icons/heartbeat.tsx +++ b/src/shared/icons/heartbeat.tsx @@ -1,6 +1,6 @@ import { SVGProps } from "react"; -export default function HeartBeatIcon( +export function HeartBeatIcon( props: JSX.IntrinsicAttributes & SVGProps, ) { return ( diff --git a/src/shared/icons/hide.tsx b/src/shared/icons/hide.tsx index eae02632..8cc479b1 100644 --- a/src/shared/icons/hide.tsx +++ b/src/shared/icons/hide.tsx @@ -1,6 +1,6 @@ import { SVGProps } from "react"; -export default function HideIcon( +export function HideIcon( props: JSX.IntrinsicAttributes & SVGProps, ) { return ( diff --git a/src/shared/icons/index.tsx b/src/shared/icons/index.tsx new file mode 100644 index 00000000..2dc554b5 --- /dev/null +++ b/src/shared/icons/index.tsx @@ -0,0 +1,31 @@ +// @index('./*.tsx', f => `export * from '${f.path}'`) +export * from "./arrowLeft"; +export * from "./arrowRight"; +export * from "./bell"; +export * from "./cancel"; +export * from "./checkCircle"; +export * from "./chevronDown"; +export * from "./chevronRight"; +export * from "./compose"; +export * from "./copy"; +export * from "./edit"; +export * from "./eyeOff"; +export * from "./eyeOn"; +export * from "./heartbeat"; +export * from "./hide"; +export * from "./like"; +export * from "./lume"; +export * from "./mute"; +export * from "./myspace"; +export * from "./navArrowDown"; +export * from "./plus"; +export * from "./plusCircle"; +export * from "./refresh"; +export * from "./reply"; +export * from "./replyMessage"; +export * from "./repost"; +export * from "./threads"; +export * from "./trash"; +export * from "./world"; +export * from "./zap"; +// @endindex diff --git a/src/shared/icons/like.tsx b/src/shared/icons/like.tsx index 69e666c1..ef6378bd 100644 --- a/src/shared/icons/like.tsx +++ b/src/shared/icons/like.tsx @@ -1,6 +1,6 @@ import { SVGProps } from "react"; -export default function LikeIcon( +export function LikeIcon( props: JSX.IntrinsicAttributes & SVGProps, ) { return ( diff --git a/src/shared/icons/lume.tsx b/src/shared/icons/lume.tsx index 15a6ec10..d37bce44 100644 --- a/src/shared/icons/lume.tsx +++ b/src/shared/icons/lume.tsx @@ -1,4 +1,4 @@ -export default function LumeIcon({ className }: { className: string }) { +export function LumeIcon({ className }: { className: string }) { return ( , ) { return ( diff --git a/src/shared/icons/myspace.tsx b/src/shared/icons/myspace.tsx index 18c523f5..da9a1559 100644 --- a/src/shared/icons/myspace.tsx +++ b/src/shared/icons/myspace.tsx @@ -1,6 +1,6 @@ import { SVGProps } from "react"; -export default function MyspaceIcon( +export function MyspaceIcon( props: JSX.IntrinsicAttributes & SVGProps, ) { return ( diff --git a/src/shared/icons/navArrowDown.tsx b/src/shared/icons/navArrowDown.tsx index a909d97f..339ccd51 100644 --- a/src/shared/icons/navArrowDown.tsx +++ b/src/shared/icons/navArrowDown.tsx @@ -1,6 +1,6 @@ import { SVGProps } from "react"; -export default function NavArrowDownIcon( +export function NavArrowDownIcon( props: JSX.IntrinsicAttributes & SVGProps, ) { return ( diff --git a/src/shared/icons/plus.tsx b/src/shared/icons/plus.tsx index ed8c2aab..54397626 100644 --- a/src/shared/icons/plus.tsx +++ b/src/shared/icons/plus.tsx @@ -1,6 +1,6 @@ import { SVGProps } from "react"; -export default function PlusIcon( +export function PlusIcon( props: JSX.IntrinsicAttributes & SVGProps, ) { return ( diff --git a/src/shared/icons/plusCircle.tsx b/src/shared/icons/plusCircle.tsx index 6d15e49f..f81bfac6 100644 --- a/src/shared/icons/plusCircle.tsx +++ b/src/shared/icons/plusCircle.tsx @@ -1,6 +1,6 @@ import { SVGProps } from "react"; -export default function PlusCircleIcon( +export function PlusCircleIcon( props: JSX.IntrinsicAttributes & SVGProps, ) { return ( diff --git a/src/shared/icons/refresh.tsx b/src/shared/icons/refresh.tsx index 6c4ca34b..e59f0ed6 100644 --- a/src/shared/icons/refresh.tsx +++ b/src/shared/icons/refresh.tsx @@ -1,6 +1,6 @@ import { SVGProps } from "react"; -export default function RefreshIcon( +export function RefreshIcon( props: JSX.IntrinsicAttributes & SVGProps, ) { return ( diff --git a/src/shared/icons/reply.tsx b/src/shared/icons/reply.tsx index 9e1bdbf1..7550d663 100644 --- a/src/shared/icons/reply.tsx +++ b/src/shared/icons/reply.tsx @@ -1,6 +1,6 @@ import { SVGProps } from "react"; -export default function ReplyIcon( +export function ReplyIcon( props: JSX.IntrinsicAttributes & SVGProps, ) { return ( diff --git a/src/shared/icons/replyMessage.tsx b/src/shared/icons/replyMessage.tsx index db21d98d..58292467 100644 --- a/src/shared/icons/replyMessage.tsx +++ b/src/shared/icons/replyMessage.tsx @@ -1,6 +1,6 @@ import { SVGProps } from "react"; -export default function ReplyMessageIcon( +export function ReplyMessageIcon( props: JSX.IntrinsicAttributes & SVGProps, ) { return ( diff --git a/src/shared/icons/repost.tsx b/src/shared/icons/repost.tsx index dad2c8f1..434a33c8 100644 --- a/src/shared/icons/repost.tsx +++ b/src/shared/icons/repost.tsx @@ -1,6 +1,6 @@ import { SVGProps } from "react"; -export default function RepostIcon( +export function RepostIcon( props: JSX.IntrinsicAttributes & SVGProps, ) { return ( diff --git a/src/shared/icons/threads.tsx b/src/shared/icons/threads.tsx index 9fc6c796..c0407239 100644 --- a/src/shared/icons/threads.tsx +++ b/src/shared/icons/threads.tsx @@ -1,6 +1,6 @@ import { SVGProps } from "react"; -export default function ThreadsIcon( +export function ThreadsIcon( props: JSX.IntrinsicAttributes & SVGProps, ) { return ( diff --git a/src/shared/icons/trash.tsx b/src/shared/icons/trash.tsx index e87d9a6d..22eb01de 100644 --- a/src/shared/icons/trash.tsx +++ b/src/shared/icons/trash.tsx @@ -1,6 +1,6 @@ import { SVGProps } from "react"; -export default function TrashIcon( +export function TrashIcon( props: JSX.IntrinsicAttributes & SVGProps, ) { return ( diff --git a/src/shared/icons/world.tsx b/src/shared/icons/world.tsx index ce9d9ca1..00889484 100644 --- a/src/shared/icons/world.tsx +++ b/src/shared/icons/world.tsx @@ -1,6 +1,6 @@ import { SVGProps } from "react"; -export default function WorldIcon( +export function WorldIcon( props: JSX.IntrinsicAttributes & SVGProps, ) { return ( diff --git a/src/shared/icons/zap.tsx b/src/shared/icons/zap.tsx index 493e524c..f6a511e6 100644 --- a/src/shared/icons/zap.tsx +++ b/src/shared/icons/zap.tsx @@ -1,6 +1,6 @@ import { SVGProps } from "react"; -export default function ZapIcon( +export function ZapIcon( props: JSX.IntrinsicAttributes & SVGProps, ) { return ( diff --git a/src/shared/multiAccounts.tsx b/src/shared/multiAccounts.tsx index 5e21bd50..8be7b36f 100644 --- a/src/shared/multiAccounts.tsx +++ b/src/shared/multiAccounts.tsx @@ -1,19 +1,14 @@ -import ActiveAccount from "@shared/accounts/active"; -import InactiveAccount from "@shared/accounts/inactive"; - -import BellIcon from "@icons/bell"; -import PlusIcon from "@icons/plus"; - +import { ActiveAccount } from "@shared/accounts/active"; +import { InactiveAccount } from "@shared/accounts/inactive"; +import { BellIcon, PlusIcon } from "@shared/icons"; import { APP_VERSION } from "@stores/constants"; - import { getAccounts, getActiveAccount } from "@utils/storage"; - import useSWR from "swr"; const allFetcher = () => getAccounts(); const fetcher = () => getActiveAccount(); -export default function MultiAccounts() { +export function MultiAccounts() { const { data: accounts }: any = useSWR("allAccounts", allFetcher); const { data: activeAccount }: any = useSWR("activeAccount", fetcher); diff --git a/src/shared/navigation.tsx b/src/shared/navigation.tsx index 7d1a62fa..cc8b7165 100644 --- a/src/shared/navigation.tsx +++ b/src/shared/navigation.tsx @@ -1,14 +1,12 @@ -import ChannelsList from "@app/channel/components/list"; -import ChatsList from "@app/chat/components/list"; +import { ChannelsList } from "@app/channel/components/list"; +import { ChatsList } from "@app/chat/components/list"; import { Disclosure } from "@headlessui/react"; -import NavArrowDownIcon from "@icons/navArrowDown"; -import ThreadsIcon from "@icons/threads"; -import WorldIcon from "@icons/world"; -import ActiveLink from "@shared/activeLink"; +import { ActiveLink } from "@shared/activeLink"; import { AppHeader } from "@shared/appHeader"; import { ComposerModal } from "@shared/composer/modal"; +import { NavArrowDownIcon, ThreadsIcon, WorldIcon } from "@shared/icons"; -export default function Navigation() { +export function Navigation() { return (
diff --git a/src/shared/profile/followers.tsx b/src/shared/profile/followers.tsx deleted file mode 100644 index a8078095..00000000 --- a/src/shared/profile/followers.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { RelayContext } from "@shared/relaysProvider"; -import { UserFollow } from "@shared/user/follow"; - -import { READONLY_RELAYS } from "@stores/constants"; - -import destr from "destr"; -import { Author } from "nostr-relaypool"; -import { useContext, useEffect, useState } from "react"; - -export default function ProfileFollowers({ id }: { id: string }) { - const pool: any = useContext(RelayContext); - const [followers, setFollowers] = useState(null); - - useEffect(() => { - const user = new Author(pool, READONLY_RELAYS, id); - user.followers((res) => setFollowers(destr(res.tags)), 0, 100); - }, [id, pool]); - - return ( -
- {followers?.map((follower) => ( - - ))} -
- ); -} diff --git a/src/shared/profile/follows.tsx b/src/shared/profile/follows.tsx deleted file mode 100644 index e9c76e13..00000000 --- a/src/shared/profile/follows.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { RelayContext } from "@shared/relaysProvider"; -import { UserFollow } from "@shared/user/follow"; - -import { READONLY_RELAYS } from "@stores/constants"; - -import { Author } from "nostr-relaypool"; -import { useContext, useEffect, useState } from "react"; - -export default function ProfileFollows({ id }: { id: string }) { - const pool: any = useContext(RelayContext); - const [follows, setFollows] = useState(null); - - useEffect(() => { - const user = new Author(pool, READONLY_RELAYS, id); - user.follows((res) => setFollows(res), 0); - }, [id, pool]); - - return ( -
- {follows?.map((follow) => ( - - ))} -
- ); -} diff --git a/src/shared/profile/metadata.tsx b/src/shared/profile/metadata.tsx deleted file mode 100644 index cfac4a05..00000000 --- a/src/shared/profile/metadata.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import { Image } from "@shared/image"; -import { RelayContext } from "@shared/relayProvider"; - -import { DEFAULT_AVATAR, READONLY_RELAYS } from "@stores/constants"; - -import { shortenKey } from "@utils/shortenKey"; - -import destr from "destr"; -import { Author } from "nostr-relaypool"; -import { useContext, useEffect, useState } from "react"; - -const DEFAULT_BANNER = - "https://bafybeiacwit7hjmdefqggxqtgh6ht5dhth7ndptwn2msl5kpkodudsr7py.ipfs.w3s.link/banner-1.jpg"; - -export default function ProfileMetadata({ id }: { id: string }) { - const pool: any = useContext(RelayContext); - const [profile, setProfile] = useState(null); - - useEffect(() => { - const user = new Author(pool, READONLY_RELAYS, id); - user.metaData((res) => setProfile(destr(res.content)), 0); - }, [id, pool]); - - return ( - <> -
-
- user's banner -
-
-
- {id} -
-
-
-
-
-
-

- {profile?.display_name || profile?.name} -

- - {profile?.username || (id && shortenKey(id))} - -
-
- {profile?.about} -
-
-
- - ); -} diff --git a/src/shared/profile/notes.tsx b/src/shared/profile/notes.tsx deleted file mode 100644 index 6f98b51f..00000000 --- a/src/shared/profile/notes.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { NoteBase } from "@shared/note/base"; -import { RelayContext } from "@shared/relaysProvider"; - -import { READONLY_RELAYS } from "@stores/constants"; - -import { Author } from "nostr-relaypool"; -import { useContext, useEffect, useState } from "react"; - -export default function ProfileNotes({ id }: { id: string }) { - const pool: any = useContext(RelayContext); - const [data, setData] = useState([]); - - useEffect(() => { - const user = new Author(pool, READONLY_RELAYS, id); - user.text((res) => setData((data) => [...data, res]), 100, 0); - }, [id, pool]); - - return ( -
- {data.map((item) => ( -
- -
- ))} -
- ); -} diff --git a/tsconfig.json b/tsconfig.json index 0ab6e290..b4a98cce 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,6 @@ "paths": { "@app/*": ["src/app/*"], "@shared/*": ["src/shared/*"], - "@icons/*": ["src/shared/icons/*"], "@stores/*": ["src/stores/*"], "@utils/*": ["src/utils/*"] },