diff --git a/apps/desktop2/src/app.tsx b/apps/desktop2/src/app.tsx index bdd3cbe0..f65c8ff6 100644 --- a/apps/desktop2/src/app.tsx +++ b/apps/desktop2/src/app.tsx @@ -1,12 +1,11 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { RouterProvider, createRouter } from "@tanstack/react-router"; -import { StrictMode } from "react"; import { type } from "@tauri-apps/plugin-os"; +import { StrictMode } from "react"; import ReactDOM from "react-dom/client"; import { routeTree } from "./router.gen"; // auto generated file import "./app.css"; -// Set up a Router instance const queryClient = new QueryClient(); const platform = type(); const router = createRouter({ diff --git a/apps/desktop2/src/routes/$account.home.tsx b/apps/desktop2/src/routes/$account.home.tsx index 8892eae6..193259ef 100644 --- a/apps/desktop2/src/routes/$account.home.tsx +++ b/apps/desktop2/src/routes/$account.home.tsx @@ -1,6 +1,6 @@ import { Column } from "@/components/column"; import { Toolbar } from "@/components/toolbar"; -import { ArrowLeftIcon, ArrowRightIcon, PlusSquareIcon } from "@lume/icons"; +import { ArrowLeftIcon, ArrowRightIcon } from "@lume/icons"; import { NostrQuery } from "@lume/system"; import type { ColumnEvent, LumeColumn } from "@lume/types"; import { createFileRoute } from "@tanstack/react-router"; @@ -45,17 +45,6 @@ function Screen() { getCurrent().emit("child-webview", { resize: true, direction: "x" }); }, []); - const openLumeStore = useDebouncedCallback(async () => { - await getCurrent().emit("columns", { - type: "add", - column: { - label: "store", - name: "Store", - content: "/store/official", - }, - }); - }, 150); - const add = useDebouncedCallback((column: LumeColumn) => { column.label = `${column.label}-${nanoid()}`; // update col label setColumns((prev) => [column, ...prev]); diff --git a/apps/desktop2/src/routes/$account.tsx b/apps/desktop2/src/routes/$account.tsx index 0b3f5b61..677117eb 100644 --- a/apps/desktop2/src/routes/$account.tsx +++ b/apps/desktop2/src/routes/$account.tsx @@ -1,12 +1,17 @@ import { User } from "@/components/user"; -import { ChevronDownIcon, ComposeFilledIcon, PlusIcon } from "@lume/icons"; +import { + ChevronDownIcon, + ComposeFilledIcon, + PlusIcon, + SearchIcon, +} from "@lume/icons"; import { LumeWindow, NostrAccount } from "@lume/system"; import { cn } from "@lume/utils"; import { Outlet, createFileRoute } from "@tanstack/react-router"; import { Menu, MenuItem, PredefinedMenuItem } from "@tauri-apps/api/menu"; import { getCurrent } from "@tauri-apps/api/window"; import { message } from "@tauri-apps/plugin-dialog"; -import { memo, useCallback } from "react"; +import { memo, useCallback, useState } from "react"; export const Route = createFileRoute("/$account")({ beforeLoad: async ({ params }) => { @@ -23,6 +28,17 @@ export const Route = createFileRoute("/$account")({ function Screen() { const { platform } = Route.useRouteContext(); + const openLumeStore = async () => { + await getCurrent().emit("columns", { + type: "add", + column: { + label: "store", + name: "Store", + content: "/store/official", + }, + }); + }; + return (
-
+
+ +
); }); + +const Search = memo(function Search() { + const [searchType, setSearchType] = useState<"notes" | "users">("notes"); + const [query, setQuery] = useState(""); + + const showContextMenu = useCallback(async (e: React.MouseEvent) => { + e.preventDefault(); + + const menuItems = await Promise.all([ + MenuItem.new({ + text: "Notes", + action: () => setSearchType("notes"), + }), + MenuItem.new({ + text: "Users", + action: () => setSearchType("users"), + }), + ]); + + const menu = await Menu.new({ + items: menuItems, + }); + + await menu.popup().catch((e) => console.error(e)); + }, []); + + return ( +
+ + setQuery(e.target.value)} + onKeyDown={(event) => { + if (event.key === "Enter") { + LumeWindow.openSearch(searchType, query); + } + }} + className="h-full w-full px-3 text-sm rounded-full border-none ring-0 focus:ring-0 focus:outline-none bg-transparent placeholder:text-black/50 dark:placeholder:text-black/50" + /> + +
+ ); +}); diff --git a/apps/desktop2/src/routes/nwc.lazy.tsx b/apps/desktop2/src/routes/nwc.lazy.tsx deleted file mode 100644 index 1454eebb..00000000 --- a/apps/desktop2/src/routes/nwc.lazy.tsx +++ /dev/null @@ -1,52 +0,0 @@ -import { ZapIcon } from "@lume/icons"; -import { NostrAccount } from "@lume/system"; -import { Container } from "@lume/ui"; -import { createLazyFileRoute } from "@tanstack/react-router"; -import { useState } from "react"; - -export const Route = createLazyFileRoute("/nwc")({ - component: Screen, -}); - -function Screen() { - const [uri, setUri] = useState(""); - const [isDone, setIsDone] = useState(false); - - const save = async () => { - const nwc = await NostrAccount.setWallet(uri); - setIsDone(nwc); - }; - - return ( - -
-
-
-

- Connect bitcoin wallet to - start zapping to your favorite content and creator. -

-
-
-
-
- -