feat: refactor

This commit is contained in:
2024-01-12 20:32:45 +07:00
parent 67c6177291
commit 0487b8a801
63 changed files with 345 additions and 777 deletions

View File

@@ -1,4 +1,4 @@
import { RepostNote, TextNote, useArk, useStorage } from "@lume/ark";
import { RepostNote, TextNote, useArk } from "@lume/ark";
import { ArrowRightCircleIcon, LoaderIcon } from "@lume/icons";
import { EmptyFeed } from "@lume/ui";
import { FETCH_LIMIT } from "@lume/utils";
@@ -9,7 +9,6 @@ import { CacheSnapshot, VList, VListHandle } from "virtua";
export function HomeRoute({ colKey }: { colKey: string }) {
const ark = useArk();
const storage = useStorage();
const ref = useRef<VListHandle>();
const cacheKey = `${colKey}-vlist`;
const queryClient = useQueryClient();
@@ -34,7 +33,7 @@ export function HomeRoute({ colKey }: { colKey: string }) {
const events = await ark.getInfiniteEvents({
filter: {
kinds: [NDKKind.Text, NDKKind.Repost],
authors: storage.account.contacts,
authors: ark.account.contacts,
},
limit: FETCH_LIMIT,
pageParam,
@@ -94,7 +93,7 @@ export function HomeRoute({ colKey }: { colKey: string }) {
};
}, []);
if (!storage.account.contacts.length) {
if (!ark.account.contacts.length) {
return (
<div className="px-3 mt-3">
<EmptyFeed />

View File

@@ -1,4 +1,4 @@
import { Column, useStorage } from "@lume/ark";
import { Column, useArk } from "@lume/ark";
import { TimelineIcon } from "@lume/icons";
import { IColumn } from "@lume/types";
import { EventRoute, UserRoute } from "@lume/ui";
@@ -9,7 +9,7 @@ import { HomeRoute } from "./home";
export function Timeline({ column }: { column: IColumn }) {
const colKey = `timeline-${column.id}`;
const storage = useStorage();
const ark = useArk();
const queryClient = useQueryClient();
const since = useRef(Math.floor(Date.now() / 1000));
@@ -35,9 +35,9 @@ export function Timeline({ column }: { column: IColumn }) {
<Column.Live
filter={{
kinds: [NDKKind.Text, NDKKind.Repost],
authors: !storage.account.contacts.length
? [storage.account.pubkey]
: storage.account.contacts,
authors: !ark.account.contacts.length
? [ark.account.pubkey]
: ark.account.contacts,
since: since.current,
}}
onClick={refreshTimeline}