+
diff --git a/packages/ui/src/account/active.tsx b/packages/ui/src/account/active.tsx
index 1075bd78..13af5852 100644
--- a/packages/ui/src/account/active.tsx
+++ b/packages/ui/src/account/active.tsx
@@ -17,33 +17,30 @@ export function ActiveAccount() {
)}`;
return (
-
-
-
-
-
-
-
-
-
+
+
-
-
-
+
+
+
+
+
+
);
}
diff --git a/packages/ui/src/editor/form.tsx b/packages/ui/src/editor/form.tsx
index f1008ef6..e242dd03 100644
--- a/packages/ui/src/editor/form.tsx
+++ b/packages/ui/src/editor/form.tsx
@@ -1,7 +1,7 @@
-import { MentionNote, useArk, useStorage } from "@lume/ark";
-import { TrashIcon } from "@lume/icons";
+import { MentionNote, useArk, useColumnContext, useStorage } from "@lume/ark";
+import { LoaderIcon, TrashIcon } from "@lume/icons";
import { NDKCacheUserProfile } from "@lume/types";
-import { cn, editorValueAtom } from "@lume/utils";
+import { COL_TYPES, cn, editorValueAtom } from "@lume/utils";
import { NDKEvent, NDKKind } from "@nostr-dev-kit/ndk";
import { useAtom } from "jotai";
import { useEffect, useRef, useState } from "react";
@@ -195,10 +195,13 @@ export function EditorForm() {
const [target, setTarget] = useState
();
const [index, setIndex] = useState(0);
const [search, setSearch] = useState("");
+ const [loading, setLoading] = useState(false);
const [editor] = useState(() =>
withMentions(withNostrEvent(withImages(withReact(createEditor())))),
);
+ const { addColumn } = useColumnContext();
+
const filters = contacts
?.filter((c) => c?.name?.toLowerCase().startsWith(search.toLowerCase()))
?.slice(0, 10);
@@ -234,19 +237,35 @@ export function EditorForm() {
};
const submit = async () => {
- const event = new NDKEvent(ark.ndk);
- event.kind = NDKKind.Text;
- event.content = serialize(editor.children);
+ try {
+ setLoading(true);
- const publish = await event.publish();
+ const event = new NDKEvent(ark.ndk);
+ event.kind = NDKKind.Text;
+ event.content = serialize(editor.children);
- if (!publish) toast.error("Failed to publish event, try again later.");
+ const publish = await event.publish();
- toast.success(
- `Event has been published successfully to ${publish.size} relays.`,
- );
+ if (publish) {
+ toast.success(
+ `Event has been published successfully to ${publish.size} relays.`,
+ );
- reset();
+ // add current post as column thread
+ addColumn({
+ kind: COL_TYPES.thread,
+ content: event.id,
+ title: "Thread",
+ });
+
+ setLoading(false);
+
+ return reset();
+ }
+ } catch (e) {
+ setLoading(false);
+ toast.error(String(e));
+ }
};
useEffect(() => {
@@ -300,7 +319,31 @@ export function EditorForm() {
setTarget(null);
}}
>
-
+
+
+
+ New Post
+
+
+
+
+
+
+
+
+
+
+
)}
-
);
diff --git a/packages/ui/src/layouts/home.tsx b/packages/ui/src/layouts/home.tsx
index a765a44f..7d65efc4 100644
--- a/packages/ui/src/layouts/home.tsx
+++ b/packages/ui/src/layouts/home.tsx
@@ -1,14 +1,13 @@
-import { ColumnProvider } from "@lume/ark";
import { Outlet } from "react-router-dom";
import { OnboardingModal } from "../onboarding/modal";
export function HomeLayout() {
return (
-
+ <>
-
+ >
);
}
diff --git a/packages/ui/src/navigation.tsx b/packages/ui/src/navigation.tsx
index 52f4cea8..c28feafd 100644
--- a/packages/ui/src/navigation.tsx
+++ b/packages/ui/src/navigation.tsx
@@ -1,34 +1,52 @@
import {
+ ComposeFilledIcon,
+ ComposeIcon,
DepotFilledIcon,
DepotIcon,
HomeFilledIcon,
HomeIcon,
NwcFilledIcon,
NwcIcon,
- PlusIcon,
RelayFilledIcon,
RelayIcon,
+ SettingsFilledIcon,
+ SettingsIcon,
} from "@lume/icons";
import { cn, editorAtom } from "@lume/utils";
-import { useSetAtom } from "jotai";
+import { useAtom } from "jotai";
import { useHotkeys } from "react-hotkeys-hook";
import { NavLink } from "react-router-dom";
import { ActiveAccount } from "./account/active";
export function Navigation() {
- const setIsEditorOpen = useSetAtom(editorAtom);
+ const [isEditorOpen, setIsEditorOpen] = useAtom(editorAtom);
useHotkeys("meta+n", () => setIsEditorOpen((state) => !state), []);
return (
-
-
- {({ isActive }) => (
- <>
+
+
+
+
+
+
+
+
+ {({ isActive }) => (
{isActive ? (
-
+
) : (
)}
-
- Home
-
- >
- )}
-
-
- {({ isActive }) => (
- <>
+ )}
+
+
+ {({ isActive }) => (
)}
-
- Relays
-
- >
- )}
-
-
- {({ isActive }) => (
- <>
+ )}
+
+
+ {({ isActive }) => (
)}
-
- Depot
-
- >
- )}
-
-
- {({ isActive }) => (
- <>
+ )}
+
+
+ {({ isActive }) => (
- {isActive ? (
-
- ) : (
-
- )}
+
-
- Wallet
-
- >
+ )}
+
+
+
+
+
+ {({ isActive }) => (
+
+ {isActive ? (
+
+ ) : (
+
+ )}
+
)}
-
-
-
-
);
}
diff --git a/packages/ui/src/onboarding/finish.tsx b/packages/ui/src/onboarding/finish.tsx
index d9c394e2..4d976df3 100644
--- a/packages/ui/src/onboarding/finish.tsx
+++ b/packages/ui/src/onboarding/finish.tsx
@@ -1,21 +1,33 @@
-import { CheckIcon } from "@lume/icons";
+import { useStorage } from "@lume/ark";
+import { CheckIcon, LoaderIcon } from "@lume/icons";
import { onboardingAtom } from "@lume/utils";
import { useQueryClient } from "@tanstack/react-query";
import { motion } from "framer-motion";
import { useSetAtom } from "jotai";
+import { useState } from "react";
export function OnboardingFinishScreen() {
+ const storage = useStorage();
const queryClient = useQueryClient();
const setOnboarding = useSetAtom(onboardingAtom);
+ const [loading, setLoading] = useState(false);
+
const finish = async () => {
+ setLoading(true);
+
const queryCache = queryClient.getQueryCache();
const queryKeys = queryCache.getAll().map((cache) => cache.queryKey);
+ await queryClient.refetchQueries({
+ queryKey: ["user", storage.account.pubkey],
+ });
+
for (const key of queryKeys) {
await queryClient.refetchQueries({ queryKey: key });
}
+ setLoading(false);
setOnboarding(false);
};
@@ -39,7 +51,7 @@ export function OnboardingFinishScreen() {
onClick={finish}
className="inline-flex items-center justify-center gap-2 w-44 font-medium h-11 rounded-xl bg-blue-100 text-blue-500 hover:bg-blue-200 dark:bg-blue-900 dark:text-blue-500 dark:hover:bg-blue-800"
>
- Close
+ {loading ?