diff --git a/src/components/note/connector.tsx b/src/components/note/connector.tsx index df09466f..23a37e30 100644 --- a/src/components/note/connector.tsx +++ b/src/components/note/connector.tsx @@ -4,10 +4,11 @@ import { RelayContext } from '@components/contexts/relay'; import { dateToUnix, hoursAgo } from '@utils/getDate'; +import { ReloadIcon } from '@radix-ui/react-icons'; import { useLocalStorage } from '@rehooks/local-storage'; import { memo, useCallback, useContext, useRef } from 'react'; -export const NoteConnector = memo(function NoteConnector() { +export const NoteConnector = memo(function NoteConnector({ setReload }: { setReload: any }) { const { db }: any = useContext(DatabaseContext); const relayPool: any = useContext(RelayContext); @@ -51,13 +52,16 @@ export const NoteConnector = memo(function NoteConnector() {

# following

-
-
- +
+ +
+ - + -

Online

+

Online

diff --git a/src/components/note/repost.tsx b/src/components/note/repost.tsx index 8dbb4aec..4bc3dcea 100644 --- a/src/components/note/repost.tsx +++ b/src/components/note/repost.tsx @@ -4,17 +4,10 @@ import { UserRepost } from '@components/note/atoms/userRepost'; import { Content } from '@components/note/content'; import { Placeholder } from '@components/note/placeholder'; -import * as Dialog from '@radix-ui/react-dialog'; import { LoopIcon } from '@radix-ui/react-icons'; import useLocalStorage from '@rehooks/local-storage'; -import dynamic from 'next/dynamic'; import { memo, useContext, useState } from 'react'; -const Modal = dynamic(() => import('@components/note/modal'), { - ssr: false, - loading: () => <>, -}); - export const Repost = memo(function Repost({ root, user }: { root: any; user: string }) { const relayPool: any = useContext(RelayContext); const [relays]: any = useLocalStorage('relays'); @@ -40,23 +33,15 @@ export const Repost = memo(function Repost({ root, user }: { root: any; user: st if (events !== null && Object.keys(events).length > 0) { return ( - - -
-
- -
- -
-
- {events[0].content && } +
+
+ +
+
- - - {events[0].content && } - - - +
+ {events[0].content && } +
); } else { return ( diff --git a/src/components/note/single.tsx b/src/components/note/single.tsx index e6d56b59..926bf63b 100644 --- a/src/components/note/single.tsx +++ b/src/components/note/single.tsx @@ -1,30 +1,12 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { Content } from '@components/note/content'; -import * as Dialog from '@radix-ui/react-dialog'; -import dynamic from 'next/dynamic'; import { memo } from 'react'; -const Modal = dynamic(() => import('@components/note/modal'), { - ssr: false, - loading: () => <>, -}); - -// eslint-disable-next-line @typescript-eslint/no-explicit-any export const Single = memo(function Single({ event }: { event: any }) { return ( - - -
- -
-
- - - - - - -
+
+ +
); }); diff --git a/src/pages/feed/following.tsx b/src/pages/feed/following.tsx index 177b4a4e..790ecdf3 100644 --- a/src/pages/feed/following.tsx +++ b/src/pages/feed/following.tsx @@ -15,19 +15,11 @@ import { Virtuoso } from 'react-virtuoso'; export default function Page() { const { db }: any = useContext(DatabaseContext); const [data, setData] = useState([]); + const [reload, setReload] = useState(false); const limit = useRef(30); const offset = useRef(0); - useEffect(() => { - const getData = async () => { - const result = await db.select(`SELECT * FROM cache_notes ORDER BY created_at DESC LIMIT ${limit.current}`); - setData(result); - }; - - getData().catch(console.error); - }, [db]); - const loadMore = useCallback(async () => { offset.current += limit.current; // next query @@ -49,6 +41,15 @@ export default function Page() { [data] ); + useEffect(() => { + const getData = async () => { + const result = await db.select(`SELECT * FROM cache_notes ORDER BY created_at DESC LIMIT ${limit.current}`); + setData(result); + }; + + getData().catch(console.error); + }, [db, reload]); + const computeItemKey = useCallback( (index: string | number) => { return data[index].id; @@ -58,7 +59,7 @@ export default function Page() { return (
- +