diff --git a/.prettierrc b/.prettierrc index c294aaca..4bd6dbbd 100644 --- a/.prettierrc +++ b/.prettierrc @@ -14,7 +14,7 @@ "^@utils/(.*)$", "^[./]" ], - "importOrderSeparation": true, + "importOrderSeparation": false, "importOrderSortSpecifiers": true, "plugins": ["@trivago/prettier-plugin-sort-imports", "prettier-plugin-tailwindcss"], "pluginSearchDirs": false diff --git a/src/app.css b/src/app.css index fac2b4d3..db27fba9 100644 --- a/src/app.css +++ b/src/app.css @@ -13,9 +13,9 @@ overflow-wrap: break-word; } - .prose :where(iframe):not(:where([class~="not-prose"] *)) { - @apply aspect-video w-full h-auto mx-auto; - } + .prose :where(iframe):not(:where([class~='not-prose'] *)) { + @apply mx-auto aspect-video h-auto w-full; + } } html { @@ -44,7 +44,7 @@ input::-ms-clear { } .ProseMirror p.is-empty::before { - @apply text-neutral-600 dark:text-neutral-400 float-left h-0 pointer-events-none content-[attr(data-placeholder)]; + @apply pointer-events-none float-left h-0 text-neutral-600 content-[attr(data-placeholder)] dark:text-neutral-400; } .ProseMirror img.ProseMirror-selectednode { diff --git a/src/app.tsx b/src/app.tsx index 7b6cd157..baea42e6 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -1,22 +1,18 @@ import { fetch } from '@tauri-apps/plugin-http'; import { RouterProvider, createBrowserRouter, defer, redirect } from 'react-router-dom'; - import { ChatsScreen } from '@app/chats'; import { ErrorScreen } from '@app/error'; - import { useArk } from '@libs/ark'; - import { LoaderIcon } from '@shared/icons'; import { AppLayout } from '@shared/layouts/app'; import { AuthLayout } from '@shared/layouts/auth'; import { NewLayout } from '@shared/layouts/new'; import { NoteLayout } from '@shared/layouts/note'; import { SettingsLayout } from '@shared/layouts/settings'; - import './app.css'; export default function App() { - const { ark } = useArk(); + const ark = useArk(); const accountLoader = async () => { if (!ark.account) return redirect('/auth/welcome'); diff --git a/src/app/auth/components/avatarUploader.tsx b/src/app/auth/components/avatarUploader.tsx index fd920e76..c2eb0079 100644 --- a/src/app/auth/components/avatarUploader.tsx +++ b/src/app/auth/components/avatarUploader.tsx @@ -1,8 +1,6 @@ import { message } from '@tauri-apps/plugin-dialog'; import { Dispatch, SetStateAction, useState } from 'react'; - import { useArk } from '@libs/ark'; - import { LoaderIcon } from '@shared/icons'; export function AvatarUploader({ @@ -10,7 +8,7 @@ export function AvatarUploader({ }: { setPicture: Dispatch>; }) { - const { ark } = useArk(); + const ark = useArk(); const [loading, setLoading] = useState(false); const uploadAvatar = async () => { diff --git a/src/app/auth/create.tsx b/src/app/auth/create.tsx index 872300a7..a195d1fa 100644 --- a/src/app/auth/create.tsx +++ b/src/app/auth/create.tsx @@ -10,11 +10,8 @@ import { useState } from 'react'; import { useForm } from 'react-hook-form'; import { useNavigate } from 'react-router-dom'; import { toast } from 'sonner'; - import { AvatarUploader } from '@app/auth/components/avatarUploader'; - import { useArk } from '@libs/ark'; - import { ArrowLeftIcon, InfoIcon, LoaderIcon } from '@shared/icons'; import { User } from '@shared/user'; @@ -29,7 +26,7 @@ export function CreateAccountScreen() { privkey: string; }>(null); - const { ark } = useArk(); + const ark = useArk(); const { register, handleSubmit, diff --git a/src/app/auth/finish.tsx b/src/app/auth/finish.tsx index dc4faa38..781db3e4 100644 --- a/src/app/auth/finish.tsx +++ b/src/app/auth/finish.tsx @@ -2,15 +2,12 @@ import { NDKKind } from '@nostr-dev-kit/ndk'; import { useQueryClient } from '@tanstack/react-query'; import { useState } from 'react'; import { Link, useNavigate } from 'react-router-dom'; - import { useArk } from '@libs/ark'; - import { LoaderIcon } from '@shared/icons'; - import { FETCH_LIMIT } from '@utils/constants'; export function FinishScreen() { - const { ark } = useArk(); + const ark = useArk(); const [loading, setLoading] = useState(false); const queryClient = useQueryClient(); diff --git a/src/app/auth/follow.tsx b/src/app/auth/follow.tsx index 6bc5b600..4baa037f 100644 --- a/src/app/auth/follow.tsx +++ b/src/app/auth/follow.tsx @@ -6,9 +6,7 @@ import { useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { toast } from 'sonner'; import { twMerge } from 'tailwind-merge'; - import { useArk } from '@libs/ark'; - import { ArrowLeftIcon, ArrowRightIcon, @@ -36,7 +34,7 @@ const POPULAR_USERS = [ const LUME_USERS = ['npub1zfss807aer0j26mwp2la0ume0jqde3823rmu97ra6sgyyg956e0s6xw445']; export function FollowScreen() { - const { ark } = useArk(); + const ark = useArk(); const { status, data } = useQuery({ queryKey: ['trending-profiles-widget'], queryFn: async () => { diff --git a/src/app/auth/import.tsx b/src/app/auth/import.tsx index 541d0591..92c32030 100644 --- a/src/app/auth/import.tsx +++ b/src/app/auth/import.tsx @@ -7,9 +7,7 @@ import { useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { toast } from 'sonner'; import { twMerge } from 'tailwind-merge'; - import { useArk } from '@libs/ark'; - import { ArrowLeftIcon, LoaderIcon } from '@shared/icons'; import { User } from '@shared/user'; @@ -21,7 +19,7 @@ export function ImportAccountScreen() { const [created, setCreated] = useState({ ok: false, remote: false }); const [savedPrivkey, setSavedPrivkey] = useState(false); - const { ark } = useArk(); + const ark = useArk(); const navigate = useNavigate(); const submitNpub = async () => { diff --git a/src/app/auth/onboarding.tsx b/src/app/auth/onboarding.tsx index d4e065d4..a4515bf8 100644 --- a/src/app/auth/onboarding.tsx +++ b/src/app/auth/onboarding.tsx @@ -2,13 +2,11 @@ import * as Switch from '@radix-ui/react-switch'; import { isPermissionGranted, requestPermission } from '@tauri-apps/plugin-notification'; import { useEffect, useState } from 'react'; import { useNavigate } from 'react-router-dom'; - import { useArk } from '@libs/ark'; - import { InfoIcon } from '@shared/icons'; export function OnboardingScreen() { - const { ark } = useArk(); + const ark = useArk(); const navigate = useNavigate(); const [settings, setSettings] = useState({ diff --git a/src/app/auth/tutorials/finish.tsx b/src/app/auth/tutorials/finish.tsx index bf969f10..241043a1 100644 --- a/src/app/auth/tutorials/finish.tsx +++ b/src/app/auth/tutorials/finish.tsx @@ -2,15 +2,12 @@ import { NDKKind } from '@nostr-dev-kit/ndk'; import { useQueryClient } from '@tanstack/react-query'; import { useState } from 'react'; import { Link, useNavigate } from 'react-router-dom'; - import { useArk } from '@libs/ark'; - import { LoaderIcon } from '@shared/icons'; - import { FETCH_LIMIT } from '@utils/constants'; export function TutorialFinishScreen() { - const { ark } = useArk(); + const ark = useArk(); const [loading, setLoading] = useState(false); const queryClient = useQueryClient(); diff --git a/src/app/auth/tutorials/note.tsx b/src/app/auth/tutorials/note.tsx index b8a21434..b802eff1 100644 --- a/src/app/auth/tutorials/note.tsx +++ b/src/app/auth/tutorials/note.tsx @@ -1,12 +1,10 @@ import { Link } from 'react-router-dom'; - import { useArk } from '@libs/ark'; - import { EditIcon, ReactionIcon, ReplyIcon, RepostIcon, ZapIcon } from '@shared/icons'; import { TextNote } from '@shared/notes'; export function TutorialNoteScreen() { - const { ark } = useArk(); + const ark = useArk(); const exampleEvent = ark.createNDKEvent({ event: { diff --git a/src/app/auth/tutorials/widget.tsx b/src/app/auth/tutorials/widget.tsx index 7a6d90a9..e1276608 100644 --- a/src/app/auth/tutorials/widget.tsx +++ b/src/app/auth/tutorials/widget.tsx @@ -1,5 +1,4 @@ import { Link } from 'react-router-dom'; - import { BellIcon, HomeIcon, PlusIcon } from '@shared/icons'; export function TutorialWidgetScreen() { diff --git a/src/app/chats/chat.tsx b/src/app/chats/chat.tsx index a6bccbbb..395472c6 100644 --- a/src/app/chats/chat.tsx +++ b/src/app/chats/chat.tsx @@ -3,17 +3,14 @@ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; import { useCallback, useEffect, useRef } from 'react'; import { useParams } from 'react-router-dom'; import { VList, VListHandle } from 'virtua'; - import { ChatForm } from '@app/chats/components/chatForm'; import { ChatMessage } from '@app/chats/components/message'; - import { useArk } from '@libs/ark'; - import { LoaderIcon } from '@shared/icons'; import { User } from '@shared/user'; export function ChatScreen() { - const { ark } = useArk(); + const ark = useArk(); const { pubkey } = useParams(); const { status, data } = useQuery({ queryKey: ['nip04-dm', pubkey], diff --git a/src/app/chats/components/chatForm.tsx b/src/app/chats/components/chatForm.tsx index 62389df7..038aea9a 100644 --- a/src/app/chats/components/chatForm.tsx +++ b/src/app/chats/components/chatForm.tsx @@ -1,14 +1,11 @@ import { useState } from 'react'; import { toast } from 'sonner'; - import { MediaUploader } from '@app/chats/components/mediaUploader'; - import { useArk } from '@libs/ark'; - import { EnterIcon } from '@shared/icons'; export function ChatForm({ receiverPubkey }: { receiverPubkey: string }) { - const { ark } = useArk(); + const ark = useArk(); const [value, setValue] = useState(''); const submit = async () => { diff --git a/src/app/chats/components/chatListItem.tsx b/src/app/chats/components/chatListItem.tsx index 2fa56470..13c41bbb 100644 --- a/src/app/chats/components/chatListItem.tsx +++ b/src/app/chats/components/chatListItem.tsx @@ -4,9 +4,7 @@ import { minidenticon } from 'minidenticons'; import { memo } from 'react'; import { NavLink } from 'react-router-dom'; import { twMerge } from 'tailwind-merge'; - import { useDecryptMessage } from '@app/chats/hooks/useDecryptMessage'; - import { displayNpub, formatCreatedAt } from '@utils/formater'; import { useProfile } from '@utils/hooks/useProfile'; diff --git a/src/app/chats/components/mediaUploader.tsx b/src/app/chats/components/mediaUploader.tsx index adec461f..aa1a4284 100644 --- a/src/app/chats/components/mediaUploader.tsx +++ b/src/app/chats/components/mediaUploader.tsx @@ -1,8 +1,6 @@ import * as Tooltip from '@radix-ui/react-tooltip'; import { Dispatch, SetStateAction, useState } from 'react'; - import { useArk } from '@libs/ark'; - import { LoaderIcon, MediaIcon } from '@shared/icons'; export function MediaUploader({ @@ -10,7 +8,7 @@ export function MediaUploader({ }: { setState: Dispatch>; }) { - const { ark } = useArk(); + const ark = useArk(); const [loading, setLoading] = useState(false); const uploadMedia = async () => { diff --git a/src/app/chats/components/message.tsx b/src/app/chats/components/message.tsx index addf9748..da528739 100644 --- a/src/app/chats/components/message.tsx +++ b/src/app/chats/components/message.tsx @@ -1,6 +1,5 @@ import { NDKEvent } from '@nostr-dev-kit/ndk'; import { twMerge } from 'tailwind-merge'; - import { useDecryptMessage } from '@app/chats/hooks/useDecryptMessage'; export function ChatMessage({ message, isSelf }: { message: NDKEvent; isSelf: boolean }) { diff --git a/src/app/chats/hooks/useDecryptMessage.tsx b/src/app/chats/hooks/useDecryptMessage.tsx index b1320130..35fd3da8 100644 --- a/src/app/chats/hooks/useDecryptMessage.tsx +++ b/src/app/chats/hooks/useDecryptMessage.tsx @@ -1,10 +1,9 @@ import { NDKEvent } from '@nostr-dev-kit/ndk'; import { useEffect, useState } from 'react'; - import { useArk } from '@libs/ark'; export function useDecryptMessage(event: NDKEvent) { - const { ark } = useArk(); + const ark = useArk(); const [content, setContent] = useState(event.content); useEffect(() => { diff --git a/src/app/chats/index.tsx b/src/app/chats/index.tsx index 700360c8..867459ae 100644 --- a/src/app/chats/index.tsx +++ b/src/app/chats/index.tsx @@ -2,15 +2,12 @@ import { NDKEvent } from '@nostr-dev-kit/ndk'; import { useQuery } from '@tanstack/react-query'; import { useCallback } from 'react'; import { Outlet } from 'react-router-dom'; - import { ChatListItem } from '@app/chats/components/chatListItem'; - import { useArk } from '@libs/ark'; - import { LoaderIcon } from '@shared/icons'; export function ChatsScreen() { - const { ark } = useArk(); + const ark = useArk(); const { status, data } = useQuery({ queryKey: ['nip04-chats'], queryFn: async () => { diff --git a/src/app/error.tsx b/src/app/error.tsx index 0a8f6fc2..bb6d88c6 100644 --- a/src/app/error.tsx +++ b/src/app/error.tsx @@ -3,7 +3,6 @@ import { message, save } from '@tauri-apps/plugin-dialog'; import { writeTextFile } from '@tauri-apps/plugin-fs'; import { relaunch } from '@tauri-apps/plugin-process'; import { useRouteError } from 'react-router-dom'; - import { useArk } from '@libs/ark'; interface RouteError { @@ -12,7 +11,7 @@ interface RouteError { } export function ErrorScreen() { - const { ark } = useArk(); + const ark = useArk(); const error = useRouteError() as RouteError; const restart = async () => { diff --git a/src/app/home/index.tsx b/src/app/home/index.tsx index 08072a9f..630ac49a 100644 --- a/src/app/home/index.tsx +++ b/src/app/home/index.tsx @@ -1,9 +1,7 @@ import { useQuery } from '@tanstack/react-query'; import { useCallback, useRef, useState } from 'react'; import { VList, VListHandle } from 'virtua'; - import { useArk } from '@libs/ark'; - import { LoaderIcon } from '@shared/icons'; import { ArticleWidget, @@ -20,7 +18,6 @@ import { UserWidget, WidgetList, } from '@shared/widgets'; - import { WIDGET_KIND } from '@utils/constants'; import { Widget } from '@utils/types'; @@ -28,7 +25,7 @@ export function HomeScreen() { const ref = useRef(null); const [selectedIndex, setSelectedIndex] = useState(-1); - const { ark } = useArk(); + const ark = useArk(); const { status, data } = useQuery({ queryKey: ['widgets'], queryFn: async () => { diff --git a/src/app/new/article.tsx b/src/app/new/article.tsx index 47b2ef21..7549722f 100644 --- a/src/app/new/article.tsx +++ b/src/app/new/article.tsx @@ -9,11 +9,8 @@ import { useNavigate } from 'react-router-dom'; import { toast } from 'sonner'; import { twMerge } from 'tailwind-merge'; import { Markdown } from 'tiptap-markdown'; - import { ArticleCoverUploader, MediaUploader, MentionPopup } from '@app/new/components'; - import { useArk } from '@libs/ark'; - import { BoldIcon, Heading1Icon, @@ -25,7 +22,7 @@ import { } from '@shared/icons'; export function NewArticleScreen() { - const { ark } = useArk(); + const ark = useArk(); const [height, setHeight] = useState(0); const [loading, setLoading] = useState(false); diff --git a/src/app/new/components/articleCoverUploader.tsx b/src/app/new/components/articleCoverUploader.tsx index 0769a906..651024b8 100644 --- a/src/app/new/components/articleCoverUploader.tsx +++ b/src/app/new/components/articleCoverUploader.tsx @@ -1,7 +1,6 @@ import { message, open } from '@tauri-apps/plugin-dialog'; import { readBinaryFile } from '@tauri-apps/plugin-fs'; import { useState } from 'react'; - import { ImageIcon, LoaderIcon } from '@shared/icons'; export function ArticleCoverUploader({ setCover }) { diff --git a/src/app/new/components/mediaUploader.tsx b/src/app/new/components/mediaUploader.tsx index 6c0319c7..10842b0e 100644 --- a/src/app/new/components/mediaUploader.tsx +++ b/src/app/new/components/mediaUploader.tsx @@ -1,13 +1,11 @@ import { message } from '@tauri-apps/plugin-dialog'; import { Editor } from '@tiptap/react'; import { useState } from 'react'; - import { useArk } from '@libs/ark'; - import { MediaIcon } from '@shared/icons'; export function MediaUploader({ editor }: { editor: Editor }) { - const { ark } = useArk(); + const ark = useArk(); const [loading, setLoading] = useState(false); const uploadToNostrBuild = async () => { diff --git a/src/app/new/components/mentionList.tsx b/src/app/new/components/mentionList.tsx index f8e0a42a..435704e1 100644 --- a/src/app/new/components/mentionList.tsx +++ b/src/app/new/components/mentionList.tsx @@ -2,7 +2,6 @@ import * as Avatar from '@radix-ui/react-avatar'; import { minidenticon } from 'minidenticons'; import { Ref, forwardRef, useEffect, useImperativeHandle, useState } from 'react'; import { twMerge } from 'tailwind-merge'; - import { NDKCacheUserProfile } from '@utils/types'; type MentionListRef = { diff --git a/src/app/new/components/mentionPopup.tsx b/src/app/new/components/mentionPopup.tsx index c574cdb4..4398f59c 100644 --- a/src/app/new/components/mentionPopup.tsx +++ b/src/app/new/components/mentionPopup.tsx @@ -1,15 +1,12 @@ import * as Popover from '@radix-ui/react-popover'; import { Editor } from '@tiptap/react'; import { nip19 } from 'nostr-tools'; - import { MentionPopupItem } from '@app/new/components'; - import { useArk } from '@libs/ark'; - import { MentionIcon } from '@shared/icons'; export function MentionPopup({ editor }: { editor: Editor }) { - const { ark } = useArk(); + const ark = useArk(); const insertMention = (pubkey: string) => { editor.commands.insertContent(`nostr:${nip19.npubEncode(pubkey)}`); diff --git a/src/app/new/components/mentionPopupItem.tsx b/src/app/new/components/mentionPopupItem.tsx index 46645bff..ae343340 100644 --- a/src/app/new/components/mentionPopupItem.tsx +++ b/src/app/new/components/mentionPopupItem.tsx @@ -1,7 +1,6 @@ import * as Avatar from '@radix-ui/react-avatar'; import { minidenticon } from 'minidenticons'; import { useMemo } from 'react'; - import { displayNpub } from '@utils/formater'; import { useProfile } from '@utils/hooks/useProfile'; diff --git a/src/app/new/file.tsx b/src/app/new/file.tsx index d4c8cddf..f1ea2f2b 100644 --- a/src/app/new/file.tsx +++ b/src/app/new/file.tsx @@ -3,13 +3,11 @@ import { readBinaryFile } from '@tauri-apps/plugin-fs'; import { useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { toast } from 'sonner'; - import { useArk } from '@libs/ark'; - import { LoaderIcon } from '@shared/icons'; export function NewFileScreen() { - const { ark } = useArk(); + const ark = useArk(); const navigate = useNavigate(); const [loading, setLoading] = useState(false); diff --git a/src/app/new/post.tsx b/src/app/new/post.tsx index 659652c9..efb8a70a 100644 --- a/src/app/new/post.tsx +++ b/src/app/new/post.tsx @@ -10,20 +10,16 @@ import { nip19 } from 'nostr-tools'; import { useLayoutEffect, useRef, useState } from 'react'; import { useNavigate, useSearchParams } from 'react-router-dom'; import { toast } from 'sonner'; - import { MediaUploader, MentionPopup } from '@app/new/components'; - import { useArk } from '@libs/ark'; - import { CancelIcon, LoaderIcon } from '@shared/icons'; import { MentionNote } from '@shared/notes'; - import { WIDGET_KIND } from '@utils/constants'; import { useSuggestion } from '@utils/hooks/useSuggestion'; import { useWidget } from '@utils/hooks/useWidget'; export function NewPostScreen() { - const { ark } = useArk(); + const ark = useArk(); const { addWidget } = useWidget(); const { suggestion } = useSuggestion(); diff --git a/src/app/new/privkey.tsx b/src/app/new/privkey.tsx index 02afa98f..7fd23e79 100644 --- a/src/app/new/privkey.tsx +++ b/src/app/new/privkey.tsx @@ -3,11 +3,10 @@ import { getPublicKey, nip19 } from 'nostr-tools'; import { useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { toast } from 'sonner'; - import { useArk } from '@libs/ark'; export function NewPrivkeyScreen() { - const { ark } = useArk(); + const ark = useArk(); const navigate = useNavigate(); const [nsec, setNsec] = useState(''); diff --git a/src/app/notes/article.tsx b/src/app/notes/article.tsx index 912489db..1106f0ff 100644 --- a/src/app/notes/article.tsx +++ b/src/app/notes/article.tsx @@ -5,11 +5,9 @@ import { EventPointer } from 'nostr-tools/lib/types/nip19'; import { useMemo, useState } from 'react'; import { useNavigate, useParams } from 'react-router-dom'; import { toast } from 'sonner'; - import { ArrowLeftIcon, CheckCircleIcon, ShareIcon } from '@shared/icons'; import { NoteReplyForm } from '@shared/notes'; import { ReplyList } from '@shared/notes/replies/list'; - import { useEvent } from '@utils/hooks/useEvent'; export function ArticleNoteScreen() { diff --git a/src/app/notes/text.tsx b/src/app/notes/text.tsx index a1c7e744..a1dc7a0c 100644 --- a/src/app/notes/text.tsx +++ b/src/app/notes/text.tsx @@ -5,9 +5,7 @@ import { EventPointer } from 'nostr-tools/lib/types/nip19'; import { useRef, useState } from 'react'; import { useNavigate, useParams } from 'react-router-dom'; import { toast } from 'sonner'; - import { useArk } from '@libs/ark'; - import { ArrowLeftIcon, CheckCircleIcon, ReplyIcon, ShareIcon } from '@shared/icons'; import { ChildNote, @@ -18,7 +16,6 @@ import { } from '@shared/notes'; import { ReplyList } from '@shared/notes/replies/list'; import { User } from '@shared/user'; - import { useEvent } from '@utils/hooks/useEvent'; export function TextNoteScreen() { @@ -26,7 +23,7 @@ export function TextNoteScreen() { const replyRef = useRef(null); const { id } = useParams(); - const { ark } = useArk(); + const ark = useArk(); const { status, data } = useEvent(id); const [isCopy, setIsCopy] = useState(false); diff --git a/src/app/nwc/components/form.tsx b/src/app/nwc/components/form.tsx index 807968be..3f5083ce 100644 --- a/src/app/nwc/components/form.tsx +++ b/src/app/nwc/components/form.tsx @@ -1,12 +1,10 @@ import { useState } from 'react'; import { toast } from 'sonner'; - import { useArk } from '@libs/ark'; - import { LoaderIcon } from '@shared/icons'; export function NWCForm({ setWalletConnectURL }) { - const { ark } = useArk(); + const ark = useArk(); const [uri, setUri] = useState(''); const [loading, setLoading] = useState(false); diff --git a/src/app/nwc/index.tsx b/src/app/nwc/index.tsx index 9340375d..450aba51 100644 --- a/src/app/nwc/index.tsx +++ b/src/app/nwc/index.tsx @@ -1,13 +1,10 @@ import { useEffect, useState } from 'react'; - import { NWCForm } from '@app/nwc/components/form'; - import { useArk } from '@libs/ark'; - import { CheckCircleIcon } from '@shared/icons'; export function NWCScreen() { - const { ark } = useArk(); + const ark = useArk(); const [walletConnectURL, setWalletConnectURL] = useState(null); const remove = async () => { diff --git a/src/app/relays/components/relayEventList.tsx b/src/app/relays/components/relayEventList.tsx index ce60f9f3..cbd13201 100644 --- a/src/app/relays/components/relayEventList.tsx +++ b/src/app/relays/components/relayEventList.tsx @@ -2,9 +2,7 @@ import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk'; import { useInfiniteQuery } from '@tanstack/react-query'; import { useCallback, useMemo } from 'react'; import { VList } from 'virtua'; - import { useArk } from '@libs/ark'; - import { ArrowRightCircleIcon, LoaderIcon } from '@shared/icons'; import { MemoizedRepost, @@ -12,11 +10,10 @@ import { NoteSkeleton, UnknownNote, } from '@shared/notes'; - import { FETCH_LIMIT } from '@utils/constants'; export function RelayEventList({ relayUrl }: { relayUrl: string }) { - const { ark } = useArk(); + const ark = useArk(); const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } = useInfiniteQuery({ queryKey: ['relay-events', relayUrl], diff --git a/src/app/relays/components/relayForm.tsx b/src/app/relays/components/relayForm.tsx index 20d1ea50..23905dac 100644 --- a/src/app/relays/components/relayForm.tsx +++ b/src/app/relays/components/relayForm.tsx @@ -2,9 +2,7 @@ import { NDKRelayUrl } from '@nostr-dev-kit/ndk'; import { normalizeRelayUrl } from 'nostr-fetch'; import { useState } from 'react'; import { toast } from 'sonner'; - import { PlusIcon } from '@shared/icons'; - import { useRelay } from '@utils/hooks/useRelay'; const domainRegex = /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/; diff --git a/src/app/relays/components/relayList.tsx b/src/app/relays/components/relayList.tsx index 976f0e3c..67a53775 100644 --- a/src/app/relays/components/relayList.tsx +++ b/src/app/relays/components/relayList.tsx @@ -1,16 +1,13 @@ import { useQuery } from '@tanstack/react-query'; import { useNavigate } from 'react-router-dom'; import { VList } from 'virtua'; - import { useArk } from '@libs/ark'; - import { LoaderIcon, PlusIcon, ShareIcon } from '@shared/icons'; import { User } from '@shared/user'; - import { useRelay } from '@utils/hooks/useRelay'; export function RelayList() { - const { ark } = useArk(); + const ark = useArk(); const { connectRelay } = useRelay(); const { status, data } = useQuery({ queryKey: ['relays'], diff --git a/src/app/relays/components/userRelayList.tsx b/src/app/relays/components/userRelayList.tsx index 68e0ca93..b88f0c6c 100644 --- a/src/app/relays/components/userRelayList.tsx +++ b/src/app/relays/components/userRelayList.tsx @@ -1,16 +1,12 @@ import { NDKKind } from '@nostr-dev-kit/ndk'; import { useQuery } from '@tanstack/react-query'; - import { RelayForm } from '@app/relays/components/relayForm'; - import { useArk } from '@libs/ark'; - import { CancelIcon, RefreshIcon } from '@shared/icons'; - import { useRelay } from '@utils/hooks/useRelay'; export function UserRelayList() { - const { ark } = useArk(); + const ark = useArk(); const { removeRelay } = useRelay(); const { status, data, refetch } = useQuery({ queryKey: ['relays', ark.account.pubkey], diff --git a/src/app/relays/relay.tsx b/src/app/relays/relay.tsx index 91ddcdc3..eac4d180 100644 --- a/src/app/relays/relay.tsx +++ b/src/app/relays/relay.tsx @@ -1,11 +1,8 @@ import { Suspense } from 'react'; import { Await, useLoaderData, useNavigate, useParams } from 'react-router-dom'; - import { ArrowLeftIcon, LoaderIcon } from '@shared/icons'; import { User } from '@shared/user'; - import { NIP11 } from '@utils/types'; - import { RelayEventList } from './components/relayEventList'; export function RelayScreen() { diff --git a/src/app/settings/advanced.tsx b/src/app/settings/advanced.tsx index fd7100e2..7d287508 100644 --- a/src/app/settings/advanced.tsx +++ b/src/app/settings/advanced.tsx @@ -1,7 +1,7 @@ import { useArk } from '@libs/ark'; export function AdvancedSettingScreen() { - const { ark } = useArk(); + const ark = useArk(); const clearCache = async () => { await ark.clearCache(); diff --git a/src/app/settings/backup.tsx b/src/app/settings/backup.tsx index a4b9f2c8..566b35bc 100644 --- a/src/app/settings/backup.tsx +++ b/src/app/settings/backup.tsx @@ -1,12 +1,10 @@ import { nip19 } from 'nostr-tools'; import { useEffect, useState } from 'react'; - import { useArk } from '@libs/ark'; - import { EyeOffIcon } from '@shared/icons'; export function BackupSettingScreen() { - const { ark } = useArk(); + const ark = useArk(); const [privkey, setPrivkey] = useState(null); const [showPassword, setShowPassword] = useState(false); diff --git a/src/app/settings/components/contactCard.tsx b/src/app/settings/components/contactCard.tsx index 7815e426..fb25595d 100644 --- a/src/app/settings/components/contactCard.tsx +++ b/src/app/settings/components/contactCard.tsx @@ -1,14 +1,11 @@ import { useQuery } from '@tanstack/react-query'; import { Link } from 'react-router-dom'; - import { useArk } from '@libs/ark'; - import { EditIcon, LoaderIcon } from '@shared/icons'; - import { compactNumber } from '@utils/formater'; export function ContactCard() { - const { ark } = useArk(); + const ark = useArk(); const { status, data } = useQuery({ queryKey: ['contacts'], queryFn: async () => { diff --git a/src/app/settings/components/postCard.tsx b/src/app/settings/components/postCard.tsx index 2a890abb..fabfe210 100644 --- a/src/app/settings/components/postCard.tsx +++ b/src/app/settings/components/postCard.tsx @@ -1,15 +1,12 @@ import { useQuery } from '@tanstack/react-query'; import { fetch } from '@tauri-apps/plugin-http'; import { Link } from 'react-router-dom'; - import { useArk } from '@libs/ark'; - import { LoaderIcon } from '@shared/icons'; - import { compactNumber } from '@utils/formater'; export function PostCard() { - const { ark } = useArk(); + const ark = useArk(); const { status, data } = useQuery({ queryKey: ['user-stats', ark.account.pubkey], queryFn: async ({ signal }: { signal: AbortSignal }) => { diff --git a/src/app/settings/components/profileCard.tsx b/src/app/settings/components/profileCard.tsx index 5967adbf..8ba6c8c7 100644 --- a/src/app/settings/components/profileCard.tsx +++ b/src/app/settings/components/profileCard.tsx @@ -1,16 +1,13 @@ import * as Avatar from '@radix-ui/react-avatar'; import { minidenticon } from 'minidenticons'; import { Link } from 'react-router-dom'; - import { useArk } from '@libs/ark'; - import { EditIcon, LoaderIcon } from '@shared/icons'; - import { displayNpub } from '@utils/formater'; import { useProfile } from '@utils/hooks/useProfile'; export function ProfileCard() { - const { ark } = useArk(); + const ark = useArk(); const { isLoading, user } = useProfile(ark.account.pubkey); const svgURI = diff --git a/src/app/settings/components/relayCard.tsx b/src/app/settings/components/relayCard.tsx index 6a115de5..019d7a8d 100644 --- a/src/app/settings/components/relayCard.tsx +++ b/src/app/settings/components/relayCard.tsx @@ -1,14 +1,11 @@ import { useQuery } from '@tanstack/react-query'; import { Link } from 'react-router-dom'; - import { useArk } from '@libs/ark'; - import { EditIcon, LoaderIcon } from '@shared/icons'; - import { compactNumber } from '@utils/formater'; export function RelayCard() { - const { ark } = useArk(); + const ark = useArk(); const { status, data } = useQuery({ queryKey: ['relays', ark.account.pubkey], queryFn: async () => { diff --git a/src/app/settings/components/zapCard.tsx b/src/app/settings/components/zapCard.tsx index 4d5fa823..deec4985 100644 --- a/src/app/settings/components/zapCard.tsx +++ b/src/app/settings/components/zapCard.tsx @@ -1,14 +1,11 @@ import { useQuery } from '@tanstack/react-query'; import { fetch } from '@tauri-apps/plugin-http'; - import { useArk } from '@libs/ark'; - import { LoaderIcon } from '@shared/icons'; - import { compactNumber } from '@utils/formater'; export function ZapCard() { - const { ark } = useArk(); + const ark = useArk(); const { status, data } = useQuery({ queryKey: ['user-stats', ark.account.pubkey], queryFn: async ({ signal }: { signal: AbortSignal }) => { diff --git a/src/app/settings/editContact.tsx b/src/app/settings/editContact.tsx index cbc873e7..16ed045f 100644 --- a/src/app/settings/editContact.tsx +++ b/src/app/settings/editContact.tsx @@ -1,12 +1,10 @@ import { useQuery } from '@tanstack/react-query'; - import { useArk } from '@libs/ark'; - import { LoaderIcon } from '@shared/icons'; import { User } from '@shared/user'; export function EditContactScreen() { - const { ark } = useArk(); + const ark = useArk(); const { status, data } = useQuery({ queryKey: ['contacts'], queryFn: async () => { diff --git a/src/app/settings/editProfile.tsx b/src/app/settings/editProfile.tsx index 03bc3633..0f7aa963 100644 --- a/src/app/settings/editProfile.tsx +++ b/src/app/settings/editProfile.tsx @@ -4,9 +4,7 @@ import { message } from '@tauri-apps/plugin-dialog'; import { useState } from 'react'; import { useForm } from 'react-hook-form'; import { useNavigate } from 'react-router-dom'; - import { useArk } from '@libs/ark'; - import { CheckCircleIcon, LoaderIcon, PlusIcon, UnverifiedIcon } from '@shared/icons'; export function EditProfileScreen() { @@ -15,7 +13,7 @@ export function EditProfileScreen() { const [banner, setBanner] = useState(''); const [nip05, setNIP05] = useState({ verified: true, text: '' }); - const { ark } = useArk(); + const ark = useArk(); const { register, handleSubmit, diff --git a/src/app/settings/general.tsx b/src/app/settings/general.tsx index 7ae91bde..7174026c 100644 --- a/src/app/settings/general.tsx +++ b/src/app/settings/general.tsx @@ -5,13 +5,11 @@ import { disable, enable, isEnabled } from '@tauri-apps/plugin-autostart'; import { isPermissionGranted, requestPermission } from '@tauri-apps/plugin-notification'; import { useEffect, useState } from 'react'; import { twMerge } from 'tailwind-merge'; - import { useArk } from '@libs/ark'; - import { DarkIcon, LightIcon, SystemModeIcon } from '@shared/icons'; export function GeneralSettingScreen() { - const { ark } = useArk(); + const ark = useArk(); const [settings, setSettings] = useState({ autoupdate: false, autolaunch: false, diff --git a/src/app/users/components/profile.tsx b/src/app/users/components/profile.tsx index 7fb7129b..0c9c0fd8 100644 --- a/src/app/users/components/profile.tsx +++ b/src/app/users/components/profile.tsx @@ -3,18 +3,14 @@ import { minidenticon } from 'minidenticons'; import { useEffect, useState } from 'react'; import { Link, useNavigate } from 'react-router-dom'; import { toast } from 'sonner'; - import { UserStats } from '@app/users/components/stats'; - import { useArk } from '@libs/ark'; - import { NIP05 } from '@shared/nip05'; - import { displayNpub } from '@utils/formater'; import { useProfile } from '@utils/hooks/useProfile'; export function UserProfile({ pubkey }: { pubkey: string }) { - const { ark } = useArk(); + const ark = useArk(); const { user } = useProfile(pubkey); const [followed, setFollowed] = useState(false); diff --git a/src/app/users/components/stats.tsx b/src/app/users/components/stats.tsx index a9ceacd1..55cb414d 100644 --- a/src/app/users/components/stats.tsx +++ b/src/app/users/components/stats.tsx @@ -1,8 +1,6 @@ import { useQuery } from '@tanstack/react-query'; import { fetch } from '@tauri-apps/plugin-http'; - import { LoaderIcon } from '@shared/icons'; - import { compactNumber } from '@utils/formater'; export function UserStats({ pubkey }: { pubkey: string }) { diff --git a/src/app/users/index.tsx b/src/app/users/index.tsx index 491edd76..dec44863 100644 --- a/src/app/users/index.tsx +++ b/src/app/users/index.tsx @@ -2,11 +2,8 @@ import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk'; import { useInfiniteQuery } from '@tanstack/react-query'; import { useCallback, useMemo } from 'react'; import { useParams } from 'react-router-dom'; - import { UserProfile } from '@app/users/components/profile'; - import { useArk } from '@libs/ark'; - import { ArrowRightCircleIcon, LoaderIcon } from '@shared/icons'; import { MemoizedRepost, @@ -14,12 +11,11 @@ import { NoteSkeleton, UnknownNote, } from '@shared/notes'; - import { FETCH_LIMIT } from '@utils/constants'; export function UserScreen() { const { pubkey } = useParams(); - const { ark } = useArk(); + const ark = useArk(); const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } = useInfiniteQuery({ queryKey: ['user-posts', pubkey], diff --git a/src/libs/ark/ark.ts b/src/libs/ark/ark.ts index 456f8771..689ce8c8 100644 --- a/src/libs/ark/ark.ts +++ b/src/libs/ark/ark.ts @@ -23,9 +23,7 @@ import { normalizeRelayUrlSet, } from 'nostr-fetch'; import { toast } from 'sonner'; - import { NDKCacheAdapterTauri } from '@libs/ark'; - import { Account, NDKCacheUser, diff --git a/src/libs/ark/cache.ts b/src/libs/ark/cache.ts index e563e7ba..39fed584 100644 --- a/src/libs/ark/cache.ts +++ b/src/libs/ark/cache.ts @@ -14,7 +14,6 @@ import Database from '@tauri-apps/plugin-sql'; import { LRUCache } from 'lru-cache'; import { NostrEvent } from 'nostr-fetch'; import { matchFilter } from 'nostr-tools'; - import { NDKCacheEvent, NDKCacheEventTag, NDKCacheUser } from '@utils/types'; export class NDKCacheAdapterTauri implements NDKCacheAdapter { diff --git a/src/libs/ark/provider.tsx b/src/libs/ark/provider.tsx index 8e3798cd..087a2b7a 100644 --- a/src/libs/ark/provider.tsx +++ b/src/libs/ark/provider.tsx @@ -7,20 +7,11 @@ import Database from '@tauri-apps/plugin-sql'; import { check } from '@tauri-apps/plugin-updater'; import Markdown from 'markdown-to-jsx'; import { PropsWithChildren, createContext, useContext, useEffect, useState } from 'react'; - import { Ark } from '@libs/ark'; - import { LoaderIcon } from '@shared/icons'; - import { FETCH_LIMIT, QUOTES } from '@utils/constants'; -interface ArkContext { - ark: Ark; -} - -const ArkContext = createContext({ - ark: undefined, -}); +const ArkContext = createContext(undefined); const ArkProvider = ({ children }: PropsWithChildren) => { const [ark, setArk] = useState(undefined); @@ -165,7 +156,7 @@ const ArkProvider = ({ children }: PropsWithChildren) => { ); } - return {children}; + return {children}; }; const useArk = () => { diff --git a/src/main.jsx b/src/main.jsx index 1dc6099d..44801326 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -2,9 +2,7 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; import { createRoot } from 'react-dom/client'; import { Toaster } from 'sonner'; - import { ArkProvider } from '@libs/ark/provider'; - import App from './app'; const queryClient = new QueryClient({ diff --git a/src/shared/accounts/active.tsx b/src/shared/accounts/active.tsx index 55c3d446..0833b25a 100644 --- a/src/shared/accounts/active.tsx +++ b/src/shared/accounts/active.tsx @@ -2,16 +2,13 @@ import * as Avatar from '@radix-ui/react-avatar'; import { minidenticon } from 'minidenticons'; import { Link } from 'react-router-dom'; import { twMerge } from 'tailwind-merge'; - import { useArk } from '@libs/ark'; - import { AccountMoreActions } from '@shared/accounts/more'; - import { useNetworkStatus } from '@utils/hooks/useNetworkStatus'; import { useProfile } from '@utils/hooks/useProfile'; export function ActiveAccount() { - const { ark } = useArk(); + const ark = useArk(); const { user } = useProfile(ark.account.pubkey); const isOnline = useNetworkStatus(); diff --git a/src/shared/accounts/logout.tsx b/src/shared/accounts/logout.tsx index 9edd3d2e..e7637c0f 100644 --- a/src/shared/accounts/logout.tsx +++ b/src/shared/accounts/logout.tsx @@ -2,11 +2,10 @@ import * as AlertDialog from '@radix-ui/react-alert-dialog'; import { useQueryClient } from '@tanstack/react-query'; import { useNavigate } from 'react-router-dom'; import { toast } from 'sonner'; - import { useArk } from '@libs/ark'; export function Logout() { - const { ark } = useArk(); + const ark = useArk(); const navigate = useNavigate(); const queryClient = useQueryClient(); diff --git a/src/shared/accounts/more.tsx b/src/shared/accounts/more.tsx index f83c2621..08177369 100644 --- a/src/shared/accounts/more.tsx +++ b/src/shared/accounts/more.tsx @@ -1,6 +1,5 @@ import * as DropdownMenu from '@radix-ui/react-dropdown-menu'; import { Link } from 'react-router-dom'; - import { Logout } from '@shared/accounts/logout'; import { HorizontalDotsIcon } from '@shared/icons'; diff --git a/src/shared/layouts/app.tsx b/src/shared/layouts/app.tsx index 62de62ae..669a8f20 100644 --- a/src/shared/layouts/app.tsx +++ b/src/shared/layouts/app.tsx @@ -1,13 +1,11 @@ import { Outlet, ScrollRestoration } from 'react-router-dom'; import { twMerge } from 'tailwind-merge'; - import { useArk } from '@libs/ark'; - import { Navigation } from '@shared/navigation'; import { WindowTitleBar } from '@shared/titlebar'; export function AppLayout() { - const { ark } = useArk(); + const ark = useArk(); return (
diff --git a/src/shared/layouts/new.tsx b/src/shared/layouts/new.tsx index 4a13a790..e8738896 100644 --- a/src/shared/layouts/new.tsx +++ b/src/shared/layouts/new.tsx @@ -1,13 +1,11 @@ import { Link, NavLink, Outlet, useLocation } from 'react-router-dom'; import { twMerge } from 'tailwind-merge'; - import { useArk } from '@libs/ark'; - import { ArrowLeftIcon } from '@shared/icons'; import { WindowTitleBar } from '@shared/titlebar'; export function NewLayout() { - const { ark } = useArk(); + const ark = useArk(); const location = useLocation(); return ( diff --git a/src/shared/layouts/note.tsx b/src/shared/layouts/note.tsx index 5eb96e67..a056ab11 100644 --- a/src/shared/layouts/note.tsx +++ b/src/shared/layouts/note.tsx @@ -1,11 +1,9 @@ import { Outlet, ScrollRestoration } from 'react-router-dom'; - import { useArk } from '@libs/ark'; - import { WindowTitleBar } from '@shared/titlebar'; export function NoteLayout() { - const { ark } = useArk(); + const ark = useArk(); return (
diff --git a/src/shared/layouts/settings.tsx b/src/shared/layouts/settings.tsx index d9f88be5..eca98c4b 100644 --- a/src/shared/layouts/settings.tsx +++ b/src/shared/layouts/settings.tsx @@ -1,8 +1,6 @@ import { NavLink, Outlet, ScrollRestoration, useNavigate } from 'react-router-dom'; import { twMerge } from 'tailwind-merge'; - import { useArk } from '@libs/ark'; - import { AdvancedSettingsIcon, ArrowLeftIcon, @@ -14,7 +12,7 @@ import { import { WindowTitleBar } from '@shared/titlebar'; export function SettingsLayout() { - const { ark } = useArk(); + const ark = useArk(); const navigate = useNavigate(); return ( diff --git a/src/shared/navigation.tsx b/src/shared/navigation.tsx index 19ec9e30..48f9a5ae 100644 --- a/src/shared/navigation.tsx +++ b/src/shared/navigation.tsx @@ -1,9 +1,7 @@ import { Link, NavLink } from 'react-router-dom'; import { twMerge } from 'tailwind-merge'; - import { ActiveAccount } from '@shared/accounts/active'; import { ChatsIcon, ComposeIcon, HomeIcon, NwcIcon, RelayIcon } from '@shared/icons'; - import { compactNumber } from '@utils/formater'; export function Navigation() { diff --git a/src/shared/nip05.tsx b/src/shared/nip05.tsx index 4e5ea6dc..d04ba07d 100644 --- a/src/shared/nip05.tsx +++ b/src/shared/nip05.tsx @@ -2,7 +2,6 @@ import { useQuery } from '@tanstack/react-query'; import { fetch } from '@tauri-apps/plugin-http'; import { memo } from 'react'; import { twMerge } from 'tailwind-merge'; - import { UnverifiedIcon, VerifiedIcon } from '@shared/icons'; interface NIP05 { diff --git a/src/shared/notes/actions.tsx b/src/shared/notes/actions.tsx index 120e9e92..7f44cc8f 100644 --- a/src/shared/notes/actions.tsx +++ b/src/shared/notes/actions.tsx @@ -1,12 +1,10 @@ import { NDKEvent } from '@nostr-dev-kit/ndk'; import * as Tooltip from '@radix-ui/react-tooltip'; import { createSearchParams, useNavigate } from 'react-router-dom'; - import { FocusIcon, ReplyIcon } from '@shared/icons'; import { NoteReaction } from '@shared/notes/actions/reaction'; import { NoteRepost } from '@shared/notes/actions/repost'; import { NoteZap } from '@shared/notes/actions/zap'; - import { WIDGET_KIND } from '@utils/constants'; import { useWidget } from '@utils/hooks/useWidget'; diff --git a/src/shared/notes/actions/more.tsx b/src/shared/notes/actions/more.tsx index d2f4d9e9..c3e7fa23 100644 --- a/src/shared/notes/actions/more.tsx +++ b/src/shared/notes/actions/more.tsx @@ -4,7 +4,6 @@ import { nip19 } from 'nostr-tools'; import { EventPointer } from 'nostr-tools/lib/types/nip19'; import { useState } from 'react'; import { Link } from 'react-router-dom'; - import { HorizontalDotsIcon } from '@shared/icons'; export function MoreActions({ id, pubkey }: { id: string; pubkey: string }) { diff --git a/src/shared/notes/actions/reaction.tsx b/src/shared/notes/actions/reaction.tsx index e7395c78..ed6f2e1b 100644 --- a/src/shared/notes/actions/reaction.tsx +++ b/src/shared/notes/actions/reaction.tsx @@ -3,9 +3,7 @@ import * as Popover from '@radix-ui/react-popover'; import { useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { toast } from 'sonner'; - import { useArk } from '@libs/ark'; - import { ReactionIcon } from '@shared/icons'; const REACTIONS = [ @@ -35,7 +33,7 @@ export function NoteReaction({ event }: { event: NDKEvent }) { const [open, setOpen] = useState(false); const [reaction, setReaction] = useState(null); - const { ark } = useArk(); + const ark = useArk(); const navigate = useNavigate(); const getReactionImage = (content: string) => { diff --git a/src/shared/notes/actions/repost.tsx b/src/shared/notes/actions/repost.tsx index d6a98324..9494a405 100644 --- a/src/shared/notes/actions/repost.tsx +++ b/src/shared/notes/actions/repost.tsx @@ -5,9 +5,7 @@ import { useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { toast } from 'sonner'; import { twMerge } from 'tailwind-merge'; - import { useArk } from '@libs/ark'; - import { LoaderIcon, RepostIcon } from '@shared/icons'; export function NoteRepost({ event }: { event: NDKEvent }) { @@ -15,7 +13,7 @@ export function NoteRepost({ event }: { event: NDKEvent }) { const [isLoading, setIsLoading] = useState(false); const [isRepost, setIsRepost] = useState(false); - const { ark } = useArk(); + const ark = useArk(); const navigate = useNavigate(); const submit = async () => { diff --git a/src/shared/notes/actions/zap.tsx b/src/shared/notes/actions/zap.tsx index fe5fb0bb..db241f48 100644 --- a/src/shared/notes/actions/zap.tsx +++ b/src/shared/notes/actions/zap.tsx @@ -8,17 +8,14 @@ import { QRCodeSVG } from 'qrcode.react'; import { useEffect, useRef, useState } from 'react'; import CurrencyInput from 'react-currency-input-field'; import { useNavigate } from 'react-router-dom'; - import { useArk } from '@libs/ark'; - import { CancelIcon, ZapIcon } from '@shared/icons'; - import { compactNumber, displayNpub } from '@utils/formater'; import { useProfile } from '@utils/hooks/useProfile'; import { sendNativeNotification } from '@utils/notification'; export function NoteZap({ event }: { event: NDKEvent }) { - const { ark } = useArk(); + const ark = useArk(); const { user } = useProfile(event.pubkey); const [walletConnectURL, setWalletConnectURL] = useState(null); diff --git a/src/shared/notes/article.tsx b/src/shared/notes/article.tsx index 40d84520..c3a97572 100644 --- a/src/shared/notes/article.tsx +++ b/src/shared/notes/article.tsx @@ -1,9 +1,7 @@ import { NDKEvent } from '@nostr-dev-kit/ndk'; import { memo } from 'react'; import { Link } from 'react-router-dom'; - import { User } from '@shared/user'; - import { NoteActions } from './actions'; export function ArticleNote({ event }: { event: NDKEvent }) { diff --git a/src/shared/notes/child.tsx b/src/shared/notes/child.tsx index 40c79974..94098625 100644 --- a/src/shared/notes/child.tsx +++ b/src/shared/notes/child.tsx @@ -1,6 +1,5 @@ import { NoteSkeleton } from '@shared/notes'; import { User } from '@shared/user'; - import { useEvent } from '@utils/hooks/useEvent'; export function ChildNote({ id, isRoot }: { id: string; isRoot?: boolean }) { diff --git a/src/shared/notes/file.tsx b/src/shared/notes/file.tsx index 96ff30fa..11452d07 100644 --- a/src/shared/notes/file.tsx +++ b/src/shared/notes/file.tsx @@ -8,11 +8,9 @@ import { } from '@vidstack/react/player/layouts/default'; import { memo } from 'react'; import { Link } from 'react-router-dom'; - import { DownloadIcon } from '@shared/icons'; import { NoteActions } from '@shared/notes'; import { User } from '@shared/user'; - import { fileType } from '@utils/nip94'; export function FileNote({ event }: { event: NDKEvent }) { diff --git a/src/shared/notes/kinds/file.tsx b/src/shared/notes/kinds/file.tsx index 97683a70..e49fb9e0 100644 --- a/src/shared/notes/kinds/file.tsx +++ b/src/shared/notes/kinds/file.tsx @@ -8,9 +8,7 @@ import { } from '@vidstack/react/player/layouts/default'; import { memo } from 'react'; import { Link } from 'react-router-dom'; - import { DownloadIcon } from '@shared/icons'; - import { fileType } from '@utils/nip94'; export function FileKind({ tags }: { tags: NDKTag[] }) { diff --git a/src/shared/notes/kinds/text.tsx b/src/shared/notes/kinds/text.tsx index 16719167..e2448c18 100644 --- a/src/shared/notes/kinds/text.tsx +++ b/src/shared/notes/kinds/text.tsx @@ -1,5 +1,4 @@ import { memo } from 'react'; - import { useRichContent } from '@utils/hooks/useRichContent'; export function TextKind({ content, textmode }: { content: string; textmode?: boolean }) { diff --git a/src/shared/notes/mentions/note.tsx b/src/shared/notes/mentions/note.tsx index f97cea61..5ee3febe 100644 --- a/src/shared/notes/mentions/note.tsx +++ b/src/shared/notes/mentions/note.tsx @@ -1,6 +1,5 @@ import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk'; import { memo } from 'react'; - import { MemoizedArticleKind, MemoizedFileKind, @@ -8,7 +7,6 @@ import { NoteSkeleton, } from '@shared/notes'; import { User } from '@shared/user'; - import { WIDGET_KIND } from '@utils/constants'; import { useEvent } from '@utils/hooks/useEvent'; import { useWidget } from '@utils/hooks/useWidget'; diff --git a/src/shared/notes/mentions/user.tsx b/src/shared/notes/mentions/user.tsx index cc1df7d9..6aee06fb 100644 --- a/src/shared/notes/mentions/user.tsx +++ b/src/shared/notes/mentions/user.tsx @@ -1,5 +1,4 @@ import { memo } from 'react'; - import { WIDGET_KIND } from '@utils/constants'; import { useProfile } from '@utils/hooks/useProfile'; import { useWidget } from '@utils/hooks/useWidget'; diff --git a/src/shared/notes/notify.tsx b/src/shared/notes/notify.tsx index 53d4964a..26b169f6 100644 --- a/src/shared/notes/notify.tsx +++ b/src/shared/notes/notify.tsx @@ -1,18 +1,15 @@ import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk'; import { memo } from 'react'; - import { useArk } from '@libs/ark'; - import { ReplyIcon, RepostIcon } from '@shared/icons'; import { ChildNote, TextKind } from '@shared/notes'; import { User } from '@shared/user'; - import { WIDGET_KIND } from '@utils/constants'; import { formatCreatedAt } from '@utils/formater'; import { useWidget } from '@utils/hooks/useWidget'; export function NotifyNote({ event }: { event: NDKEvent }) { - const { ark } = useArk(); + const ark = useArk(); const { addWidget } = useWidget(); const thread = ark.getEventThread({ tags: event.tags }); diff --git a/src/shared/notes/preview/image.tsx b/src/shared/notes/preview/image.tsx index 1529910b..c8d29db5 100644 --- a/src/shared/notes/preview/image.tsx +++ b/src/shared/notes/preview/image.tsx @@ -2,7 +2,6 @@ import { downloadDir } from '@tauri-apps/api/path'; import { Window } from '@tauri-apps/api/window'; import { download } from '@tauri-apps/plugin-upload'; import { SyntheticEvent, useState } from 'react'; - import { CheckCircleIcon, DownloadIcon } from '@shared/icons'; export function ImagePreview({ url }: { url: string }) { diff --git a/src/shared/notes/preview/link.tsx b/src/shared/notes/preview/link.tsx index 1d7a5296..042689ee 100644 --- a/src/shared/notes/preview/link.tsx +++ b/src/shared/notes/preview/link.tsx @@ -1,5 +1,4 @@ import { Link } from 'react-router-dom'; - import { useOpenGraph } from '@utils/hooks/useOpenGraph'; function isImage(url: string) { diff --git a/src/shared/notes/replies/form.tsx b/src/shared/notes/replies/form.tsx index 6b2fa9e8..7c4ef8a7 100644 --- a/src/shared/notes/replies/form.tsx +++ b/src/shared/notes/replies/form.tsx @@ -2,14 +2,12 @@ import { NDKEvent } from '@nostr-dev-kit/ndk'; import { useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { toast } from 'sonner'; - import { useArk } from '@libs/ark'; - import { LoaderIcon } from '@shared/icons'; import { ReplyMediaUploader } from '@shared/notes'; export function NoteReplyForm({ rootEvent }: { rootEvent: NDKEvent }) { - const { ark } = useArk(); + const ark = useArk(); const navigate = useNavigate(); const [value, setValue] = useState(''); diff --git a/src/shared/notes/replies/item.tsx b/src/shared/notes/replies/item.tsx index 93c69794..a1079c0a 100644 --- a/src/shared/notes/replies/item.tsx +++ b/src/shared/notes/replies/item.tsx @@ -1,11 +1,9 @@ import * as Collapsible from '@radix-ui/react-collapsible'; import { useState } from 'react'; import { twMerge } from 'tailwind-merge'; - import { NavArrowDownIcon } from '@shared/icons'; import { MemoizedTextKind, NoteActions, SubReply } from '@shared/notes'; import { User } from '@shared/user'; - import { NDKEventWithReplies } from '@utils/types'; export function Reply({ diff --git a/src/shared/notes/replies/list.tsx b/src/shared/notes/replies/list.tsx index 610d70f9..edf6d329 100644 --- a/src/shared/notes/replies/list.tsx +++ b/src/shared/notes/replies/list.tsx @@ -1,15 +1,12 @@ import { NDKSubscription } from '@nostr-dev-kit/ndk'; import { useEffect, useState } from 'react'; - import { useArk } from '@libs/ark'; - import { LoaderIcon } from '@shared/icons'; import { Reply } from '@shared/notes'; - import { NDKEventWithReplies } from '@utils/types'; export function ReplyList({ eventId }: { eventId: string }) { - const { ark } = useArk(); + const ark = useArk(); const [data, setData] = useState(null); useEffect(() => { diff --git a/src/shared/notes/replies/replyMediaUploader.tsx b/src/shared/notes/replies/replyMediaUploader.tsx index ff956a30..5b330094 100644 --- a/src/shared/notes/replies/replyMediaUploader.tsx +++ b/src/shared/notes/replies/replyMediaUploader.tsx @@ -1,7 +1,6 @@ import { message, open } from '@tauri-apps/plugin-dialog'; import { readBinaryFile } from '@tauri-apps/plugin-fs'; import { useState } from 'react'; - import { MediaIcon } from '@shared/icons'; export function ReplyMediaUploader({ setValue }) { diff --git a/src/shared/notes/replies/sub.tsx b/src/shared/notes/replies/sub.tsx index 6b08add5..46e726df 100644 --- a/src/shared/notes/replies/sub.tsx +++ b/src/shared/notes/replies/sub.tsx @@ -1,5 +1,4 @@ import { NDKEvent } from '@nostr-dev-kit/ndk'; - import { MemoizedTextKind, NoteActions } from '@shared/notes'; import { User } from '@shared/user'; diff --git a/src/shared/notes/repost.tsx b/src/shared/notes/repost.tsx index f8d24907..358358a8 100644 --- a/src/shared/notes/repost.tsx +++ b/src/shared/notes/repost.tsx @@ -1,9 +1,7 @@ import { NDKEvent, NDKKind, NostrEvent } from '@nostr-dev-kit/ndk'; import { useQuery } from '@tanstack/react-query'; import { memo } from 'react'; - import { useArk } from '@libs/ark'; - import { MemoizedArticleKind, MemoizedFileKind, @@ -14,7 +12,7 @@ import { import { User } from '@shared/user'; export function Repost({ event }: { event: NDKEvent }) { - const { ark } = useArk(); + const ark = useArk(); const { isLoading, isError, diff --git a/src/shared/notes/text.tsx b/src/shared/notes/text.tsx index d9b318fd..007cc336 100644 --- a/src/shared/notes/text.tsx +++ b/src/shared/notes/text.tsx @@ -1,12 +1,9 @@ import { NDKEvent } from '@nostr-dev-kit/ndk'; import { memo } from 'react'; import { twMerge } from 'tailwind-merge'; - import { useArk } from '@libs/ark'; - import { ChildNote, NoteActions } from '@shared/notes'; import { User } from '@shared/user'; - import { WIDGET_KIND } from '@utils/constants'; import { useRichContent } from '@utils/hooks/useRichContent'; import { useWidget } from '@utils/hooks/useWidget'; @@ -14,7 +11,7 @@ import { useWidget } from '@utils/hooks/useWidget'; export function TextNote({ event, className }: { event: NDKEvent; className?: string }) { const { parsedContent } = useRichContent(event.content); const { addWidget } = useWidget(); - const { ark } = useArk(); + const ark = useArk(); const thread = ark.getEventThread({ tags: event.tags }); diff --git a/src/shared/notes/unknown.tsx b/src/shared/notes/unknown.tsx index 5eb15a7f..6a1ee282 100644 --- a/src/shared/notes/unknown.tsx +++ b/src/shared/notes/unknown.tsx @@ -1,5 +1,4 @@ import { NDKEvent } from '@nostr-dev-kit/ndk'; - import { NoteActions } from '@shared/notes'; import { User } from '@shared/user'; diff --git a/src/shared/titlebar/controls/gnome.tsx b/src/shared/titlebar/controls/gnome.tsx index b991514a..0521378a 100644 --- a/src/shared/titlebar/controls/gnome.tsx +++ b/src/shared/titlebar/controls/gnome.tsx @@ -1,6 +1,5 @@ import { HTMLProps, useContext } from 'react'; import { twMerge } from 'tailwind-merge'; - import { AppWindowContext, WindowButton, WindowIcons } from '@shared/titlebar'; export function Gnome({ className, ...props }: HTMLProps) { diff --git a/src/shared/titlebar/controls/macos.tsx b/src/shared/titlebar/controls/macos.tsx index 933f45af..dbe0e9c5 100644 --- a/src/shared/titlebar/controls/macos.tsx +++ b/src/shared/titlebar/controls/macos.tsx @@ -1,6 +1,5 @@ import { HTMLProps, useContext, useEffect, useState } from 'react'; import { twMerge } from 'tailwind-merge'; - import { AppWindowContext, WindowButton, WindowIcons } from '@shared/titlebar'; export function MacOS({ className, ...props }: HTMLProps) { diff --git a/src/shared/titlebar/controls/windows.tsx b/src/shared/titlebar/controls/windows.tsx index 5d004f0d..9d747baa 100644 --- a/src/shared/titlebar/controls/windows.tsx +++ b/src/shared/titlebar/controls/windows.tsx @@ -1,6 +1,5 @@ import { HTMLProps, useContext } from 'react'; import { twMerge } from 'tailwind-merge'; - import { AppWindowContext, WindowButton, WindowIcons } from '@shared/titlebar'; export function Windows({ className, ...props }: HTMLProps) { diff --git a/src/shared/titlebar/titleBar.tsx b/src/shared/titlebar/titleBar.tsx index 6af6be53..e1d42180 100644 --- a/src/shared/titlebar/titleBar.tsx +++ b/src/shared/titlebar/titleBar.tsx @@ -1,5 +1,4 @@ import { Platform } from '@tauri-apps/plugin-os'; - import { AppWindowProvider, Gnome, MacOS, Windows } from '@shared/titlebar'; export function WindowTitleBar({ platform }: { platform: Platform }) { diff --git a/src/shared/user.tsx b/src/shared/user.tsx index 8f6ea016..1e4f32a6 100644 --- a/src/shared/user.tsx +++ b/src/shared/user.tsx @@ -3,11 +3,9 @@ import * as HoverCard from '@radix-ui/react-hover-card'; import { minidenticon } from 'minidenticons'; import { memo, useMemo } from 'react'; import { Link } from 'react-router-dom'; - import { RepostIcon } from '@shared/icons'; import { NIP05 } from '@shared/nip05'; import { MoreActions } from '@shared/notes'; - import { displayNpub, formatCreatedAt } from '@utils/formater'; import { useProfile } from '@utils/hooks/useProfile'; diff --git a/src/shared/widgets/article.tsx b/src/shared/widgets/article.tsx index 6132291c..1bb2eebb 100644 --- a/src/shared/widgets/article.tsx +++ b/src/shared/widgets/article.tsx @@ -3,18 +3,15 @@ import { useInfiniteQuery } from '@tanstack/react-query'; import { FetchFilter } from 'nostr-fetch'; import { useMemo } from 'react'; import { VList } from 'virtua'; - import { useArk } from '@libs/ark'; - import { ArrowRightCircleIcon, LoaderIcon } from '@shared/icons'; import { MemoizedArticleNote } from '@shared/notes'; import { TitleBar, WidgetWrapper } from '@shared/widgets'; - import { FETCH_LIMIT } from '@utils/constants'; import { Widget } from '@utils/types'; export function ArticleWidget({ widget }: { widget: Widget }) { - const { ark } = useArk(); + const ark = useArk(); const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } = useInfiniteQuery({ queryKey: ['article', widget.id], diff --git a/src/shared/widgets/file.tsx b/src/shared/widgets/file.tsx index aa5d48d9..9f5fd5fd 100644 --- a/src/shared/widgets/file.tsx +++ b/src/shared/widgets/file.tsx @@ -2,18 +2,15 @@ import { useInfiniteQuery } from '@tanstack/react-query'; import { FetchFilter } from 'nostr-fetch'; import { useMemo } from 'react'; import { VList } from 'virtua'; - import { useArk } from '@libs/ark'; - import { ArrowRightCircleIcon, LoaderIcon } from '@shared/icons'; import { MemoizedFileNote } from '@shared/notes'; import { TitleBar, WidgetWrapper } from '@shared/widgets'; - import { FETCH_LIMIT } from '@utils/constants'; import { Widget } from '@utils/types'; export function FileWidget({ widget }: { widget: Widget }) { - const { ark } = useArk(); + const ark = useArk(); const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } = useInfiniteQuery({ queryKey: ['media', widget.id], diff --git a/src/shared/widgets/group.tsx b/src/shared/widgets/group.tsx index e2975643..7a73ec84 100644 --- a/src/shared/widgets/group.tsx +++ b/src/shared/widgets/group.tsx @@ -2,9 +2,7 @@ import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk'; import { useInfiniteQuery } from '@tanstack/react-query'; import { useCallback, useMemo } from 'react'; import { VList } from 'virtua'; - import { useArk } from '@libs/ark'; - import { ArrowRightCircleIcon, LoaderIcon } from '@shared/icons'; import { MemoizedRepost, @@ -13,12 +11,11 @@ import { UnknownNote, } from '@shared/notes'; import { TitleBar, WidgetWrapper } from '@shared/widgets'; - import { FETCH_LIMIT } from '@utils/constants'; import { Widget } from '@utils/types'; export function GroupWidget({ widget }: { widget: Widget }) { - const { ark } = useArk(); + const ark = useArk(); const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } = useInfiniteQuery({ queryKey: ['groupfeeds', widget.id], diff --git a/src/shared/widgets/hashtag.tsx b/src/shared/widgets/hashtag.tsx index f4245595..4b64ddb3 100644 --- a/src/shared/widgets/hashtag.tsx +++ b/src/shared/widgets/hashtag.tsx @@ -2,18 +2,15 @@ import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk'; import { useInfiniteQuery } from '@tanstack/react-query'; import { useCallback, useMemo } from 'react'; import { VList } from 'virtua'; - import { useArk } from '@libs/ark'; - import { ArrowRightCircleIcon, LoaderIcon } from '@shared/icons'; import { MemoizedRepost, MemoizedTextNote, UnknownNote } from '@shared/notes'; import { TitleBar, WidgetWrapper } from '@shared/widgets'; - import { FETCH_LIMIT } from '@utils/constants'; import { Widget } from '@utils/types'; export function HashtagWidget({ widget }: { widget: Widget }) { - const { ark } = useArk(); + const ark = useArk(); const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } = useInfiniteQuery({ queryKey: ['hashtag', widget.id], diff --git a/src/shared/widgets/newsfeed.tsx b/src/shared/widgets/newsfeed.tsx index 53e67d9c..e63fb6e0 100644 --- a/src/shared/widgets/newsfeed.tsx +++ b/src/shared/widgets/newsfeed.tsx @@ -2,9 +2,7 @@ import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk'; import { useInfiniteQuery } from '@tanstack/react-query'; import { useCallback, useMemo, useRef } from 'react'; import { VList, VListHandle } from 'virtua'; - import { useArk } from '@libs/ark'; - import { ArrowRightCircleIcon, LoaderIcon } from '@shared/icons'; import { MemoizedRepost, @@ -13,11 +11,10 @@ import { UnknownNote, } from '@shared/notes'; import { LiveUpdater, TitleBar, WidgetWrapper } from '@shared/widgets'; - import { FETCH_LIMIT } from '@utils/constants'; export function NewsfeedWidget() { - const { ark } = useArk(); + const ark = useArk(); const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } = useInfiniteQuery({ queryKey: ['newsfeed'], diff --git a/src/shared/widgets/nostrBand/trendingAccounts.tsx b/src/shared/widgets/nostrBand/trendingAccounts.tsx index 93e39278..666accb9 100644 --- a/src/shared/widgets/nostrBand/trendingAccounts.tsx +++ b/src/shared/widgets/nostrBand/trendingAccounts.tsx @@ -1,6 +1,5 @@ import { useQuery } from '@tanstack/react-query'; import { VList } from 'virtua'; - import { LoaderIcon } from '@shared/icons'; import { NostrBandUserProfile, @@ -8,7 +7,6 @@ import { TitleBar, WidgetWrapper, } from '@shared/widgets'; - import { Widget } from '@utils/types'; interface Response { diff --git a/src/shared/widgets/nostrBand/trendingNotes.tsx b/src/shared/widgets/nostrBand/trendingNotes.tsx index 8d171aba..169b4b9b 100644 --- a/src/shared/widgets/nostrBand/trendingNotes.tsx +++ b/src/shared/widgets/nostrBand/trendingNotes.tsx @@ -1,11 +1,9 @@ import { NDKEvent } from '@nostr-dev-kit/ndk'; import { useQuery } from '@tanstack/react-query'; import { VList } from 'virtua'; - import { LoaderIcon } from '@shared/icons'; import { MemoizedTextNote } from '@shared/notes'; import { TitleBar, WidgetWrapper } from '@shared/widgets'; - import { Widget } from '@utils/types'; interface Response { diff --git a/src/shared/widgets/notification.tsx b/src/shared/widgets/notification.tsx index 60957b0a..5831ebe5 100644 --- a/src/shared/widgets/notification.tsx +++ b/src/shared/widgets/notification.tsx @@ -2,20 +2,17 @@ import { NDKEvent, NDKKind, NDKSubscription } from '@nostr-dev-kit/ndk'; import { useInfiniteQuery, useQueryClient } from '@tanstack/react-query'; import { useCallback, useEffect, useMemo } from 'react'; import { VList } from 'virtua'; - import { useArk } from '@libs/ark'; - import { ArrowRightCircleIcon, LoaderIcon } from '@shared/icons'; import { MemoizedNotifyNote, NoteSkeleton } from '@shared/notes'; import { TitleBar, WidgetWrapper } from '@shared/widgets'; - import { FETCH_LIMIT } from '@utils/constants'; import { sendNativeNotification } from '@utils/notification'; export function NotificationWidget() { const queryClient = useQueryClient(); - const { ark } = useArk(); + const ark = useArk(); const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } = useInfiniteQuery({ queryKey: ['notification'], diff --git a/src/shared/widgets/other/addGroupFeeds.tsx b/src/shared/widgets/other/addGroupFeeds.tsx index 6713e441..e7bfc315 100644 --- a/src/shared/widgets/other/addGroupFeeds.tsx +++ b/src/shared/widgets/other/addGroupFeeds.tsx @@ -1,8 +1,6 @@ import * as Dialog from '@radix-ui/react-dialog'; import { useState } from 'react'; - import { useArk } from '@libs/ark'; - import { ArrowRightCircleIcon, CancelIcon, @@ -11,12 +9,11 @@ import { PlusIcon, } from '@shared/icons'; import { User } from '@shared/user'; - import { WIDGET_KIND } from '@utils/constants'; import { useWidget } from '@utils/hooks/useWidget'; export function AddGroupFeeds({ currentWidgetId }: { currentWidgetId: string }) { - const { ark } = useArk(); + const ark = useArk(); const { replaceWidget } = useWidget(); const [title, setTitle] = useState(''); diff --git a/src/shared/widgets/other/addHashtagFeeds.tsx b/src/shared/widgets/other/addHashtagFeeds.tsx index d9b5e1b5..b82be60f 100644 --- a/src/shared/widgets/other/addHashtagFeeds.tsx +++ b/src/shared/widgets/other/addHashtagFeeds.tsx @@ -1,8 +1,6 @@ import * as Dialog from '@radix-ui/react-dialog'; import { Resolver, useForm } from 'react-hook-form'; - import { CancelIcon, GroupFeedsIcon, PlusIcon } from '@shared/icons'; - import { HASHTAGS, WIDGET_KIND } from '@utils/constants'; import { useWidget } from '@utils/hooks/useWidget'; diff --git a/src/shared/widgets/other/liveUpdater.tsx b/src/shared/widgets/other/liveUpdater.tsx index 5fa72578..a9f5cea3 100644 --- a/src/shared/widgets/other/liveUpdater.tsx +++ b/src/shared/widgets/other/liveUpdater.tsx @@ -1,13 +1,11 @@ import { NDKEvent, NDKKind, NDKSubscription } from '@nostr-dev-kit/ndk'; import { QueryStatus, useQueryClient } from '@tanstack/react-query'; import { useEffect, useState } from 'react'; - import { useArk } from '@libs/ark'; - import { ChevronUpIcon } from '@shared/icons'; export function LiveUpdater({ status }: { status: QueryStatus }) { - const { ark } = useArk(); + const ark = useArk(); const [events, setEvents] = useState([]); const queryClient = useQueryClient(); diff --git a/src/shared/widgets/other/nostrBandUserProfile.tsx b/src/shared/widgets/other/nostrBandUserProfile.tsx index 3c631fcc..b2b738cd 100644 --- a/src/shared/widgets/other/nostrBandUserProfile.tsx +++ b/src/shared/widgets/other/nostrBandUserProfile.tsx @@ -1,11 +1,8 @@ import { useEffect, useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { toast } from 'sonner'; - import { useArk } from '@libs/ark'; - import { FollowIcon } from '@shared/icons'; - import { displayNpub } from '@utils/formater'; export interface Profile { @@ -14,7 +11,7 @@ export interface Profile { } export function NostrBandUserProfile({ data }: { data: Profile }) { - const { ark } = useArk(); + const ark = useArk(); const [followed, setFollowed] = useState(false); const navigate = useNavigate(); diff --git a/src/shared/widgets/other/toggleWidgetList.tsx b/src/shared/widgets/other/toggleWidgetList.tsx index 9a94ec53..c7267351 100644 --- a/src/shared/widgets/other/toggleWidgetList.tsx +++ b/src/shared/widgets/other/toggleWidgetList.tsx @@ -1,6 +1,5 @@ import { PlusIcon } from '@shared/icons'; import { WidgetWrapper } from '@shared/widgets'; - import { WIDGET_KIND } from '@utils/constants'; import { useWidget } from '@utils/hooks/useWidget'; diff --git a/src/shared/widgets/other/userProfile.tsx b/src/shared/widgets/other/userProfile.tsx index 4305018d..993ba758 100644 --- a/src/shared/widgets/other/userProfile.tsx +++ b/src/shared/widgets/other/userProfile.tsx @@ -1,16 +1,13 @@ import { useEffect, useState } from 'react'; import { Link } from 'react-router-dom'; import { toast } from 'sonner'; - import { useArk } from '@libs/ark'; - import { NIP05 } from '@shared/nip05'; - import { displayNpub } from '@utils/formater'; import { useProfile } from '@utils/hooks/useProfile'; export function UserProfile({ pubkey }: { pubkey: string }) { - const { ark } = useArk(); + const ark = useArk(); const { user } = useProfile(pubkey); const [followed, setFollowed] = useState(false); diff --git a/src/shared/widgets/other/widgetList.tsx b/src/shared/widgets/other/widgetList.tsx index 1cce9aa4..95f54fd7 100644 --- a/src/shared/widgets/other/widgetList.tsx +++ b/src/shared/widgets/other/widgetList.tsx @@ -1,6 +1,5 @@ import { ArticleIcon, MediaIcon, PlusIcon } from '@shared/icons'; import { AddGroupFeeds, AddHashtagFeeds, TitleBar, WidgetWrapper } from '@shared/widgets'; - import { TOPICS, WIDGET_KIND } from '@utils/constants'; import { useWidget } from '@utils/hooks/useWidget'; import { Widget } from '@utils/types'; diff --git a/src/shared/widgets/thread.tsx b/src/shared/widgets/thread.tsx index 855f3c40..4eabeb20 100644 --- a/src/shared/widgets/thread.tsx +++ b/src/shared/widgets/thread.tsx @@ -1,9 +1,7 @@ import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk'; import { useCallback } from 'react'; import { WVList } from 'virtua'; - import { useArk } from '@libs/ark'; - import { LoaderIcon } from '@shared/icons'; import { ChildNote, @@ -16,13 +14,12 @@ import { import { ReplyList } from '@shared/notes/replies/list'; import { User } from '@shared/user'; import { TitleBar, WidgetWrapper } from '@shared/widgets'; - import { useEvent } from '@utils/hooks/useEvent'; import { Widget } from '@utils/types'; export function ThreadWidget({ widget }: { widget: Widget }) { const { isFetching, isError, data } = useEvent(widget.content); - const { ark } = useArk(); + const ark = useArk(); const renderKind = useCallback( (event: NDKEvent) => { diff --git a/src/shared/widgets/titleBar.tsx b/src/shared/widgets/titleBar.tsx index 46dfa48b..593454b2 100644 --- a/src/shared/widgets/titleBar.tsx +++ b/src/shared/widgets/titleBar.tsx @@ -1,8 +1,6 @@ import { useArk } from '@libs/ark'; - import { CancelIcon } from '@shared/icons'; import { User } from '@shared/user'; - import { useWidget } from '@utils/hooks/useWidget'; export function TitleBar({ @@ -14,7 +12,7 @@ export function TitleBar({ title?: string; isLive?: boolean; }) { - const { ark } = useArk(); + const ark = useArk(); const { removeWidget } = useWidget(); return ( diff --git a/src/shared/widgets/topic.tsx b/src/shared/widgets/topic.tsx index 589d8cc9..26ef784e 100644 --- a/src/shared/widgets/topic.tsx +++ b/src/shared/widgets/topic.tsx @@ -2,9 +2,7 @@ import { NDKEvent, NDKFilter, NDKKind } from '@nostr-dev-kit/ndk'; import { useInfiniteQuery } from '@tanstack/react-query'; import { useCallback, useMemo } from 'react'; import { VList } from 'virtua'; - import { useArk } from '@libs/ark'; - import { ArrowRightCircleIcon, LoaderIcon } from '@shared/icons'; import { MemoizedRepost, @@ -13,12 +11,11 @@ import { UnknownNote, } from '@shared/notes'; import { TitleBar, WidgetWrapper } from '@shared/widgets'; - import { FETCH_LIMIT } from '@utils/constants'; import { Widget } from '@utils/types'; export function TopicWidget({ widget }: { widget: Widget }) { - const { ark } = useArk(); + const ark = useArk(); const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } = useInfiniteQuery({ queryKey: ['topic', widget.id], diff --git a/src/shared/widgets/user.tsx b/src/shared/widgets/user.tsx index 2cf2a99b..84b5a57f 100644 --- a/src/shared/widgets/user.tsx +++ b/src/shared/widgets/user.tsx @@ -2,9 +2,7 @@ import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk'; import { useInfiniteQuery } from '@tanstack/react-query'; import { useCallback, useMemo } from 'react'; import { WVList } from 'virtua'; - import { useArk } from '@libs/ark'; - import { ArrowRightCircleIcon, LoaderIcon } from '@shared/icons'; import { MemoizedRepost, @@ -13,12 +11,11 @@ import { UnknownNote, } from '@shared/notes'; import { TitleBar, UserProfile, WidgetWrapper } from '@shared/widgets'; - import { FETCH_LIMIT } from '@utils/constants'; import { Widget } from '@utils/types'; export function UserWidget({ widget }: { widget: Widget }) { - const { ark } = useArk(); + const ark = useArk(); const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } = useInfiniteQuery({ queryKey: ['user-posts', widget.content], diff --git a/src/utils/hooks/useEvent.ts b/src/utils/hooks/useEvent.ts index 36309c21..e1f8e761 100644 --- a/src/utils/hooks/useEvent.ts +++ b/src/utils/hooks/useEvent.ts @@ -2,11 +2,10 @@ import { NDKEvent, NostrEvent } from '@nostr-dev-kit/ndk'; import { useQuery } from '@tanstack/react-query'; import { nip19 } from 'nostr-tools'; import { AddressPointer } from 'nostr-tools/lib/types/nip19'; - import { useArk } from '@libs/ark'; export function useEvent(id: undefined | string, embed?: undefined | string) { - const { ark } = useArk(); + const ark = useArk(); const { status, isFetching, isError, data } = useQuery({ queryKey: ['event', id], queryFn: async () => { diff --git a/src/utils/hooks/useOpenGraph.ts b/src/utils/hooks/useOpenGraph.ts index eb65a860..1f9f07e8 100644 --- a/src/utils/hooks/useOpenGraph.ts +++ b/src/utils/hooks/useOpenGraph.ts @@ -1,6 +1,5 @@ import { useQuery } from '@tanstack/react-query'; import { invoke } from '@tauri-apps/api/primitives'; - import { Opengraph } from '@utils/types'; export function useOpenGraph(url: string) { diff --git a/src/utils/hooks/useProfile.ts b/src/utils/hooks/useProfile.ts index c8e93758..53913ea1 100644 --- a/src/utils/hooks/useProfile.ts +++ b/src/utils/hooks/useProfile.ts @@ -1,11 +1,10 @@ import { NDKUserProfile } from '@nostr-dev-kit/ndk'; import { useQuery } from '@tanstack/react-query'; import { nip19 } from 'nostr-tools'; - import { useArk } from '@libs/ark'; export function useProfile(pubkey: string, embed?: string) { - const { ark } = useArk(); + const ark = useArk(); const { isLoading, isError, diff --git a/src/utils/hooks/useRelay.ts b/src/utils/hooks/useRelay.ts index d60d0750..0a4d0f1f 100644 --- a/src/utils/hooks/useRelay.ts +++ b/src/utils/hooks/useRelay.ts @@ -1,10 +1,9 @@ import { NDKKind, NDKRelayUrl, NDKTag } from '@nostr-dev-kit/ndk'; import { useMutation, useQueryClient } from '@tanstack/react-query'; - import { useArk } from '@libs/ark'; export function useRelay() { - const { ark } = useArk(); + const ark = useArk(); const queryClient = useQueryClient(); const connectRelay = useMutation({ diff --git a/src/utils/hooks/useRichContent.tsx b/src/utils/hooks/useRichContent.tsx index cb392e73..715280f0 100644 --- a/src/utils/hooks/useRichContent.tsx +++ b/src/utils/hooks/useRichContent.tsx @@ -3,9 +3,7 @@ import { nip19 } from 'nostr-tools'; import { ReactNode } from 'react'; import { Link } from 'react-router-dom'; import reactStringReplace from 'react-string-replace'; - import { useArk } from '@libs/ark'; - import { Hashtag, ImagePreview, @@ -56,7 +54,7 @@ const VIDEOS = [ ]; export function useRichContent(content: string, textmode: boolean = false) { - const { ark } = useArk(); + const ark = useArk(); let parsedContent: string | ReactNode[] = content.replace(/\n+/g, '\n'); let linkPreview: string; diff --git a/src/utils/hooks/useSuggestion.ts b/src/utils/hooks/useSuggestion.ts index 5307d878..71e66b6d 100644 --- a/src/utils/hooks/useSuggestion.ts +++ b/src/utils/hooks/useSuggestion.ts @@ -1,13 +1,11 @@ import { MentionOptions } from '@tiptap/extension-mention'; import { ReactRenderer } from '@tiptap/react'; import tippy from 'tippy.js'; - import { MentionList } from '@app/new/components'; - import { useArk } from '@libs/ark'; export function useSuggestion() { - const { ark } = useArk(); + const ark = useArk(); const suggestion: MentionOptions['suggestion'] = { items: async ({ query }) => { diff --git a/src/utils/hooks/useWidget.ts b/src/utils/hooks/useWidget.ts index c64d5519..c17b185a 100644 --- a/src/utils/hooks/useWidget.ts +++ b/src/utils/hooks/useWidget.ts @@ -1,11 +1,9 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'; - import { useArk } from '@libs/ark'; - import { Widget } from '@utils/types'; export function useWidget() { - const { ark } = useArk(); + const ark = useArk(); const queryClient = useQueryClient(); const addWidget = useMutation({