From 8aac349a2e9384d09d2261a5ee4d2a6a368eb4f9 Mon Sep 17 00:00:00 2001
From: reya <123083837+reyamir@users.noreply.github.com>
Date: Thu, 27 Jun 2024 14:20:51 +0700
Subject: [PATCH] feat: add search
---
apps/desktop2/src/app.tsx | 3 +-
apps/desktop2/src/routes/$account.home.tsx | 13 +-
apps/desktop2/src/routes/$account.tsx | 87 ++++++++++--
apps/desktop2/src/routes/nwc.lazy.tsx | 52 -------
apps/desktop2/src/routes/search.notes.tsx | 122 ++++++++++++++++
apps/desktop2/src/routes/search.tsx | 153 ++-------------------
package.json | 1 -
packages/system/src/commands.ts | 16 +++
packages/system/src/query.ts | 25 ++++
packages/system/src/window.ts | 12 +-
packages/utils/index.ts | 1 -
packages/utils/src/delay.ts | 1 -
pnpm-lock.yaml | 10 --
src-tauri/capabilities/main.json | 2 +-
src-tauri/gen/schemas/capabilities.json | 2 +-
src-tauri/src/main.rs | 2 +
src-tauri/src/nostr/event.rs | 69 ++++++++++
17 files changed, 341 insertions(+), 230 deletions(-)
delete mode 100644 apps/desktop2/src/routes/nwc.lazy.tsx
create mode 100644 apps/desktop2/src/routes/search.notes.tsx
delete mode 100644 packages/utils/src/delay.ts
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 (
-
+
+
+