feat: update app description and enhance folder watching functionality

- Updated the app description in package.json and Cargo.toml to "Screenshots that organize themselves".
- Refactored the Tauri backend to introduce a new command for handling folder selection and watching for PNG file changes.
- Added utility functions for processing PNG files and managing the watcher state.
- Improved the frontend by integrating an ImageViewer component and setting up event listeners for search input focus.
This commit is contained in:
2025-04-13 16:19:51 +02:00
parent dcfed6a746
commit 349dcc2275
10 changed files with 215 additions and 157 deletions

View File

@@ -1,14 +1,22 @@
import { A } from "@solidjs/router";
import { IconSearch } from "@tabler/icons-solidjs";
import { listen } from "@tauri-apps/api/event";
import clsx from "clsx";
import Fuse from "fuse.js";
import { For, createEffect, createResource, createSignal } from "solid-js";
import {
For,
createEffect,
createResource,
createSignal,
onCleanup,
} from "solid-js";
import { ImageViewer } from "./components/ImageViewer";
import { SearchCardContact } from "./components/search-card/SearchCardContact";
import { SearchCardEvent } from "./components/search-card/SearchCardEvent";
import { SearchCardLocation } from "./components/search-card/SearchCardLocation";
import { SearchCardNote } from "./components/search-card/SearchCardNote";
import { type UserImage, getUserImages } from "./network";
import { getCardSize } from "./utils/getCardSize";
import { SearchCardContact } from "./components/search-card/SearchCardContact";
const getCardComponent = (item: UserImage) => {
switch (item.type) {
@@ -83,6 +91,7 @@ function App() {
});
createEffect(() => {
setSearchResults(data() ?? []);
fuze = new Fuse<UserImage>(data() ?? [], {
keys: [
{ name: "data.Name", weight: 2 },
@@ -98,10 +107,26 @@ function App() {
setSearchResults(fuze.search(query).map((s) => s.item));
};
let searchInputRef: HTMLInputElement | undefined;
createEffect(() => {
// Listen for the focus-search event from Tauri
const unlisten = listen("focus-search", () => {
if (searchInputRef) {
searchInputRef.focus();
}
});
onCleanup(() => {
unlisten.then((fn) => fn());
});
});
return (
<>
<main class="container pt-2">
<A href="login">login</A>
<ImageViewer />
<div class="px-4">
<div class="inline-flex justify-between w-full rounded-xl text-base leading-none outline-none bg-white border border-neutral-200 text-neutral-900">
<div class="appearance-none inline-flex justify-center items-center w-auto outline-none rounded-l-md px-2.5 text-gray-900">
@@ -111,6 +136,7 @@ function App() {
/>
</div>
<input
ref={searchInputRef}
type="text"
value={searchQuery()}
onInput={onInputChange}