From 2c279bb68f2dabd0ee1417c8a2bef071b48c4a3a Mon Sep 17 00:00:00 2001 From: Dmytro Kondakov Date: Sun, 23 Mar 2025 19:10:18 +0100 Subject: [PATCH] refactor(frontend): clean up App component and improve search functionality --- frontend/src-tauri/src/lib.rs | 1 + frontend/src/App.tsx | 97 +++++++++++++++-------------------- 2 files changed, 42 insertions(+), 56 deletions(-) diff --git a/frontend/src-tauri/src/lib.rs b/frontend/src-tauri/src/lib.rs index daa3d04..b30297d 100644 --- a/frontend/src-tauri/src/lib.rs +++ b/frontend/src-tauri/src/lib.rs @@ -7,6 +7,7 @@ use std::sync::Arc; use std::sync::Mutex; use tauri::AppHandle; use tauri::Emitter; +use tauri::TitleBarStyle; use tauri::{WebviewUrl, WebviewWindowBuilder}; struct WatcherState { diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 078f7d9..6d901c4 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -1,11 +1,10 @@ import { Search } from "@kobalte/core/search"; -import { A, useNavigate } from "@solidjs/router"; +import { useNavigate } from "@solidjs/router"; import { IconRefresh, IconSearch } from "@tabler/icons-solidjs"; import clsx from "clsx"; import Fuse from "fuse.js"; -import { createEffect, createResource, createSignal, For } from "solid-js"; +import { createEffect, createResource, createSignal } from "solid-js"; import { getUserImages } from "./network"; -import { ImageViewer } from "./components/ImageViewer"; type UserImages = Awaited>; @@ -46,40 +45,34 @@ function App() { return (
-
- { - if (item?.ImageID == null) { - console.error("ImageID was null"); - return; - } + { + if (item?.ImageID == null) { + console.error("ImageID was null"); + return; + } - nav(`/image/${item.ImageID}`); - }} - optionValue="ID" - optionLabel="ImageText" - placeholder="Search for stuff..." - itemComponent={(props) => ( - - - {props.item.rawValue.ImageText ?? ""} - - - )} - > - ( + + + {props.item.rawValue.ImageText ?? ""} + + + )} + > +
+ - - e.preventDefault()} - > - - - No results found - - - - -
- {/*
- Emoji selected: {emoji()?.emoji} {emoji()?.name} -
*/} - -
+
+ +
+ + {/* + No results found + */} +
+
+ {/*
@@ -122,7 +107,7 @@ function App() {
- {/* {JSON.stringify(images())} */} + {(image) => ( @@ -134,8 +119,8 @@ function App() { )} -
-
+
*/} +
footer