mirror of
https://github.com/lumehq/lume.git
synced 2025-10-03 20:53:07 +02:00
feat: update format
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
"^@utils/(.*)$",
|
||||
"^[./]"
|
||||
],
|
||||
"importOrderSeparation": true,
|
||||
"importOrderSeparation": false,
|
||||
"importOrderSortSpecifiers": true,
|
||||
"plugins": ["@trivago/prettier-plugin-sort-imports", "prettier-plugin-tailwindcss"],
|
||||
"pluginSearchDirs": false
|
||||
|
@@ -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 {
|
||||
|
@@ -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');
|
||||
|
@@ -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<SetStateAction<string>>;
|
||||
}) {
|
||||
const { ark } = useArk();
|
||||
const ark = useArk();
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const uploadAvatar = async () => {
|
||||
|
@@ -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,
|
||||
|
@@ -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();
|
||||
|
@@ -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 () => {
|
||||
|
@@ -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 () => {
|
||||
|
@@ -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({
|
||||
|
@@ -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();
|
||||
|
@@ -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: {
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
import { BellIcon, HomeIcon, PlusIcon } from '@shared/icons';
|
||||
|
||||
export function TutorialWidgetScreen() {
|
||||
|
@@ -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],
|
||||
|
@@ -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 () => {
|
||||
|
@@ -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';
|
||||
|
||||
|
@@ -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<SetStateAction<string>>;
|
||||
}) {
|
||||
const { ark } = useArk();
|
||||
const ark = useArk();
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const uploadMedia = async () => {
|
||||
|
@@ -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 }) {
|
||||
|
@@ -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(() => {
|
||||
|
@@ -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 () => {
|
||||
|
@@ -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 () => {
|
||||
|
@@ -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<VListHandle>(null);
|
||||
const [selectedIndex, setSelectedIndex] = useState(-1);
|
||||
|
||||
const { ark } = useArk();
|
||||
const ark = useArk();
|
||||
const { status, data } = useQuery({
|
||||
queryKey: ['widgets'],
|
||||
queryFn: async () => {
|
||||
|
@@ -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);
|
||||
|
@@ -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 }) {
|
||||
|
@@ -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 () => {
|
||||
|
@@ -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 = {
|
||||
|
@@ -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)}`);
|
||||
|
@@ -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';
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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();
|
||||
|
||||
|
@@ -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('');
|
||||
|
@@ -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() {
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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 | string>(null);
|
||||
|
||||
const remove = async () => {
|
||||
|
@@ -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],
|
||||
|
@@ -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,}$/;
|
||||
|
@@ -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'],
|
||||
|
@@ -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],
|
||||
|
@@ -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() {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { useArk } from '@libs/ark';
|
||||
|
||||
export function AdvancedSettingScreen() {
|
||||
const { ark } = useArk();
|
||||
const ark = useArk();
|
||||
|
||||
const clearCache = async () => {
|
||||
await ark.clearCache();
|
||||
|
@@ -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);
|
||||
|
@@ -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 () => {
|
||||
|
@@ -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 }) => {
|
||||
|
@@ -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 =
|
||||
|
@@ -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 () => {
|
||||
|
@@ -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 }) => {
|
||||
|
@@ -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 () => {
|
||||
|
@@ -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,
|
||||
|
@@ -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,
|
||||
|
@@ -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);
|
||||
|
@@ -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 }) {
|
||||
|
@@ -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],
|
||||
|
@@ -23,9 +23,7 @@ import {
|
||||
normalizeRelayUrlSet,
|
||||
} from 'nostr-fetch';
|
||||
import { toast } from 'sonner';
|
||||
|
||||
import { NDKCacheAdapterTauri } from '@libs/ark';
|
||||
|
||||
import {
|
||||
Account,
|
||||
NDKCacheUser,
|
||||
|
@@ -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 {
|
||||
|
@@ -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<ArkContext>({
|
||||
ark: undefined,
|
||||
});
|
||||
const ArkContext = createContext<Ark>(undefined);
|
||||
|
||||
const ArkProvider = ({ children }: PropsWithChildren<object>) => {
|
||||
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 = () => {
|
||||
|
@@ -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({
|
||||
|
@@ -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();
|
||||
|
@@ -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();
|
||||
|
@@ -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';
|
||||
|
||||
|
@@ -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 (
|
||||
<div
|
||||
|
@@ -1,11 +1,9 @@
|
||||
import { Outlet, ScrollRestoration } from 'react-router-dom';
|
||||
|
||||
import { useArk } from '@libs/ark';
|
||||
|
||||
import { WindowTitleBar } from '@shared/titlebar';
|
||||
|
||||
export function AuthLayout() {
|
||||
const { ark } = useArk();
|
||||
const ark = useArk();
|
||||
|
||||
return (
|
||||
<div className="flex h-screen w-screen flex-col">
|
||||
|
@@ -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 (
|
||||
|
@@ -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 (
|
||||
<div className="flex h-screen w-screen flex-col bg-neutral-50 dark:bg-neutral-950">
|
||||
|
@@ -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 (
|
||||
|
@@ -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() {
|
||||
|
@@ -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 {
|
||||
|
@@ -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';
|
||||
|
||||
|
@@ -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 }) {
|
||||
|
@@ -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<string | null>(null);
|
||||
|
||||
const { ark } = useArk();
|
||||
const ark = useArk();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const getReactionImage = (content: string) => {
|
||||
|
@@ -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 () => {
|
||||
|
@@ -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<string>(null);
|
||||
|
@@ -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 }) {
|
||||
|
@@ -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 }) {
|
||||
|
@@ -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 }) {
|
||||
|
@@ -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[] }) {
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import { memo } from 'react';
|
||||
|
||||
import { useRichContent } from '@utils/hooks/useRichContent';
|
||||
|
||||
export function TextKind({ content, textmode }: { content: string; textmode?: boolean }) {
|
||||
|
@@ -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';
|
||||
|
@@ -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';
|
||||
|
@@ -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 });
|
||||
|
@@ -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 }) {
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
import { useOpenGraph } from '@utils/hooks/useOpenGraph';
|
||||
|
||||
function isImage(url: string) {
|
||||
|
@@ -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('');
|
||||
|
@@ -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({
|
||||
|
@@ -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 | NDKEventWithReplies[]>(null);
|
||||
|
||||
useEffect(() => {
|
||||
|
@@ -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 }) {
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import { NDKEvent } from '@nostr-dev-kit/ndk';
|
||||
|
||||
import { MemoizedTextKind, NoteActions } from '@shared/notes';
|
||||
import { User } from '@shared/user';
|
||||
|
||||
|
@@ -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,
|
||||
|
@@ -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 });
|
||||
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import { NDKEvent } from '@nostr-dev-kit/ndk';
|
||||
|
||||
import { NoteActions } from '@shared/notes';
|
||||
import { User } from '@shared/user';
|
||||
|
||||
|
@@ -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<HTMLDivElement>) {
|
||||
|
@@ -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<HTMLDivElement>) {
|
||||
|
@@ -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<HTMLDivElement>) {
|
||||
|
@@ -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 }) {
|
||||
|
@@ -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';
|
||||
|
||||
|
@@ -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],
|
||||
|
@@ -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],
|
||||
|
@@ -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],
|
||||
|
@@ -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],
|
||||
|
@@ -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'],
|
||||
|
@@ -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 {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user