feat: update format

This commit is contained in:
2023-12-14 13:11:21 +07:00
parent a93ebd3861
commit d9ab7893e0
120 changed files with 82 additions and 338 deletions

View File

@@ -14,7 +14,7 @@
"^@utils/(.*)$", "^@utils/(.*)$",
"^[./]" "^[./]"
], ],
"importOrderSeparation": true, "importOrderSeparation": false,
"importOrderSortSpecifiers": true, "importOrderSortSpecifiers": true,
"plugins": ["@trivago/prettier-plugin-sort-imports", "prettier-plugin-tailwindcss"], "plugins": ["@trivago/prettier-plugin-sort-imports", "prettier-plugin-tailwindcss"],
"pluginSearchDirs": false "pluginSearchDirs": false

View File

@@ -13,9 +13,9 @@
overflow-wrap: break-word; overflow-wrap: break-word;
} }
.prose :where(iframe):not(:where([class~="not-prose"] *)) { .prose :where(iframe):not(:where([class~='not-prose'] *)) {
@apply aspect-video w-full h-auto mx-auto; @apply mx-auto aspect-video h-auto w-full;
} }
} }
html { html {
@@ -44,7 +44,7 @@ input::-ms-clear {
} }
.ProseMirror p.is-empty::before { .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 { .ProseMirror img.ProseMirror-selectednode {

View File

@@ -1,22 +1,18 @@
import { fetch } from '@tauri-apps/plugin-http'; import { fetch } from '@tauri-apps/plugin-http';
import { RouterProvider, createBrowserRouter, defer, redirect } from 'react-router-dom'; import { RouterProvider, createBrowserRouter, defer, redirect } from 'react-router-dom';
import { ChatsScreen } from '@app/chats'; import { ChatsScreen } from '@app/chats';
import { ErrorScreen } from '@app/error'; import { ErrorScreen } from '@app/error';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { LoaderIcon } from '@shared/icons'; import { LoaderIcon } from '@shared/icons';
import { AppLayout } from '@shared/layouts/app'; import { AppLayout } from '@shared/layouts/app';
import { AuthLayout } from '@shared/layouts/auth'; import { AuthLayout } from '@shared/layouts/auth';
import { NewLayout } from '@shared/layouts/new'; import { NewLayout } from '@shared/layouts/new';
import { NoteLayout } from '@shared/layouts/note'; import { NoteLayout } from '@shared/layouts/note';
import { SettingsLayout } from '@shared/layouts/settings'; import { SettingsLayout } from '@shared/layouts/settings';
import './app.css'; import './app.css';
export default function App() { export default function App() {
const { ark } = useArk(); const ark = useArk();
const accountLoader = async () => { const accountLoader = async () => {
if (!ark.account) return redirect('/auth/welcome'); if (!ark.account) return redirect('/auth/welcome');

View File

@@ -1,8 +1,6 @@
import { message } from '@tauri-apps/plugin-dialog'; import { message } from '@tauri-apps/plugin-dialog';
import { Dispatch, SetStateAction, useState } from 'react'; import { Dispatch, SetStateAction, useState } from 'react';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { LoaderIcon } from '@shared/icons'; import { LoaderIcon } from '@shared/icons';
export function AvatarUploader({ export function AvatarUploader({
@@ -10,7 +8,7 @@ export function AvatarUploader({
}: { }: {
setPicture: Dispatch<SetStateAction<string>>; setPicture: Dispatch<SetStateAction<string>>;
}) { }) {
const { ark } = useArk(); const ark = useArk();
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const uploadAvatar = async () => { const uploadAvatar = async () => {

View File

@@ -10,11 +10,8 @@ import { useState } from 'react';
import { useForm } from 'react-hook-form'; import { useForm } from 'react-hook-form';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { toast } from 'sonner'; import { toast } from 'sonner';
import { AvatarUploader } from '@app/auth/components/avatarUploader'; import { AvatarUploader } from '@app/auth/components/avatarUploader';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { ArrowLeftIcon, InfoIcon, LoaderIcon } from '@shared/icons'; import { ArrowLeftIcon, InfoIcon, LoaderIcon } from '@shared/icons';
import { User } from '@shared/user'; import { User } from '@shared/user';
@@ -29,7 +26,7 @@ export function CreateAccountScreen() {
privkey: string; privkey: string;
}>(null); }>(null);
const { ark } = useArk(); const ark = useArk();
const { const {
register, register,
handleSubmit, handleSubmit,

View File

@@ -2,15 +2,12 @@ import { NDKKind } from '@nostr-dev-kit/ndk';
import { useQueryClient } from '@tanstack/react-query'; import { useQueryClient } from '@tanstack/react-query';
import { useState } from 'react'; import { useState } from 'react';
import { Link, useNavigate } from 'react-router-dom'; import { Link, useNavigate } from 'react-router-dom';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { LoaderIcon } from '@shared/icons'; import { LoaderIcon } from '@shared/icons';
import { FETCH_LIMIT } from '@utils/constants'; import { FETCH_LIMIT } from '@utils/constants';
export function FinishScreen() { export function FinishScreen() {
const { ark } = useArk(); const ark = useArk();
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const queryClient = useQueryClient(); const queryClient = useQueryClient();

View File

@@ -6,9 +6,7 @@ import { useState } from 'react';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { toast } from 'sonner'; import { toast } from 'sonner';
import { twMerge } from 'tailwind-merge'; import { twMerge } from 'tailwind-merge';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { import {
ArrowLeftIcon, ArrowLeftIcon,
ArrowRightIcon, ArrowRightIcon,
@@ -36,7 +34,7 @@ const POPULAR_USERS = [
const LUME_USERS = ['npub1zfss807aer0j26mwp2la0ume0jqde3823rmu97ra6sgyyg956e0s6xw445']; const LUME_USERS = ['npub1zfss807aer0j26mwp2la0ume0jqde3823rmu97ra6sgyyg956e0s6xw445'];
export function FollowScreen() { export function FollowScreen() {
const { ark } = useArk(); const ark = useArk();
const { status, data } = useQuery({ const { status, data } = useQuery({
queryKey: ['trending-profiles-widget'], queryKey: ['trending-profiles-widget'],
queryFn: async () => { queryFn: async () => {

View File

@@ -7,9 +7,7 @@ import { useState } from 'react';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { toast } from 'sonner'; import { toast } from 'sonner';
import { twMerge } from 'tailwind-merge'; import { twMerge } from 'tailwind-merge';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { ArrowLeftIcon, LoaderIcon } from '@shared/icons'; import { ArrowLeftIcon, LoaderIcon } from '@shared/icons';
import { User } from '@shared/user'; import { User } from '@shared/user';
@@ -21,7 +19,7 @@ export function ImportAccountScreen() {
const [created, setCreated] = useState({ ok: false, remote: false }); const [created, setCreated] = useState({ ok: false, remote: false });
const [savedPrivkey, setSavedPrivkey] = useState(false); const [savedPrivkey, setSavedPrivkey] = useState(false);
const { ark } = useArk(); const ark = useArk();
const navigate = useNavigate(); const navigate = useNavigate();
const submitNpub = async () => { const submitNpub = async () => {

View File

@@ -2,13 +2,11 @@ import * as Switch from '@radix-ui/react-switch';
import { isPermissionGranted, requestPermission } from '@tauri-apps/plugin-notification'; import { isPermissionGranted, requestPermission } from '@tauri-apps/plugin-notification';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { InfoIcon } from '@shared/icons'; import { InfoIcon } from '@shared/icons';
export function OnboardingScreen() { export function OnboardingScreen() {
const { ark } = useArk(); const ark = useArk();
const navigate = useNavigate(); const navigate = useNavigate();
const [settings, setSettings] = useState({ const [settings, setSettings] = useState({

View File

@@ -2,15 +2,12 @@ import { NDKKind } from '@nostr-dev-kit/ndk';
import { useQueryClient } from '@tanstack/react-query'; import { useQueryClient } from '@tanstack/react-query';
import { useState } from 'react'; import { useState } from 'react';
import { Link, useNavigate } from 'react-router-dom'; import { Link, useNavigate } from 'react-router-dom';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { LoaderIcon } from '@shared/icons'; import { LoaderIcon } from '@shared/icons';
import { FETCH_LIMIT } from '@utils/constants'; import { FETCH_LIMIT } from '@utils/constants';
export function TutorialFinishScreen() { export function TutorialFinishScreen() {
const { ark } = useArk(); const ark = useArk();
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const queryClient = useQueryClient(); const queryClient = useQueryClient();

View File

@@ -1,12 +1,10 @@
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { EditIcon, ReactionIcon, ReplyIcon, RepostIcon, ZapIcon } from '@shared/icons'; import { EditIcon, ReactionIcon, ReplyIcon, RepostIcon, ZapIcon } from '@shared/icons';
import { TextNote } from '@shared/notes'; import { TextNote } from '@shared/notes';
export function TutorialNoteScreen() { export function TutorialNoteScreen() {
const { ark } = useArk(); const ark = useArk();
const exampleEvent = ark.createNDKEvent({ const exampleEvent = ark.createNDKEvent({
event: { event: {

View File

@@ -1,5 +1,4 @@
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { BellIcon, HomeIcon, PlusIcon } from '@shared/icons'; import { BellIcon, HomeIcon, PlusIcon } from '@shared/icons';
export function TutorialWidgetScreen() { export function TutorialWidgetScreen() {

View File

@@ -3,17 +3,14 @@ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { useCallback, useEffect, useRef } from 'react'; import { useCallback, useEffect, useRef } from 'react';
import { useParams } from 'react-router-dom'; import { useParams } from 'react-router-dom';
import { VList, VListHandle } from 'virtua'; import { VList, VListHandle } from 'virtua';
import { ChatForm } from '@app/chats/components/chatForm'; import { ChatForm } from '@app/chats/components/chatForm';
import { ChatMessage } from '@app/chats/components/message'; import { ChatMessage } from '@app/chats/components/message';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { LoaderIcon } from '@shared/icons'; import { LoaderIcon } from '@shared/icons';
import { User } from '@shared/user'; import { User } from '@shared/user';
export function ChatScreen() { export function ChatScreen() {
const { ark } = useArk(); const ark = useArk();
const { pubkey } = useParams(); const { pubkey } = useParams();
const { status, data } = useQuery({ const { status, data } = useQuery({
queryKey: ['nip04-dm', pubkey], queryKey: ['nip04-dm', pubkey],

View File

@@ -1,14 +1,11 @@
import { useState } from 'react'; import { useState } from 'react';
import { toast } from 'sonner'; import { toast } from 'sonner';
import { MediaUploader } from '@app/chats/components/mediaUploader'; import { MediaUploader } from '@app/chats/components/mediaUploader';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { EnterIcon } from '@shared/icons'; import { EnterIcon } from '@shared/icons';
export function ChatForm({ receiverPubkey }: { receiverPubkey: string }) { export function ChatForm({ receiverPubkey }: { receiverPubkey: string }) {
const { ark } = useArk(); const ark = useArk();
const [value, setValue] = useState(''); const [value, setValue] = useState('');
const submit = async () => { const submit = async () => {

View File

@@ -4,9 +4,7 @@ import { minidenticon } from 'minidenticons';
import { memo } from 'react'; import { memo } from 'react';
import { NavLink } from 'react-router-dom'; import { NavLink } from 'react-router-dom';
import { twMerge } from 'tailwind-merge'; import { twMerge } from 'tailwind-merge';
import { useDecryptMessage } from '@app/chats/hooks/useDecryptMessage'; import { useDecryptMessage } from '@app/chats/hooks/useDecryptMessage';
import { displayNpub, formatCreatedAt } from '@utils/formater'; import { displayNpub, formatCreatedAt } from '@utils/formater';
import { useProfile } from '@utils/hooks/useProfile'; import { useProfile } from '@utils/hooks/useProfile';

View File

@@ -1,8 +1,6 @@
import * as Tooltip from '@radix-ui/react-tooltip'; import * as Tooltip from '@radix-ui/react-tooltip';
import { Dispatch, SetStateAction, useState } from 'react'; import { Dispatch, SetStateAction, useState } from 'react';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { LoaderIcon, MediaIcon } from '@shared/icons'; import { LoaderIcon, MediaIcon } from '@shared/icons';
export function MediaUploader({ export function MediaUploader({
@@ -10,7 +8,7 @@ export function MediaUploader({
}: { }: {
setState: Dispatch<SetStateAction<string>>; setState: Dispatch<SetStateAction<string>>;
}) { }) {
const { ark } = useArk(); const ark = useArk();
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const uploadMedia = async () => { const uploadMedia = async () => {

View File

@@ -1,6 +1,5 @@
import { NDKEvent } from '@nostr-dev-kit/ndk'; import { NDKEvent } from '@nostr-dev-kit/ndk';
import { twMerge } from 'tailwind-merge'; import { twMerge } from 'tailwind-merge';
import { useDecryptMessage } from '@app/chats/hooks/useDecryptMessage'; import { useDecryptMessage } from '@app/chats/hooks/useDecryptMessage';
export function ChatMessage({ message, isSelf }: { message: NDKEvent; isSelf: boolean }) { export function ChatMessage({ message, isSelf }: { message: NDKEvent; isSelf: boolean }) {

View File

@@ -1,10 +1,9 @@
import { NDKEvent } from '@nostr-dev-kit/ndk'; import { NDKEvent } from '@nostr-dev-kit/ndk';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
export function useDecryptMessage(event: NDKEvent) { export function useDecryptMessage(event: NDKEvent) {
const { ark } = useArk(); const ark = useArk();
const [content, setContent] = useState(event.content); const [content, setContent] = useState(event.content);
useEffect(() => { useEffect(() => {

View File

@@ -2,15 +2,12 @@ import { NDKEvent } from '@nostr-dev-kit/ndk';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { useCallback } from 'react'; import { useCallback } from 'react';
import { Outlet } from 'react-router-dom'; import { Outlet } from 'react-router-dom';
import { ChatListItem } from '@app/chats/components/chatListItem'; import { ChatListItem } from '@app/chats/components/chatListItem';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { LoaderIcon } from '@shared/icons'; import { LoaderIcon } from '@shared/icons';
export function ChatsScreen() { export function ChatsScreen() {
const { ark } = useArk(); const ark = useArk();
const { status, data } = useQuery({ const { status, data } = useQuery({
queryKey: ['nip04-chats'], queryKey: ['nip04-chats'],
queryFn: async () => { queryFn: async () => {

View File

@@ -3,7 +3,6 @@ import { message, save } from '@tauri-apps/plugin-dialog';
import { writeTextFile } from '@tauri-apps/plugin-fs'; import { writeTextFile } from '@tauri-apps/plugin-fs';
import { relaunch } from '@tauri-apps/plugin-process'; import { relaunch } from '@tauri-apps/plugin-process';
import { useRouteError } from 'react-router-dom'; import { useRouteError } from 'react-router-dom';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
interface RouteError { interface RouteError {
@@ -12,7 +11,7 @@ interface RouteError {
} }
export function ErrorScreen() { export function ErrorScreen() {
const { ark } = useArk(); const ark = useArk();
const error = useRouteError() as RouteError; const error = useRouteError() as RouteError;
const restart = async () => { const restart = async () => {

View File

@@ -1,9 +1,7 @@
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { useCallback, useRef, useState } from 'react'; import { useCallback, useRef, useState } from 'react';
import { VList, VListHandle } from 'virtua'; import { VList, VListHandle } from 'virtua';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { LoaderIcon } from '@shared/icons'; import { LoaderIcon } from '@shared/icons';
import { import {
ArticleWidget, ArticleWidget,
@@ -20,7 +18,6 @@ import {
UserWidget, UserWidget,
WidgetList, WidgetList,
} from '@shared/widgets'; } from '@shared/widgets';
import { WIDGET_KIND } from '@utils/constants'; import { WIDGET_KIND } from '@utils/constants';
import { Widget } from '@utils/types'; import { Widget } from '@utils/types';
@@ -28,7 +25,7 @@ export function HomeScreen() {
const ref = useRef<VListHandle>(null); const ref = useRef<VListHandle>(null);
const [selectedIndex, setSelectedIndex] = useState(-1); const [selectedIndex, setSelectedIndex] = useState(-1);
const { ark } = useArk(); const ark = useArk();
const { status, data } = useQuery({ const { status, data } = useQuery({
queryKey: ['widgets'], queryKey: ['widgets'],
queryFn: async () => { queryFn: async () => {

View File

@@ -9,11 +9,8 @@ import { useNavigate } from 'react-router-dom';
import { toast } from 'sonner'; import { toast } from 'sonner';
import { twMerge } from 'tailwind-merge'; import { twMerge } from 'tailwind-merge';
import { Markdown } from 'tiptap-markdown'; import { Markdown } from 'tiptap-markdown';
import { ArticleCoverUploader, MediaUploader, MentionPopup } from '@app/new/components'; import { ArticleCoverUploader, MediaUploader, MentionPopup } from '@app/new/components';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { import {
BoldIcon, BoldIcon,
Heading1Icon, Heading1Icon,
@@ -25,7 +22,7 @@ import {
} from '@shared/icons'; } from '@shared/icons';
export function NewArticleScreen() { export function NewArticleScreen() {
const { ark } = useArk(); const ark = useArk();
const [height, setHeight] = useState(0); const [height, setHeight] = useState(0);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);

View File

@@ -1,7 +1,6 @@
import { message, open } from '@tauri-apps/plugin-dialog'; import { message, open } from '@tauri-apps/plugin-dialog';
import { readBinaryFile } from '@tauri-apps/plugin-fs'; import { readBinaryFile } from '@tauri-apps/plugin-fs';
import { useState } from 'react'; import { useState } from 'react';
import { ImageIcon, LoaderIcon } from '@shared/icons'; import { ImageIcon, LoaderIcon } from '@shared/icons';
export function ArticleCoverUploader({ setCover }) { export function ArticleCoverUploader({ setCover }) {

View File

@@ -1,13 +1,11 @@
import { message } from '@tauri-apps/plugin-dialog'; import { message } from '@tauri-apps/plugin-dialog';
import { Editor } from '@tiptap/react'; import { Editor } from '@tiptap/react';
import { useState } from 'react'; import { useState } from 'react';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { MediaIcon } from '@shared/icons'; import { MediaIcon } from '@shared/icons';
export function MediaUploader({ editor }: { editor: Editor }) { export function MediaUploader({ editor }: { editor: Editor }) {
const { ark } = useArk(); const ark = useArk();
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const uploadToNostrBuild = async () => { const uploadToNostrBuild = async () => {

View File

@@ -2,7 +2,6 @@ import * as Avatar from '@radix-ui/react-avatar';
import { minidenticon } from 'minidenticons'; import { minidenticon } from 'minidenticons';
import { Ref, forwardRef, useEffect, useImperativeHandle, useState } from 'react'; import { Ref, forwardRef, useEffect, useImperativeHandle, useState } from 'react';
import { twMerge } from 'tailwind-merge'; import { twMerge } from 'tailwind-merge';
import { NDKCacheUserProfile } from '@utils/types'; import { NDKCacheUserProfile } from '@utils/types';
type MentionListRef = { type MentionListRef = {

View File

@@ -1,15 +1,12 @@
import * as Popover from '@radix-ui/react-popover'; import * as Popover from '@radix-ui/react-popover';
import { Editor } from '@tiptap/react'; import { Editor } from '@tiptap/react';
import { nip19 } from 'nostr-tools'; import { nip19 } from 'nostr-tools';
import { MentionPopupItem } from '@app/new/components'; import { MentionPopupItem } from '@app/new/components';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { MentionIcon } from '@shared/icons'; import { MentionIcon } from '@shared/icons';
export function MentionPopup({ editor }: { editor: Editor }) { export function MentionPopup({ editor }: { editor: Editor }) {
const { ark } = useArk(); const ark = useArk();
const insertMention = (pubkey: string) => { const insertMention = (pubkey: string) => {
editor.commands.insertContent(`nostr:${nip19.npubEncode(pubkey)}`); editor.commands.insertContent(`nostr:${nip19.npubEncode(pubkey)}`);

View File

@@ -1,7 +1,6 @@
import * as Avatar from '@radix-ui/react-avatar'; import * as Avatar from '@radix-ui/react-avatar';
import { minidenticon } from 'minidenticons'; import { minidenticon } from 'minidenticons';
import { useMemo } from 'react'; import { useMemo } from 'react';
import { displayNpub } from '@utils/formater'; import { displayNpub } from '@utils/formater';
import { useProfile } from '@utils/hooks/useProfile'; import { useProfile } from '@utils/hooks/useProfile';

View File

@@ -3,13 +3,11 @@ import { readBinaryFile } from '@tauri-apps/plugin-fs';
import { useState } from 'react'; import { useState } from 'react';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { toast } from 'sonner'; import { toast } from 'sonner';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { LoaderIcon } from '@shared/icons'; import { LoaderIcon } from '@shared/icons';
export function NewFileScreen() { export function NewFileScreen() {
const { ark } = useArk(); const ark = useArk();
const navigate = useNavigate(); const navigate = useNavigate();
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);

View File

@@ -10,20 +10,16 @@ import { nip19 } from 'nostr-tools';
import { useLayoutEffect, useRef, useState } from 'react'; import { useLayoutEffect, useRef, useState } from 'react';
import { useNavigate, useSearchParams } from 'react-router-dom'; import { useNavigate, useSearchParams } from 'react-router-dom';
import { toast } from 'sonner'; import { toast } from 'sonner';
import { MediaUploader, MentionPopup } from '@app/new/components'; import { MediaUploader, MentionPopup } from '@app/new/components';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { CancelIcon, LoaderIcon } from '@shared/icons'; import { CancelIcon, LoaderIcon } from '@shared/icons';
import { MentionNote } from '@shared/notes'; import { MentionNote } from '@shared/notes';
import { WIDGET_KIND } from '@utils/constants'; import { WIDGET_KIND } from '@utils/constants';
import { useSuggestion } from '@utils/hooks/useSuggestion'; import { useSuggestion } from '@utils/hooks/useSuggestion';
import { useWidget } from '@utils/hooks/useWidget'; import { useWidget } from '@utils/hooks/useWidget';
export function NewPostScreen() { export function NewPostScreen() {
const { ark } = useArk(); const ark = useArk();
const { addWidget } = useWidget(); const { addWidget } = useWidget();
const { suggestion } = useSuggestion(); const { suggestion } = useSuggestion();

View File

@@ -3,11 +3,10 @@ import { getPublicKey, nip19 } from 'nostr-tools';
import { useState } from 'react'; import { useState } from 'react';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { toast } from 'sonner'; import { toast } from 'sonner';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
export function NewPrivkeyScreen() { export function NewPrivkeyScreen() {
const { ark } = useArk(); const ark = useArk();
const navigate = useNavigate(); const navigate = useNavigate();
const [nsec, setNsec] = useState(''); const [nsec, setNsec] = useState('');

View File

@@ -5,11 +5,9 @@ import { EventPointer } from 'nostr-tools/lib/types/nip19';
import { useMemo, useState } from 'react'; import { useMemo, useState } from 'react';
import { useNavigate, useParams } from 'react-router-dom'; import { useNavigate, useParams } from 'react-router-dom';
import { toast } from 'sonner'; import { toast } from 'sonner';
import { ArrowLeftIcon, CheckCircleIcon, ShareIcon } from '@shared/icons'; import { ArrowLeftIcon, CheckCircleIcon, ShareIcon } from '@shared/icons';
import { NoteReplyForm } from '@shared/notes'; import { NoteReplyForm } from '@shared/notes';
import { ReplyList } from '@shared/notes/replies/list'; import { ReplyList } from '@shared/notes/replies/list';
import { useEvent } from '@utils/hooks/useEvent'; import { useEvent } from '@utils/hooks/useEvent';
export function ArticleNoteScreen() { export function ArticleNoteScreen() {

View File

@@ -5,9 +5,7 @@ import { EventPointer } from 'nostr-tools/lib/types/nip19';
import { useRef, useState } from 'react'; import { useRef, useState } from 'react';
import { useNavigate, useParams } from 'react-router-dom'; import { useNavigate, useParams } from 'react-router-dom';
import { toast } from 'sonner'; import { toast } from 'sonner';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { ArrowLeftIcon, CheckCircleIcon, ReplyIcon, ShareIcon } from '@shared/icons'; import { ArrowLeftIcon, CheckCircleIcon, ReplyIcon, ShareIcon } from '@shared/icons';
import { import {
ChildNote, ChildNote,
@@ -18,7 +16,6 @@ import {
} from '@shared/notes'; } from '@shared/notes';
import { ReplyList } from '@shared/notes/replies/list'; import { ReplyList } from '@shared/notes/replies/list';
import { User } from '@shared/user'; import { User } from '@shared/user';
import { useEvent } from '@utils/hooks/useEvent'; import { useEvent } from '@utils/hooks/useEvent';
export function TextNoteScreen() { export function TextNoteScreen() {
@@ -26,7 +23,7 @@ export function TextNoteScreen() {
const replyRef = useRef(null); const replyRef = useRef(null);
const { id } = useParams(); const { id } = useParams();
const { ark } = useArk(); const ark = useArk();
const { status, data } = useEvent(id); const { status, data } = useEvent(id);
const [isCopy, setIsCopy] = useState(false); const [isCopy, setIsCopy] = useState(false);

View File

@@ -1,12 +1,10 @@
import { useState } from 'react'; import { useState } from 'react';
import { toast } from 'sonner'; import { toast } from 'sonner';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { LoaderIcon } from '@shared/icons'; import { LoaderIcon } from '@shared/icons';
export function NWCForm({ setWalletConnectURL }) { export function NWCForm({ setWalletConnectURL }) {
const { ark } = useArk(); const ark = useArk();
const [uri, setUri] = useState(''); const [uri, setUri] = useState('');
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);

View File

@@ -1,13 +1,10 @@
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { NWCForm } from '@app/nwc/components/form'; import { NWCForm } from '@app/nwc/components/form';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { CheckCircleIcon } from '@shared/icons'; import { CheckCircleIcon } from '@shared/icons';
export function NWCScreen() { export function NWCScreen() {
const { ark } = useArk(); const ark = useArk();
const [walletConnectURL, setWalletConnectURL] = useState<null | string>(null); const [walletConnectURL, setWalletConnectURL] = useState<null | string>(null);
const remove = async () => { const remove = async () => {

View File

@@ -2,9 +2,7 @@ import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk';
import { useInfiniteQuery } from '@tanstack/react-query'; import { useInfiniteQuery } from '@tanstack/react-query';
import { useCallback, useMemo } from 'react'; import { useCallback, useMemo } from 'react';
import { VList } from 'virtua'; import { VList } from 'virtua';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { ArrowRightCircleIcon, LoaderIcon } from '@shared/icons'; import { ArrowRightCircleIcon, LoaderIcon } from '@shared/icons';
import { import {
MemoizedRepost, MemoizedRepost,
@@ -12,11 +10,10 @@ import {
NoteSkeleton, NoteSkeleton,
UnknownNote, UnknownNote,
} from '@shared/notes'; } from '@shared/notes';
import { FETCH_LIMIT } from '@utils/constants'; import { FETCH_LIMIT } from '@utils/constants';
export function RelayEventList({ relayUrl }: { relayUrl: string }) { export function RelayEventList({ relayUrl }: { relayUrl: string }) {
const { ark } = useArk(); const ark = useArk();
const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } = const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } =
useInfiniteQuery({ useInfiniteQuery({
queryKey: ['relay-events', relayUrl], queryKey: ['relay-events', relayUrl],

View File

@@ -2,9 +2,7 @@ import { NDKRelayUrl } from '@nostr-dev-kit/ndk';
import { normalizeRelayUrl } from 'nostr-fetch'; import { normalizeRelayUrl } from 'nostr-fetch';
import { useState } from 'react'; import { useState } from 'react';
import { toast } from 'sonner'; import { toast } from 'sonner';
import { PlusIcon } from '@shared/icons'; import { PlusIcon } from '@shared/icons';
import { useRelay } from '@utils/hooks/useRelay'; import { useRelay } from '@utils/hooks/useRelay';
const domainRegex = /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/; const domainRegex = /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/;

View File

@@ -1,16 +1,13 @@
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { VList } from 'virtua'; import { VList } from 'virtua';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { LoaderIcon, PlusIcon, ShareIcon } from '@shared/icons'; import { LoaderIcon, PlusIcon, ShareIcon } from '@shared/icons';
import { User } from '@shared/user'; import { User } from '@shared/user';
import { useRelay } from '@utils/hooks/useRelay'; import { useRelay } from '@utils/hooks/useRelay';
export function RelayList() { export function RelayList() {
const { ark } = useArk(); const ark = useArk();
const { connectRelay } = useRelay(); const { connectRelay } = useRelay();
const { status, data } = useQuery({ const { status, data } = useQuery({
queryKey: ['relays'], queryKey: ['relays'],

View File

@@ -1,16 +1,12 @@
import { NDKKind } from '@nostr-dev-kit/ndk'; import { NDKKind } from '@nostr-dev-kit/ndk';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { RelayForm } from '@app/relays/components/relayForm'; import { RelayForm } from '@app/relays/components/relayForm';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { CancelIcon, RefreshIcon } from '@shared/icons'; import { CancelIcon, RefreshIcon } from '@shared/icons';
import { useRelay } from '@utils/hooks/useRelay'; import { useRelay } from '@utils/hooks/useRelay';
export function UserRelayList() { export function UserRelayList() {
const { ark } = useArk(); const ark = useArk();
const { removeRelay } = useRelay(); const { removeRelay } = useRelay();
const { status, data, refetch } = useQuery({ const { status, data, refetch } = useQuery({
queryKey: ['relays', ark.account.pubkey], queryKey: ['relays', ark.account.pubkey],

View File

@@ -1,11 +1,8 @@
import { Suspense } from 'react'; import { Suspense } from 'react';
import { Await, useLoaderData, useNavigate, useParams } from 'react-router-dom'; import { Await, useLoaderData, useNavigate, useParams } from 'react-router-dom';
import { ArrowLeftIcon, LoaderIcon } from '@shared/icons'; import { ArrowLeftIcon, LoaderIcon } from '@shared/icons';
import { User } from '@shared/user'; import { User } from '@shared/user';
import { NIP11 } from '@utils/types'; import { NIP11 } from '@utils/types';
import { RelayEventList } from './components/relayEventList'; import { RelayEventList } from './components/relayEventList';
export function RelayScreen() { export function RelayScreen() {

View File

@@ -1,7 +1,7 @@
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
export function AdvancedSettingScreen() { export function AdvancedSettingScreen() {
const { ark } = useArk(); const ark = useArk();
const clearCache = async () => { const clearCache = async () => {
await ark.clearCache(); await ark.clearCache();

View File

@@ -1,12 +1,10 @@
import { nip19 } from 'nostr-tools'; import { nip19 } from 'nostr-tools';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { EyeOffIcon } from '@shared/icons'; import { EyeOffIcon } from '@shared/icons';
export function BackupSettingScreen() { export function BackupSettingScreen() {
const { ark } = useArk(); const ark = useArk();
const [privkey, setPrivkey] = useState(null); const [privkey, setPrivkey] = useState(null);
const [showPassword, setShowPassword] = useState(false); const [showPassword, setShowPassword] = useState(false);

View File

@@ -1,14 +1,11 @@
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { EditIcon, LoaderIcon } from '@shared/icons'; import { EditIcon, LoaderIcon } from '@shared/icons';
import { compactNumber } from '@utils/formater'; import { compactNumber } from '@utils/formater';
export function ContactCard() { export function ContactCard() {
const { ark } = useArk(); const ark = useArk();
const { status, data } = useQuery({ const { status, data } = useQuery({
queryKey: ['contacts'], queryKey: ['contacts'],
queryFn: async () => { queryFn: async () => {

View File

@@ -1,15 +1,12 @@
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { fetch } from '@tauri-apps/plugin-http'; import { fetch } from '@tauri-apps/plugin-http';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { LoaderIcon } from '@shared/icons'; import { LoaderIcon } from '@shared/icons';
import { compactNumber } from '@utils/formater'; import { compactNumber } from '@utils/formater';
export function PostCard() { export function PostCard() {
const { ark } = useArk(); const ark = useArk();
const { status, data } = useQuery({ const { status, data } = useQuery({
queryKey: ['user-stats', ark.account.pubkey], queryKey: ['user-stats', ark.account.pubkey],
queryFn: async ({ signal }: { signal: AbortSignal }) => { queryFn: async ({ signal }: { signal: AbortSignal }) => {

View File

@@ -1,16 +1,13 @@
import * as Avatar from '@radix-ui/react-avatar'; import * as Avatar from '@radix-ui/react-avatar';
import { minidenticon } from 'minidenticons'; import { minidenticon } from 'minidenticons';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { EditIcon, LoaderIcon } from '@shared/icons'; import { EditIcon, LoaderIcon } from '@shared/icons';
import { displayNpub } from '@utils/formater'; import { displayNpub } from '@utils/formater';
import { useProfile } from '@utils/hooks/useProfile'; import { useProfile } from '@utils/hooks/useProfile';
export function ProfileCard() { export function ProfileCard() {
const { ark } = useArk(); const ark = useArk();
const { isLoading, user } = useProfile(ark.account.pubkey); const { isLoading, user } = useProfile(ark.account.pubkey);
const svgURI = const svgURI =

View File

@@ -1,14 +1,11 @@
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { EditIcon, LoaderIcon } from '@shared/icons'; import { EditIcon, LoaderIcon } from '@shared/icons';
import { compactNumber } from '@utils/formater'; import { compactNumber } from '@utils/formater';
export function RelayCard() { export function RelayCard() {
const { ark } = useArk(); const ark = useArk();
const { status, data } = useQuery({ const { status, data } = useQuery({
queryKey: ['relays', ark.account.pubkey], queryKey: ['relays', ark.account.pubkey],
queryFn: async () => { queryFn: async () => {

View File

@@ -1,14 +1,11 @@
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { fetch } from '@tauri-apps/plugin-http'; import { fetch } from '@tauri-apps/plugin-http';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { LoaderIcon } from '@shared/icons'; import { LoaderIcon } from '@shared/icons';
import { compactNumber } from '@utils/formater'; import { compactNumber } from '@utils/formater';
export function ZapCard() { export function ZapCard() {
const { ark } = useArk(); const ark = useArk();
const { status, data } = useQuery({ const { status, data } = useQuery({
queryKey: ['user-stats', ark.account.pubkey], queryKey: ['user-stats', ark.account.pubkey],
queryFn: async ({ signal }: { signal: AbortSignal }) => { queryFn: async ({ signal }: { signal: AbortSignal }) => {

View File

@@ -1,12 +1,10 @@
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { LoaderIcon } from '@shared/icons'; import { LoaderIcon } from '@shared/icons';
import { User } from '@shared/user'; import { User } from '@shared/user';
export function EditContactScreen() { export function EditContactScreen() {
const { ark } = useArk(); const ark = useArk();
const { status, data } = useQuery({ const { status, data } = useQuery({
queryKey: ['contacts'], queryKey: ['contacts'],
queryFn: async () => { queryFn: async () => {

View File

@@ -4,9 +4,7 @@ import { message } from '@tauri-apps/plugin-dialog';
import { useState } from 'react'; import { useState } from 'react';
import { useForm } from 'react-hook-form'; import { useForm } from 'react-hook-form';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { CheckCircleIcon, LoaderIcon, PlusIcon, UnverifiedIcon } from '@shared/icons'; import { CheckCircleIcon, LoaderIcon, PlusIcon, UnverifiedIcon } from '@shared/icons';
export function EditProfileScreen() { export function EditProfileScreen() {
@@ -15,7 +13,7 @@ export function EditProfileScreen() {
const [banner, setBanner] = useState(''); const [banner, setBanner] = useState('');
const [nip05, setNIP05] = useState({ verified: true, text: '' }); const [nip05, setNIP05] = useState({ verified: true, text: '' });
const { ark } = useArk(); const ark = useArk();
const { const {
register, register,
handleSubmit, handleSubmit,

View File

@@ -5,13 +5,11 @@ import { disable, enable, isEnabled } from '@tauri-apps/plugin-autostart';
import { isPermissionGranted, requestPermission } from '@tauri-apps/plugin-notification'; import { isPermissionGranted, requestPermission } from '@tauri-apps/plugin-notification';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { twMerge } from 'tailwind-merge'; import { twMerge } from 'tailwind-merge';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { DarkIcon, LightIcon, SystemModeIcon } from '@shared/icons'; import { DarkIcon, LightIcon, SystemModeIcon } from '@shared/icons';
export function GeneralSettingScreen() { export function GeneralSettingScreen() {
const { ark } = useArk(); const ark = useArk();
const [settings, setSettings] = useState({ const [settings, setSettings] = useState({
autoupdate: false, autoupdate: false,
autolaunch: false, autolaunch: false,

View File

@@ -3,18 +3,14 @@ import { minidenticon } from 'minidenticons';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { Link, useNavigate } from 'react-router-dom'; import { Link, useNavigate } from 'react-router-dom';
import { toast } from 'sonner'; import { toast } from 'sonner';
import { UserStats } from '@app/users/components/stats'; import { UserStats } from '@app/users/components/stats';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { NIP05 } from '@shared/nip05'; import { NIP05 } from '@shared/nip05';
import { displayNpub } from '@utils/formater'; import { displayNpub } from '@utils/formater';
import { useProfile } from '@utils/hooks/useProfile'; import { useProfile } from '@utils/hooks/useProfile';
export function UserProfile({ pubkey }: { pubkey: string }) { export function UserProfile({ pubkey }: { pubkey: string }) {
const { ark } = useArk(); const ark = useArk();
const { user } = useProfile(pubkey); const { user } = useProfile(pubkey);
const [followed, setFollowed] = useState(false); const [followed, setFollowed] = useState(false);

View File

@@ -1,8 +1,6 @@
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { fetch } from '@tauri-apps/plugin-http'; import { fetch } from '@tauri-apps/plugin-http';
import { LoaderIcon } from '@shared/icons'; import { LoaderIcon } from '@shared/icons';
import { compactNumber } from '@utils/formater'; import { compactNumber } from '@utils/formater';
export function UserStats({ pubkey }: { pubkey: string }) { export function UserStats({ pubkey }: { pubkey: string }) {

View File

@@ -2,11 +2,8 @@ import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk';
import { useInfiniteQuery } from '@tanstack/react-query'; import { useInfiniteQuery } from '@tanstack/react-query';
import { useCallback, useMemo } from 'react'; import { useCallback, useMemo } from 'react';
import { useParams } from 'react-router-dom'; import { useParams } from 'react-router-dom';
import { UserProfile } from '@app/users/components/profile'; import { UserProfile } from '@app/users/components/profile';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { ArrowRightCircleIcon, LoaderIcon } from '@shared/icons'; import { ArrowRightCircleIcon, LoaderIcon } from '@shared/icons';
import { import {
MemoizedRepost, MemoizedRepost,
@@ -14,12 +11,11 @@ import {
NoteSkeleton, NoteSkeleton,
UnknownNote, UnknownNote,
} from '@shared/notes'; } from '@shared/notes';
import { FETCH_LIMIT } from '@utils/constants'; import { FETCH_LIMIT } from '@utils/constants';
export function UserScreen() { export function UserScreen() {
const { pubkey } = useParams(); const { pubkey } = useParams();
const { ark } = useArk(); const ark = useArk();
const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } = const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } =
useInfiniteQuery({ useInfiniteQuery({
queryKey: ['user-posts', pubkey], queryKey: ['user-posts', pubkey],

View File

@@ -23,9 +23,7 @@ import {
normalizeRelayUrlSet, normalizeRelayUrlSet,
} from 'nostr-fetch'; } from 'nostr-fetch';
import { toast } from 'sonner'; import { toast } from 'sonner';
import { NDKCacheAdapterTauri } from '@libs/ark'; import { NDKCacheAdapterTauri } from '@libs/ark';
import { import {
Account, Account,
NDKCacheUser, NDKCacheUser,

View File

@@ -14,7 +14,6 @@ import Database from '@tauri-apps/plugin-sql';
import { LRUCache } from 'lru-cache'; import { LRUCache } from 'lru-cache';
import { NostrEvent } from 'nostr-fetch'; import { NostrEvent } from 'nostr-fetch';
import { matchFilter } from 'nostr-tools'; import { matchFilter } from 'nostr-tools';
import { NDKCacheEvent, NDKCacheEventTag, NDKCacheUser } from '@utils/types'; import { NDKCacheEvent, NDKCacheEventTag, NDKCacheUser } from '@utils/types';
export class NDKCacheAdapterTauri implements NDKCacheAdapter { export class NDKCacheAdapterTauri implements NDKCacheAdapter {

View File

@@ -7,20 +7,11 @@ import Database from '@tauri-apps/plugin-sql';
import { check } from '@tauri-apps/plugin-updater'; import { check } from '@tauri-apps/plugin-updater';
import Markdown from 'markdown-to-jsx'; import Markdown from 'markdown-to-jsx';
import { PropsWithChildren, createContext, useContext, useEffect, useState } from 'react'; import { PropsWithChildren, createContext, useContext, useEffect, useState } from 'react';
import { Ark } from '@libs/ark'; import { Ark } from '@libs/ark';
import { LoaderIcon } from '@shared/icons'; import { LoaderIcon } from '@shared/icons';
import { FETCH_LIMIT, QUOTES } from '@utils/constants'; import { FETCH_LIMIT, QUOTES } from '@utils/constants';
interface ArkContext { const ArkContext = createContext<Ark>(undefined);
ark: Ark;
}
const ArkContext = createContext<ArkContext>({
ark: undefined,
});
const ArkProvider = ({ children }: PropsWithChildren<object>) => { const ArkProvider = ({ children }: PropsWithChildren<object>) => {
const [ark, setArk] = useState<Ark>(undefined); const [ark, setArk] = useState<Ark>(undefined);
@@ -165,7 +156,7 @@ const ArkProvider = ({ children }: PropsWithChildren<object>) => {
); );
} }
return <ArkContext.Provider value={{ ark }}>{children}</ArkContext.Provider>; return <ArkContext.Provider value={ark}>{children}</ArkContext.Provider>;
}; };
const useArk = () => { const useArk = () => {

View File

@@ -2,9 +2,7 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
import { createRoot } from 'react-dom/client'; import { createRoot } from 'react-dom/client';
import { Toaster } from 'sonner'; import { Toaster } from 'sonner';
import { ArkProvider } from '@libs/ark/provider'; import { ArkProvider } from '@libs/ark/provider';
import App from './app'; import App from './app';
const queryClient = new QueryClient({ const queryClient = new QueryClient({

View File

@@ -2,16 +2,13 @@ import * as Avatar from '@radix-ui/react-avatar';
import { minidenticon } from 'minidenticons'; import { minidenticon } from 'minidenticons';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { twMerge } from 'tailwind-merge'; import { twMerge } from 'tailwind-merge';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { AccountMoreActions } from '@shared/accounts/more'; import { AccountMoreActions } from '@shared/accounts/more';
import { useNetworkStatus } from '@utils/hooks/useNetworkStatus'; import { useNetworkStatus } from '@utils/hooks/useNetworkStatus';
import { useProfile } from '@utils/hooks/useProfile'; import { useProfile } from '@utils/hooks/useProfile';
export function ActiveAccount() { export function ActiveAccount() {
const { ark } = useArk(); const ark = useArk();
const { user } = useProfile(ark.account.pubkey); const { user } = useProfile(ark.account.pubkey);
const isOnline = useNetworkStatus(); const isOnline = useNetworkStatus();

View File

@@ -2,11 +2,10 @@ import * as AlertDialog from '@radix-ui/react-alert-dialog';
import { useQueryClient } from '@tanstack/react-query'; import { useQueryClient } from '@tanstack/react-query';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { toast } from 'sonner'; import { toast } from 'sonner';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
export function Logout() { export function Logout() {
const { ark } = useArk(); const ark = useArk();
const navigate = useNavigate(); const navigate = useNavigate();
const queryClient = useQueryClient(); const queryClient = useQueryClient();

View File

@@ -1,6 +1,5 @@
import * as DropdownMenu from '@radix-ui/react-dropdown-menu'; import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { Logout } from '@shared/accounts/logout'; import { Logout } from '@shared/accounts/logout';
import { HorizontalDotsIcon } from '@shared/icons'; import { HorizontalDotsIcon } from '@shared/icons';

View File

@@ -1,13 +1,11 @@
import { Outlet, ScrollRestoration } from 'react-router-dom'; import { Outlet, ScrollRestoration } from 'react-router-dom';
import { twMerge } from 'tailwind-merge'; import { twMerge } from 'tailwind-merge';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { Navigation } from '@shared/navigation'; import { Navigation } from '@shared/navigation';
import { WindowTitleBar } from '@shared/titlebar'; import { WindowTitleBar } from '@shared/titlebar';
export function AppLayout() { export function AppLayout() {
const { ark } = useArk(); const ark = useArk();
return ( return (
<div <div

View File

@@ -1,11 +1,9 @@
import { Outlet, ScrollRestoration } from 'react-router-dom'; import { Outlet, ScrollRestoration } from 'react-router-dom';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { WindowTitleBar } from '@shared/titlebar'; import { WindowTitleBar } from '@shared/titlebar';
export function AuthLayout() { export function AuthLayout() {
const { ark } = useArk(); const ark = useArk();
return ( return (
<div className="flex h-screen w-screen flex-col"> <div className="flex h-screen w-screen flex-col">

View File

@@ -1,13 +1,11 @@
import { Link, NavLink, Outlet, useLocation } from 'react-router-dom'; import { Link, NavLink, Outlet, useLocation } from 'react-router-dom';
import { twMerge } from 'tailwind-merge'; import { twMerge } from 'tailwind-merge';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { ArrowLeftIcon } from '@shared/icons'; import { ArrowLeftIcon } from '@shared/icons';
import { WindowTitleBar } from '@shared/titlebar'; import { WindowTitleBar } from '@shared/titlebar';
export function NewLayout() { export function NewLayout() {
const { ark } = useArk(); const ark = useArk();
const location = useLocation(); const location = useLocation();
return ( return (

View File

@@ -1,11 +1,9 @@
import { Outlet, ScrollRestoration } from 'react-router-dom'; import { Outlet, ScrollRestoration } from 'react-router-dom';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { WindowTitleBar } from '@shared/titlebar'; import { WindowTitleBar } from '@shared/titlebar';
export function NoteLayout() { export function NoteLayout() {
const { ark } = useArk(); const ark = useArk();
return ( return (
<div className="flex h-screen w-screen flex-col bg-neutral-50 dark:bg-neutral-950"> <div className="flex h-screen w-screen flex-col bg-neutral-50 dark:bg-neutral-950">

View File

@@ -1,8 +1,6 @@
import { NavLink, Outlet, ScrollRestoration, useNavigate } from 'react-router-dom'; import { NavLink, Outlet, ScrollRestoration, useNavigate } from 'react-router-dom';
import { twMerge } from 'tailwind-merge'; import { twMerge } from 'tailwind-merge';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { import {
AdvancedSettingsIcon, AdvancedSettingsIcon,
ArrowLeftIcon, ArrowLeftIcon,
@@ -14,7 +12,7 @@ import {
import { WindowTitleBar } from '@shared/titlebar'; import { WindowTitleBar } from '@shared/titlebar';
export function SettingsLayout() { export function SettingsLayout() {
const { ark } = useArk(); const ark = useArk();
const navigate = useNavigate(); const navigate = useNavigate();
return ( return (

View File

@@ -1,9 +1,7 @@
import { Link, NavLink } from 'react-router-dom'; import { Link, NavLink } from 'react-router-dom';
import { twMerge } from 'tailwind-merge'; import { twMerge } from 'tailwind-merge';
import { ActiveAccount } from '@shared/accounts/active'; import { ActiveAccount } from '@shared/accounts/active';
import { ChatsIcon, ComposeIcon, HomeIcon, NwcIcon, RelayIcon } from '@shared/icons'; import { ChatsIcon, ComposeIcon, HomeIcon, NwcIcon, RelayIcon } from '@shared/icons';
import { compactNumber } from '@utils/formater'; import { compactNumber } from '@utils/formater';
export function Navigation() { export function Navigation() {

View File

@@ -2,7 +2,6 @@ import { useQuery } from '@tanstack/react-query';
import { fetch } from '@tauri-apps/plugin-http'; import { fetch } from '@tauri-apps/plugin-http';
import { memo } from 'react'; import { memo } from 'react';
import { twMerge } from 'tailwind-merge'; import { twMerge } from 'tailwind-merge';
import { UnverifiedIcon, VerifiedIcon } from '@shared/icons'; import { UnverifiedIcon, VerifiedIcon } from '@shared/icons';
interface NIP05 { interface NIP05 {

View File

@@ -1,12 +1,10 @@
import { NDKEvent } from '@nostr-dev-kit/ndk'; import { NDKEvent } from '@nostr-dev-kit/ndk';
import * as Tooltip from '@radix-ui/react-tooltip'; import * as Tooltip from '@radix-ui/react-tooltip';
import { createSearchParams, useNavigate } from 'react-router-dom'; import { createSearchParams, useNavigate } from 'react-router-dom';
import { FocusIcon, ReplyIcon } from '@shared/icons'; import { FocusIcon, ReplyIcon } from '@shared/icons';
import { NoteReaction } from '@shared/notes/actions/reaction'; import { NoteReaction } from '@shared/notes/actions/reaction';
import { NoteRepost } from '@shared/notes/actions/repost'; import { NoteRepost } from '@shared/notes/actions/repost';
import { NoteZap } from '@shared/notes/actions/zap'; import { NoteZap } from '@shared/notes/actions/zap';
import { WIDGET_KIND } from '@utils/constants'; import { WIDGET_KIND } from '@utils/constants';
import { useWidget } from '@utils/hooks/useWidget'; import { useWidget } from '@utils/hooks/useWidget';

View File

@@ -4,7 +4,6 @@ import { nip19 } from 'nostr-tools';
import { EventPointer } from 'nostr-tools/lib/types/nip19'; import { EventPointer } from 'nostr-tools/lib/types/nip19';
import { useState } from 'react'; import { useState } from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { HorizontalDotsIcon } from '@shared/icons'; import { HorizontalDotsIcon } from '@shared/icons';
export function MoreActions({ id, pubkey }: { id: string; pubkey: string }) { export function MoreActions({ id, pubkey }: { id: string; pubkey: string }) {

View File

@@ -3,9 +3,7 @@ import * as Popover from '@radix-ui/react-popover';
import { useState } from 'react'; import { useState } from 'react';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { toast } from 'sonner'; import { toast } from 'sonner';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { ReactionIcon } from '@shared/icons'; import { ReactionIcon } from '@shared/icons';
const REACTIONS = [ const REACTIONS = [
@@ -35,7 +33,7 @@ export function NoteReaction({ event }: { event: NDKEvent }) {
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
const [reaction, setReaction] = useState<string | null>(null); const [reaction, setReaction] = useState<string | null>(null);
const { ark } = useArk(); const ark = useArk();
const navigate = useNavigate(); const navigate = useNavigate();
const getReactionImage = (content: string) => { const getReactionImage = (content: string) => {

View File

@@ -5,9 +5,7 @@ import { useState } from 'react';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { toast } from 'sonner'; import { toast } from 'sonner';
import { twMerge } from 'tailwind-merge'; import { twMerge } from 'tailwind-merge';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { LoaderIcon, RepostIcon } from '@shared/icons'; import { LoaderIcon, RepostIcon } from '@shared/icons';
export function NoteRepost({ event }: { event: NDKEvent }) { export function NoteRepost({ event }: { event: NDKEvent }) {
@@ -15,7 +13,7 @@ export function NoteRepost({ event }: { event: NDKEvent }) {
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const [isRepost, setIsRepost] = useState(false); const [isRepost, setIsRepost] = useState(false);
const { ark } = useArk(); const ark = useArk();
const navigate = useNavigate(); const navigate = useNavigate();
const submit = async () => { const submit = async () => {

View File

@@ -8,17 +8,14 @@ import { QRCodeSVG } from 'qrcode.react';
import { useEffect, useRef, useState } from 'react'; import { useEffect, useRef, useState } from 'react';
import CurrencyInput from 'react-currency-input-field'; import CurrencyInput from 'react-currency-input-field';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { CancelIcon, ZapIcon } from '@shared/icons'; import { CancelIcon, ZapIcon } from '@shared/icons';
import { compactNumber, displayNpub } from '@utils/formater'; import { compactNumber, displayNpub } from '@utils/formater';
import { useProfile } from '@utils/hooks/useProfile'; import { useProfile } from '@utils/hooks/useProfile';
import { sendNativeNotification } from '@utils/notification'; import { sendNativeNotification } from '@utils/notification';
export function NoteZap({ event }: { event: NDKEvent }) { export function NoteZap({ event }: { event: NDKEvent }) {
const { ark } = useArk(); const ark = useArk();
const { user } = useProfile(event.pubkey); const { user } = useProfile(event.pubkey);
const [walletConnectURL, setWalletConnectURL] = useState<string>(null); const [walletConnectURL, setWalletConnectURL] = useState<string>(null);

View File

@@ -1,9 +1,7 @@
import { NDKEvent } from '@nostr-dev-kit/ndk'; import { NDKEvent } from '@nostr-dev-kit/ndk';
import { memo } from 'react'; import { memo } from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { User } from '@shared/user'; import { User } from '@shared/user';
import { NoteActions } from './actions'; import { NoteActions } from './actions';
export function ArticleNote({ event }: { event: NDKEvent }) { export function ArticleNote({ event }: { event: NDKEvent }) {

View File

@@ -1,6 +1,5 @@
import { NoteSkeleton } from '@shared/notes'; import { NoteSkeleton } from '@shared/notes';
import { User } from '@shared/user'; import { User } from '@shared/user';
import { useEvent } from '@utils/hooks/useEvent'; import { useEvent } from '@utils/hooks/useEvent';
export function ChildNote({ id, isRoot }: { id: string; isRoot?: boolean }) { export function ChildNote({ id, isRoot }: { id: string; isRoot?: boolean }) {

View File

@@ -8,11 +8,9 @@ import {
} from '@vidstack/react/player/layouts/default'; } from '@vidstack/react/player/layouts/default';
import { memo } from 'react'; import { memo } from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { DownloadIcon } from '@shared/icons'; import { DownloadIcon } from '@shared/icons';
import { NoteActions } from '@shared/notes'; import { NoteActions } from '@shared/notes';
import { User } from '@shared/user'; import { User } from '@shared/user';
import { fileType } from '@utils/nip94'; import { fileType } from '@utils/nip94';
export function FileNote({ event }: { event: NDKEvent }) { export function FileNote({ event }: { event: NDKEvent }) {

View File

@@ -8,9 +8,7 @@ import {
} from '@vidstack/react/player/layouts/default'; } from '@vidstack/react/player/layouts/default';
import { memo } from 'react'; import { memo } from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { DownloadIcon } from '@shared/icons'; import { DownloadIcon } from '@shared/icons';
import { fileType } from '@utils/nip94'; import { fileType } from '@utils/nip94';
export function FileKind({ tags }: { tags: NDKTag[] }) { export function FileKind({ tags }: { tags: NDKTag[] }) {

View File

@@ -1,5 +1,4 @@
import { memo } from 'react'; import { memo } from 'react';
import { useRichContent } from '@utils/hooks/useRichContent'; import { useRichContent } from '@utils/hooks/useRichContent';
export function TextKind({ content, textmode }: { content: string; textmode?: boolean }) { export function TextKind({ content, textmode }: { content: string; textmode?: boolean }) {

View File

@@ -1,6 +1,5 @@
import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk'; import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk';
import { memo } from 'react'; import { memo } from 'react';
import { import {
MemoizedArticleKind, MemoizedArticleKind,
MemoizedFileKind, MemoizedFileKind,
@@ -8,7 +7,6 @@ import {
NoteSkeleton, NoteSkeleton,
} from '@shared/notes'; } from '@shared/notes';
import { User } from '@shared/user'; import { User } from '@shared/user';
import { WIDGET_KIND } from '@utils/constants'; import { WIDGET_KIND } from '@utils/constants';
import { useEvent } from '@utils/hooks/useEvent'; import { useEvent } from '@utils/hooks/useEvent';
import { useWidget } from '@utils/hooks/useWidget'; import { useWidget } from '@utils/hooks/useWidget';

View File

@@ -1,5 +1,4 @@
import { memo } from 'react'; import { memo } from 'react';
import { WIDGET_KIND } from '@utils/constants'; import { WIDGET_KIND } from '@utils/constants';
import { useProfile } from '@utils/hooks/useProfile'; import { useProfile } from '@utils/hooks/useProfile';
import { useWidget } from '@utils/hooks/useWidget'; import { useWidget } from '@utils/hooks/useWidget';

View File

@@ -1,18 +1,15 @@
import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk'; import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk';
import { memo } from 'react'; import { memo } from 'react';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { ReplyIcon, RepostIcon } from '@shared/icons'; import { ReplyIcon, RepostIcon } from '@shared/icons';
import { ChildNote, TextKind } from '@shared/notes'; import { ChildNote, TextKind } from '@shared/notes';
import { User } from '@shared/user'; import { User } from '@shared/user';
import { WIDGET_KIND } from '@utils/constants'; import { WIDGET_KIND } from '@utils/constants';
import { formatCreatedAt } from '@utils/formater'; import { formatCreatedAt } from '@utils/formater';
import { useWidget } from '@utils/hooks/useWidget'; import { useWidget } from '@utils/hooks/useWidget';
export function NotifyNote({ event }: { event: NDKEvent }) { export function NotifyNote({ event }: { event: NDKEvent }) {
const { ark } = useArk(); const ark = useArk();
const { addWidget } = useWidget(); const { addWidget } = useWidget();
const thread = ark.getEventThread({ tags: event.tags }); const thread = ark.getEventThread({ tags: event.tags });

View File

@@ -2,7 +2,6 @@ import { downloadDir } from '@tauri-apps/api/path';
import { Window } from '@tauri-apps/api/window'; import { Window } from '@tauri-apps/api/window';
import { download } from '@tauri-apps/plugin-upload'; import { download } from '@tauri-apps/plugin-upload';
import { SyntheticEvent, useState } from 'react'; import { SyntheticEvent, useState } from 'react';
import { CheckCircleIcon, DownloadIcon } from '@shared/icons'; import { CheckCircleIcon, DownloadIcon } from '@shared/icons';
export function ImagePreview({ url }: { url: string }) { export function ImagePreview({ url }: { url: string }) {

View File

@@ -1,5 +1,4 @@
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { useOpenGraph } from '@utils/hooks/useOpenGraph'; import { useOpenGraph } from '@utils/hooks/useOpenGraph';
function isImage(url: string) { function isImage(url: string) {

View File

@@ -2,14 +2,12 @@ import { NDKEvent } from '@nostr-dev-kit/ndk';
import { useState } from 'react'; import { useState } from 'react';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import { toast } from 'sonner'; import { toast } from 'sonner';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { LoaderIcon } from '@shared/icons'; import { LoaderIcon } from '@shared/icons';
import { ReplyMediaUploader } from '@shared/notes'; import { ReplyMediaUploader } from '@shared/notes';
export function NoteReplyForm({ rootEvent }: { rootEvent: NDKEvent }) { export function NoteReplyForm({ rootEvent }: { rootEvent: NDKEvent }) {
const { ark } = useArk(); const ark = useArk();
const navigate = useNavigate(); const navigate = useNavigate();
const [value, setValue] = useState(''); const [value, setValue] = useState('');

View File

@@ -1,11 +1,9 @@
import * as Collapsible from '@radix-ui/react-collapsible'; import * as Collapsible from '@radix-ui/react-collapsible';
import { useState } from 'react'; import { useState } from 'react';
import { twMerge } from 'tailwind-merge'; import { twMerge } from 'tailwind-merge';
import { NavArrowDownIcon } from '@shared/icons'; import { NavArrowDownIcon } from '@shared/icons';
import { MemoizedTextKind, NoteActions, SubReply } from '@shared/notes'; import { MemoizedTextKind, NoteActions, SubReply } from '@shared/notes';
import { User } from '@shared/user'; import { User } from '@shared/user';
import { NDKEventWithReplies } from '@utils/types'; import { NDKEventWithReplies } from '@utils/types';
export function Reply({ export function Reply({

View File

@@ -1,15 +1,12 @@
import { NDKSubscription } from '@nostr-dev-kit/ndk'; import { NDKSubscription } from '@nostr-dev-kit/ndk';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { LoaderIcon } from '@shared/icons'; import { LoaderIcon } from '@shared/icons';
import { Reply } from '@shared/notes'; import { Reply } from '@shared/notes';
import { NDKEventWithReplies } from '@utils/types'; import { NDKEventWithReplies } from '@utils/types';
export function ReplyList({ eventId }: { eventId: string }) { export function ReplyList({ eventId }: { eventId: string }) {
const { ark } = useArk(); const ark = useArk();
const [data, setData] = useState<null | NDKEventWithReplies[]>(null); const [data, setData] = useState<null | NDKEventWithReplies[]>(null);
useEffect(() => { useEffect(() => {

View File

@@ -1,7 +1,6 @@
import { message, open } from '@tauri-apps/plugin-dialog'; import { message, open } from '@tauri-apps/plugin-dialog';
import { readBinaryFile } from '@tauri-apps/plugin-fs'; import { readBinaryFile } from '@tauri-apps/plugin-fs';
import { useState } from 'react'; import { useState } from 'react';
import { MediaIcon } from '@shared/icons'; import { MediaIcon } from '@shared/icons';
export function ReplyMediaUploader({ setValue }) { export function ReplyMediaUploader({ setValue }) {

View File

@@ -1,5 +1,4 @@
import { NDKEvent } from '@nostr-dev-kit/ndk'; import { NDKEvent } from '@nostr-dev-kit/ndk';
import { MemoizedTextKind, NoteActions } from '@shared/notes'; import { MemoizedTextKind, NoteActions } from '@shared/notes';
import { User } from '@shared/user'; import { User } from '@shared/user';

View File

@@ -1,9 +1,7 @@
import { NDKEvent, NDKKind, NostrEvent } from '@nostr-dev-kit/ndk'; import { NDKEvent, NDKKind, NostrEvent } from '@nostr-dev-kit/ndk';
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { memo } from 'react'; import { memo } from 'react';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { import {
MemoizedArticleKind, MemoizedArticleKind,
MemoizedFileKind, MemoizedFileKind,
@@ -14,7 +12,7 @@ import {
import { User } from '@shared/user'; import { User } from '@shared/user';
export function Repost({ event }: { event: NDKEvent }) { export function Repost({ event }: { event: NDKEvent }) {
const { ark } = useArk(); const ark = useArk();
const { const {
isLoading, isLoading,
isError, isError,

View File

@@ -1,12 +1,9 @@
import { NDKEvent } from '@nostr-dev-kit/ndk'; import { NDKEvent } from '@nostr-dev-kit/ndk';
import { memo } from 'react'; import { memo } from 'react';
import { twMerge } from 'tailwind-merge'; import { twMerge } from 'tailwind-merge';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { ChildNote, NoteActions } from '@shared/notes'; import { ChildNote, NoteActions } from '@shared/notes';
import { User } from '@shared/user'; import { User } from '@shared/user';
import { WIDGET_KIND } from '@utils/constants'; import { WIDGET_KIND } from '@utils/constants';
import { useRichContent } from '@utils/hooks/useRichContent'; import { useRichContent } from '@utils/hooks/useRichContent';
import { useWidget } from '@utils/hooks/useWidget'; 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 }) { export function TextNote({ event, className }: { event: NDKEvent; className?: string }) {
const { parsedContent } = useRichContent(event.content); const { parsedContent } = useRichContent(event.content);
const { addWidget } = useWidget(); const { addWidget } = useWidget();
const { ark } = useArk(); const ark = useArk();
const thread = ark.getEventThread({ tags: event.tags }); const thread = ark.getEventThread({ tags: event.tags });

View File

@@ -1,5 +1,4 @@
import { NDKEvent } from '@nostr-dev-kit/ndk'; import { NDKEvent } from '@nostr-dev-kit/ndk';
import { NoteActions } from '@shared/notes'; import { NoteActions } from '@shared/notes';
import { User } from '@shared/user'; import { User } from '@shared/user';

View File

@@ -1,6 +1,5 @@
import { HTMLProps, useContext } from 'react'; import { HTMLProps, useContext } from 'react';
import { twMerge } from 'tailwind-merge'; import { twMerge } from 'tailwind-merge';
import { AppWindowContext, WindowButton, WindowIcons } from '@shared/titlebar'; import { AppWindowContext, WindowButton, WindowIcons } from '@shared/titlebar';
export function Gnome({ className, ...props }: HTMLProps<HTMLDivElement>) { export function Gnome({ className, ...props }: HTMLProps<HTMLDivElement>) {

View File

@@ -1,6 +1,5 @@
import { HTMLProps, useContext, useEffect, useState } from 'react'; import { HTMLProps, useContext, useEffect, useState } from 'react';
import { twMerge } from 'tailwind-merge'; import { twMerge } from 'tailwind-merge';
import { AppWindowContext, WindowButton, WindowIcons } from '@shared/titlebar'; import { AppWindowContext, WindowButton, WindowIcons } from '@shared/titlebar';
export function MacOS({ className, ...props }: HTMLProps<HTMLDivElement>) { export function MacOS({ className, ...props }: HTMLProps<HTMLDivElement>) {

View File

@@ -1,6 +1,5 @@
import { HTMLProps, useContext } from 'react'; import { HTMLProps, useContext } from 'react';
import { twMerge } from 'tailwind-merge'; import { twMerge } from 'tailwind-merge';
import { AppWindowContext, WindowButton, WindowIcons } from '@shared/titlebar'; import { AppWindowContext, WindowButton, WindowIcons } from '@shared/titlebar';
export function Windows({ className, ...props }: HTMLProps<HTMLDivElement>) { export function Windows({ className, ...props }: HTMLProps<HTMLDivElement>) {

View File

@@ -1,5 +1,4 @@
import { Platform } from '@tauri-apps/plugin-os'; import { Platform } from '@tauri-apps/plugin-os';
import { AppWindowProvider, Gnome, MacOS, Windows } from '@shared/titlebar'; import { AppWindowProvider, Gnome, MacOS, Windows } from '@shared/titlebar';
export function WindowTitleBar({ platform }: { platform: Platform }) { export function WindowTitleBar({ platform }: { platform: Platform }) {

View File

@@ -3,11 +3,9 @@ import * as HoverCard from '@radix-ui/react-hover-card';
import { minidenticon } from 'minidenticons'; import { minidenticon } from 'minidenticons';
import { memo, useMemo } from 'react'; import { memo, useMemo } from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { RepostIcon } from '@shared/icons'; import { RepostIcon } from '@shared/icons';
import { NIP05 } from '@shared/nip05'; import { NIP05 } from '@shared/nip05';
import { MoreActions } from '@shared/notes'; import { MoreActions } from '@shared/notes';
import { displayNpub, formatCreatedAt } from '@utils/formater'; import { displayNpub, formatCreatedAt } from '@utils/formater';
import { useProfile } from '@utils/hooks/useProfile'; import { useProfile } from '@utils/hooks/useProfile';

View File

@@ -3,18 +3,15 @@ import { useInfiniteQuery } from '@tanstack/react-query';
import { FetchFilter } from 'nostr-fetch'; import { FetchFilter } from 'nostr-fetch';
import { useMemo } from 'react'; import { useMemo } from 'react';
import { VList } from 'virtua'; import { VList } from 'virtua';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { ArrowRightCircleIcon, LoaderIcon } from '@shared/icons'; import { ArrowRightCircleIcon, LoaderIcon } from '@shared/icons';
import { MemoizedArticleNote } from '@shared/notes'; import { MemoizedArticleNote } from '@shared/notes';
import { TitleBar, WidgetWrapper } from '@shared/widgets'; import { TitleBar, WidgetWrapper } from '@shared/widgets';
import { FETCH_LIMIT } from '@utils/constants'; import { FETCH_LIMIT } from '@utils/constants';
import { Widget } from '@utils/types'; import { Widget } from '@utils/types';
export function ArticleWidget({ widget }: { widget: Widget }) { export function ArticleWidget({ widget }: { widget: Widget }) {
const { ark } = useArk(); const ark = useArk();
const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } = const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } =
useInfiniteQuery({ useInfiniteQuery({
queryKey: ['article', widget.id], queryKey: ['article', widget.id],

View File

@@ -2,18 +2,15 @@ import { useInfiniteQuery } from '@tanstack/react-query';
import { FetchFilter } from 'nostr-fetch'; import { FetchFilter } from 'nostr-fetch';
import { useMemo } from 'react'; import { useMemo } from 'react';
import { VList } from 'virtua'; import { VList } from 'virtua';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { ArrowRightCircleIcon, LoaderIcon } from '@shared/icons'; import { ArrowRightCircleIcon, LoaderIcon } from '@shared/icons';
import { MemoizedFileNote } from '@shared/notes'; import { MemoizedFileNote } from '@shared/notes';
import { TitleBar, WidgetWrapper } from '@shared/widgets'; import { TitleBar, WidgetWrapper } from '@shared/widgets';
import { FETCH_LIMIT } from '@utils/constants'; import { FETCH_LIMIT } from '@utils/constants';
import { Widget } from '@utils/types'; import { Widget } from '@utils/types';
export function FileWidget({ widget }: { widget: Widget }) { export function FileWidget({ widget }: { widget: Widget }) {
const { ark } = useArk(); const ark = useArk();
const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } = const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } =
useInfiniteQuery({ useInfiniteQuery({
queryKey: ['media', widget.id], queryKey: ['media', widget.id],

View File

@@ -2,9 +2,7 @@ import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk';
import { useInfiniteQuery } from '@tanstack/react-query'; import { useInfiniteQuery } from '@tanstack/react-query';
import { useCallback, useMemo } from 'react'; import { useCallback, useMemo } from 'react';
import { VList } from 'virtua'; import { VList } from 'virtua';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { ArrowRightCircleIcon, LoaderIcon } from '@shared/icons'; import { ArrowRightCircleIcon, LoaderIcon } from '@shared/icons';
import { import {
MemoizedRepost, MemoizedRepost,
@@ -13,12 +11,11 @@ import {
UnknownNote, UnknownNote,
} from '@shared/notes'; } from '@shared/notes';
import { TitleBar, WidgetWrapper } from '@shared/widgets'; import { TitleBar, WidgetWrapper } from '@shared/widgets';
import { FETCH_LIMIT } from '@utils/constants'; import { FETCH_LIMIT } from '@utils/constants';
import { Widget } from '@utils/types'; import { Widget } from '@utils/types';
export function GroupWidget({ widget }: { widget: Widget }) { export function GroupWidget({ widget }: { widget: Widget }) {
const { ark } = useArk(); const ark = useArk();
const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } = const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } =
useInfiniteQuery({ useInfiniteQuery({
queryKey: ['groupfeeds', widget.id], queryKey: ['groupfeeds', widget.id],

View File

@@ -2,18 +2,15 @@ import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk';
import { useInfiniteQuery } from '@tanstack/react-query'; import { useInfiniteQuery } from '@tanstack/react-query';
import { useCallback, useMemo } from 'react'; import { useCallback, useMemo } from 'react';
import { VList } from 'virtua'; import { VList } from 'virtua';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { ArrowRightCircleIcon, LoaderIcon } from '@shared/icons'; import { ArrowRightCircleIcon, LoaderIcon } from '@shared/icons';
import { MemoizedRepost, MemoizedTextNote, UnknownNote } from '@shared/notes'; import { MemoizedRepost, MemoizedTextNote, UnknownNote } from '@shared/notes';
import { TitleBar, WidgetWrapper } from '@shared/widgets'; import { TitleBar, WidgetWrapper } from '@shared/widgets';
import { FETCH_LIMIT } from '@utils/constants'; import { FETCH_LIMIT } from '@utils/constants';
import { Widget } from '@utils/types'; import { Widget } from '@utils/types';
export function HashtagWidget({ widget }: { widget: Widget }) { export function HashtagWidget({ widget }: { widget: Widget }) {
const { ark } = useArk(); const ark = useArk();
const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } = const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } =
useInfiniteQuery({ useInfiniteQuery({
queryKey: ['hashtag', widget.id], queryKey: ['hashtag', widget.id],

View File

@@ -2,9 +2,7 @@ import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk';
import { useInfiniteQuery } from '@tanstack/react-query'; import { useInfiniteQuery } from '@tanstack/react-query';
import { useCallback, useMemo, useRef } from 'react'; import { useCallback, useMemo, useRef } from 'react';
import { VList, VListHandle } from 'virtua'; import { VList, VListHandle } from 'virtua';
import { useArk } from '@libs/ark'; import { useArk } from '@libs/ark';
import { ArrowRightCircleIcon, LoaderIcon } from '@shared/icons'; import { ArrowRightCircleIcon, LoaderIcon } from '@shared/icons';
import { import {
MemoizedRepost, MemoizedRepost,
@@ -13,11 +11,10 @@ import {
UnknownNote, UnknownNote,
} from '@shared/notes'; } from '@shared/notes';
import { LiveUpdater, TitleBar, WidgetWrapper } from '@shared/widgets'; import { LiveUpdater, TitleBar, WidgetWrapper } from '@shared/widgets';
import { FETCH_LIMIT } from '@utils/constants'; import { FETCH_LIMIT } from '@utils/constants';
export function NewsfeedWidget() { export function NewsfeedWidget() {
const { ark } = useArk(); const ark = useArk();
const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } = const { status, data, hasNextPage, isFetchingNextPage, fetchNextPage } =
useInfiniteQuery({ useInfiniteQuery({
queryKey: ['newsfeed'], queryKey: ['newsfeed'],

View File

@@ -1,6 +1,5 @@
import { useQuery } from '@tanstack/react-query'; import { useQuery } from '@tanstack/react-query';
import { VList } from 'virtua'; import { VList } from 'virtua';
import { LoaderIcon } from '@shared/icons'; import { LoaderIcon } from '@shared/icons';
import { import {
NostrBandUserProfile, NostrBandUserProfile,
@@ -8,7 +7,6 @@ import {
TitleBar, TitleBar,
WidgetWrapper, WidgetWrapper,
} from '@shared/widgets'; } from '@shared/widgets';
import { Widget } from '@utils/types'; import { Widget } from '@utils/types';
interface Response { interface Response {

Some files were not shown because too many files have changed in this diff Show More