+
-
+
+
+
-
-
+
-
-
- );
-}
-
-function Navigation() {
- // @ts-ignore, useless
- const { account } = Route.useParams();
-
- return (
-
-
- {({ isActive }) => (
-
- {isActive ? (
-
- ) : (
-
- )}
- Home
-
- )}
-
-
- {({ isActive }) => (
-
- {isActive ? (
-
- ) : (
-
- )}
- Space
-
- )}
-
-
- {({ isActive }) => (
-
- {isActive ? (
-
- ) : (
-
- )}
- Activity
-
- )}
-
+
);
}
diff --git a/apps/desktop2/src/routes/$account/activity.lazy.tsx b/apps/desktop2/src/routes/$account/activity.lazy.tsx
deleted file mode 100644
index 9ae4e2cf..00000000
--- a/apps/desktop2/src/routes/$account/activity.lazy.tsx
+++ /dev/null
@@ -1,13 +0,0 @@
-import { createLazyFileRoute } from "@tanstack/react-router";
-
-export const Route = createLazyFileRoute("/$account/activity")({
- component: Activity,
-});
-
-function Activity() {
- return (
-
- );
-}
diff --git a/apps/desktop2/src/routes/$account/home.lazy.tsx b/apps/desktop2/src/routes/$account/home.lazy.tsx
new file mode 100644
index 00000000..d4f5e834
--- /dev/null
+++ b/apps/desktop2/src/routes/$account/home.lazy.tsx
@@ -0,0 +1,23 @@
+import { Newsfeed } from "@/components/newsfeed";
+import { createLazyFileRoute } from "@tanstack/react-router";
+import { VList } from "virtua";
+
+export const Route = createLazyFileRoute("/$account/home")({
+ component: Screen,
+});
+
+function Screen() {
+ return (
+
+ );
+}
diff --git a/apps/desktop2/src/routes/$account/home.tsx b/apps/desktop2/src/routes/$account/home.tsx
deleted file mode 100644
index 34cdf3ad..00000000
--- a/apps/desktop2/src/routes/$account/home.tsx
+++ /dev/null
@@ -1,68 +0,0 @@
-import { GlobalIcon, LoaderIcon, LocalIcon, RefreshIcon } from "@lume/icons";
-import { cn } from "@lume/utils";
-import { useQueryClient } from "@tanstack/react-query";
-import { Link } from "@tanstack/react-router";
-import { Outlet, createFileRoute } from "@tanstack/react-router";
-
-export const Route = createFileRoute("/$account/home")({
- component: Screen,
-});
-
-function Screen() {
- const queryClient = useQueryClient();
- const { account } = Route.useParams();
-
- const refresh = async () => {
- const queryKey = `${window.location.pathname.split("/").at(-1)}_newsfeed`;
- await queryClient.refetchQueries({ queryKey: [queryKey, account] });
- };
-
- return (
-
-
-
-
- {({ isActive }) => (
-
-
- Local
-
- )}
-
-
- {({ isActive }) => (
-
-
- Global
-
- )}
-
-
-
-
-
-
-
-
- );
-}
diff --git a/apps/desktop2/src/routes/$account/home/global.lazy.tsx b/apps/desktop2/src/routes/$account/home/global.lazy.tsx
deleted file mode 100644
index bd8c6772..00000000
--- a/apps/desktop2/src/routes/$account/home/global.lazy.tsx
+++ /dev/null
@@ -1,91 +0,0 @@
-import { RepostNote } from "@/components/repost";
-import { Suggest } from "@/components/suggest";
-import { TextNote } from "@/components/text";
-import { useArk } from "@lume/ark";
-import { LoaderIcon, ArrowRightCircleIcon, InfoIcon } from "@lume/icons";
-import { Event, Kind } from "@lume/types";
-import { FETCH_LIMIT } from "@lume/utils";
-import { useInfiniteQuery } from "@tanstack/react-query";
-import { createLazyFileRoute } from "@tanstack/react-router";
-import { Virtualizer } from "virtua";
-
-export const Route = createLazyFileRoute("/$account/home/global")({
- component: Screen,
-});
-
-function Screen() {
- const ark = useArk();
- const { account } = Route.useParams();
- const {
- data,
- hasNextPage,
- isLoading,
- isRefetching,
- isFetchingNextPage,
- fetchNextPage,
- } = useInfiniteQuery({
- queryKey: ["global_newsfeed", account],
- initialPageParam: 0,
- queryFn: async ({ pageParam }: { pageParam: number }) => {
- const events = await ark.get_events(
- "global",
- FETCH_LIMIT,
- pageParam,
- true,
- );
- return events;
- },
- getNextPageParam: (lastPage) => {
- const lastEvent = lastPage?.at(-1);
- if (!lastEvent) return;
- return lastEvent.created_at - 1;
- },
- select: (data) => data?.pages.flatMap((page) => page),
- refetchOnWindowFocus: false,
- });
-
- const renderItem = (event: Event) => {
- if (!event) return;
- switch (event.kind) {
- case Kind.Repost:
- return
;
- default:
- return
;
- }
- };
-
- return (
-
-
- {isLoading || isRefetching ? (
-
-
-
- ) : (
-
- {data.map((item) => renderItem(item))}
-
- )}
-
- {hasNextPage ? (
-
- ) : null}
-
-
-
- );
-}
diff --git a/apps/desktop2/src/routes/$account/space.lazy.tsx b/apps/desktop2/src/routes/$account/space.lazy.tsx
deleted file mode 100644
index 857a601e..00000000
--- a/apps/desktop2/src/routes/$account/space.lazy.tsx
+++ /dev/null
@@ -1,13 +0,0 @@
-import { createLazyFileRoute } from "@tanstack/react-router";
-
-export const Route = createLazyFileRoute("/$account/space")({
- component: Space,
-});
-
-function Space() {
- return (
-
- );
-}
diff --git a/apps/desktop2/src/routes/editor/index.tsx b/apps/desktop2/src/routes/editor/index.tsx
index 7552355c..01d852dd 100644
--- a/apps/desktop2/src/routes/editor/index.tsx
+++ b/apps/desktop2/src/routes/editor/index.tsx
@@ -149,11 +149,12 @@ function Screen() {
if (eventId) {
await sendNativeNotification("You've publish new post successfully.");
- return reset();
}
// stop loading
setLoading(false);
+ // reset form
+ reset();
} catch (e) {
setLoading(false);
await sendNativeNotification(String(e));
diff --git a/apps/desktop2/src/routes/index.tsx b/apps/desktop2/src/routes/index.tsx
index 5001db5c..2769ad37 100644
--- a/apps/desktop2/src/routes/index.tsx
+++ b/apps/desktop2/src/routes/index.tsx
@@ -15,7 +15,7 @@ export const Route = createFileRoute("/")({
case 0:
const guest = await ark.create_guest_account();
throw redirect({
- to: "/$account/home/local",
+ to: "/$account/home",
params: { account: guest },
search: { guest: true },
replace: true,
@@ -30,7 +30,7 @@ export const Route = createFileRoute("/")({
if (loadedAccount) {
throw redirect({
- to: "/$account/home/local",
+ to: "/$account/home",
params: { account },
replace: true,
});
@@ -54,7 +54,7 @@ function Screen() {
const loadAccount = await ark.load_selected_account(npub);
if (loadAccount) {
navigate({
- to: "/$account/home/local",
+ to: "/$account/home",
params: { account: npub },
replace: true,
});
diff --git a/apps/desktop2/src/routes/zap.$id.lazy.tsx b/apps/desktop2/src/routes/zap.$id.lazy.tsx
index b84a4c72..604f3fdc 100644
--- a/apps/desktop2/src/routes/zap.$id.lazy.tsx
+++ b/apps/desktop2/src/routes/zap.$id.lazy.tsx
@@ -48,7 +48,7 @@ function Screen() {
return (
-
+
diff --git a/packages/ark/package.json b/packages/ark/package.json
index d9253ec3..f5f8aff5 100644
--- a/packages/ark/package.json
+++ b/packages/ark/package.json
@@ -15,6 +15,7 @@
"@radix-ui/react-popover": "^1.0.7",
"@radix-ui/react-tooltip": "^1.0.7",
"@tanstack/react-query": "^5.24.1",
+ "@tanstack/react-router": "^1.18.1",
"get-urls": "^12.1.0",
"media-chrome": "^2.2.5",
"minidenticons": "^4.2.1",
diff --git a/packages/icons/src/settings.tsx b/packages/icons/src/settings.tsx
index ac69645d..4c343e87 100644
--- a/packages/icons/src/settings.tsx
+++ b/packages/icons/src/settings.tsx
@@ -7,14 +7,12 @@ export function SettingsIcon(