diff --git a/apps/desktop2/src/app.css b/apps/desktop2/src/app.css
index 4511c0a5..821c7fab 100644
--- a/apps/desktop2/src/app.css
+++ b/apps/desktop2/src/app.css
@@ -24,7 +24,7 @@ input::-ms-clear {
}
media-controller {
- @apply w-full;
+ @apply w-full overflow-hidden rounded-xl;
}
@layer utilities {
diff --git a/apps/desktop2/src/app.tsx b/apps/desktop2/src/app.tsx
index 07b62724..e288989d 100644
--- a/apps/desktop2/src/app.tsx
+++ b/apps/desktop2/src/app.tsx
@@ -12,6 +12,7 @@ import { locale, platform } from "@tauri-apps/plugin-os";
import { PersistQueryClientProvider } from "@tanstack/react-query-persist-client";
import { createSyncStoragePersister } from "@tanstack/query-sync-storage-persister";
import { routeTree } from "./router.gen"; // auto generated file
+import { CancelCircleIcon, CheckCircleIcon, InfoCircleIcon } from "@lume/icons";
const queryClient = new QueryClient({
defaultOptions: {
@@ -72,7 +73,16 @@ if (!rootElement.innerHTML) {
persistOptions={{ persister }}
>
-
+ ,
+ info: ,
+ error: ,
+ }}
+ closeButton
+ theme="system"
+ />
diff --git a/apps/desktop2/src/components/accounts.tsx b/apps/desktop2/src/components/accounts.tsx
index de125ef6..34cea162 100644
--- a/apps/desktop2/src/components/accounts.tsx
+++ b/apps/desktop2/src/components/accounts.tsx
@@ -45,7 +45,8 @@ function Inactive({ pubkey }: { pubkey: string }) {
const changeAccount = async (npub: string) => {
const select = await ark.load_selected_account(npub);
- if (select) navigate({ to: "/$account/home", params: { account: npub } });
+ if (select)
+ navigate({ to: "/$account/home/local", params: { account: npub } });
};
return (
diff --git a/apps/desktop2/src/components/backup.tsx b/apps/desktop2/src/components/backup.tsx
index 24f68e55..1f2fa91c 100644
--- a/apps/desktop2/src/components/backup.tsx
+++ b/apps/desktop2/src/components/backup.tsx
@@ -104,7 +104,7 @@ export function BackupDialog() {
) : (
-
+
{({ isActive }) => (
{
- const events = await ark.get_events(
- "local",
- 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 (
-
-
-
- {currentDate}
-
-
-
-
-
-
-
- {isLoading || isRefetching ? (
-
-
-
- ) : !data.length ? (
-
-
-
-
- Empty newsfeed. Or you can go to{" "}
-
- Discover
-
-
-
-
-
- ) : (
-
- {data.map((item) => renderItem(item))}
-
- )}
-
- {hasNextPage ? (
-
- ) : null}
-
-
-
-
- );
-}
diff --git a/apps/desktop2/src/routes/$account/home.tsx b/apps/desktop2/src/routes/$account/home.tsx
new file mode 100644
index 00000000..fd13d9e5
--- /dev/null
+++ b/apps/desktop2/src/routes/$account/home.tsx
@@ -0,0 +1,68 @@
+import { GlobalIcon, 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
new file mode 100644
index 00000000..bd8c6772
--- /dev/null
+++ b/apps/desktop2/src/routes/$account/home/global.lazy.tsx
@@ -0,0 +1,91 @@
+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/home/local.lazy.tsx b/apps/desktop2/src/routes/$account/home/local.lazy.tsx
new file mode 100644
index 00000000..b815cf3c
--- /dev/null
+++ b/apps/desktop2/src/routes/$account/home/local.lazy.tsx
@@ -0,0 +1,108 @@
+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 { Link } from "@tanstack/react-router";
+import { createLazyFileRoute } from "@tanstack/react-router";
+import { Virtualizer } from "virtua";
+
+export const Route = createLazyFileRoute("/$account/home/local")({
+ component: Screen,
+});
+
+function Screen() {
+ const ark = useArk();
+ const { account } = Route.useParams();
+ const {
+ data,
+ hasNextPage,
+ isLoading,
+ isRefetching,
+ isFetchingNextPage,
+ fetchNextPage,
+ } = useInfiniteQuery({
+ queryKey: ["local_newsfeed", account],
+ initialPageParam: 0,
+ queryFn: async ({ pageParam }: { pageParam: number }) => {
+ const events = await ark.get_events(
+ "local",
+ 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.length ? (
+
+
+
+
+ Empty newsfeed. Or you view the{" "}
+
+ Global Newsfeed
+
+
+
+
+
+ ) : (
+
+ {data.map((item) => renderItem(item))}
+
+ )}
+
+ {hasNextPage ? (
+
+ ) : null}
+
+
+
+ );
+}
diff --git a/apps/desktop2/src/routes/auth/create/self.lazy.tsx b/apps/desktop2/src/routes/auth/create/self.lazy.tsx
index 8549ed6a..547045f1 100644
--- a/apps/desktop2/src/routes/auth/create/self.lazy.tsx
+++ b/apps/desktop2/src/routes/auth/create/self.lazy.tsx
@@ -26,7 +26,7 @@ function Create() {
try {
await ark.save_account(keys);
navigate({
- to: "/$account/home",
+ to: "/$account/home/local",
params: { account: keys.npub },
search: { onboarding: true },
replace: true,
diff --git a/apps/desktop2/src/routes/auth/import.lazy.tsx b/apps/desktop2/src/routes/auth/import.lazy.tsx
index 08f361e5..3de95d31 100644
--- a/apps/desktop2/src/routes/auth/import.lazy.tsx
+++ b/apps/desktop2/src/routes/auth/import.lazy.tsx
@@ -32,7 +32,7 @@ function Import() {
nsec: key,
});
navigate({
- to: "/$account/home",
+ to: "/$account/home/local",
params: { account: npub },
search: { onboarding: true },
replace: true,
diff --git a/apps/desktop2/src/routes/index.tsx b/apps/desktop2/src/routes/index.tsx
index 98d6fa86..49d14601 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",
+ to: "/$account/home/local",
params: { account: guest },
search: { guest: true },
replace: true,
@@ -26,7 +26,7 @@ export const Route = createFileRoute("/")({
const loadAccount = await ark.load_selected_account(account);
if (loadAccount) {
throw redirect({
- to: "/$account/home",
+ to: "/$account/home/local",
params: { account },
replace: true,
});
@@ -50,7 +50,7 @@ function Screen() {
const loadAccount = await ark.load_selected_account(npub);
if (loadAccount) {
navigate({
- to: "/$account/home",
+ to: "/$account/home/local",
params: { account: npub },
replace: true,
});
diff --git a/apps/desktop2/src/routes/users/-components/eventList.tsx b/apps/desktop2/src/routes/users/-components/eventList.tsx
index eabaada2..d07953e4 100644
--- a/apps/desktop2/src/routes/users/-components/eventList.tsx
+++ b/apps/desktop2/src/routes/users/-components/eventList.tsx
@@ -1,9 +1,8 @@
import { TextNote } from "@/components/text";
import { RepostNote } from "@/components/repost";
import { useArk } from "@lume/ark";
-import { ArrowRightCircleIcon, LoaderIcon } from "@lume/icons";
+import { ArrowRightCircleIcon, InfoIcon, LoaderIcon } from "@lume/icons";
import { Event, Kind } from "@lume/types";
-import { EmptyFeed } from "@lume/ui";
import { FETCH_LIMIT } from "@lume/utils";
import { useInfiniteQuery } from "@tanstack/react-query";
@@ -43,7 +42,10 @@ export function EventList({ id }: { id: string }) {
) : !data.length ? (
-