feat: refresh button
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import { Button } from "@kobalte/core/button";
|
||||
import { IconSearch, IconSettings } from "@tabler/icons-solidjs";
|
||||
import { IconRefresh, IconSearch, IconSettings } from "@tabler/icons-solidjs";
|
||||
import { listen } from "@tauri-apps/api/event";
|
||||
import Fuse from "fuse.js";
|
||||
import {
|
||||
@ -14,9 +14,8 @@ import { SearchCard } from "./components/search-card/SearchCard";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { ItemModal } from "./components/item-modal/ItemModal";
|
||||
import type { Shortcut } from "./components/shortcuts/hooks/useShortcutEditor";
|
||||
import type { sendImage, UserImage } from "./network";
|
||||
import type { UserImage } from "./network";
|
||||
import { useSearchImageContext } from "./contexts/SearchImageContext";
|
||||
import { ImageStatus } from "./components/image-status/ImageStatus";
|
||||
|
||||
export const Search = () => {
|
||||
const [searchResults, setSearchResults] = createSignal<UserImage[]>([]);
|
||||
@ -25,10 +24,7 @@ export const Search = () => {
|
||||
null,
|
||||
);
|
||||
|
||||
const [processingImage, setProcessingImage] =
|
||||
createSignal<Awaited<ReturnType<typeof sendImage>>>();
|
||||
|
||||
const { images } = useSearchImageContext();
|
||||
const { images, onRefetchImages } = useSearchImageContext();
|
||||
|
||||
let fuze = new Fuse<UserImage>(images() ?? [], {
|
||||
keys: [
|
||||
@ -115,6 +111,12 @@ export const Search = () => {
|
||||
class="appearance-none inline-flex w-full min-h-[40px] text-base bg-transparent rounded-l-md outline-none placeholder:text-gray-600"
|
||||
/>
|
||||
</div>
|
||||
<Button
|
||||
class="ml-2 p-2.5 bg-neutral-200 rounded-lg"
|
||||
onClick={onRefetchImages}
|
||||
>
|
||||
<IconRefresh size={20} />
|
||||
</Button>
|
||||
<Button
|
||||
as="a"
|
||||
href="/settings"
|
||||
@ -176,11 +178,6 @@ export const Search = () => {
|
||||
onClose={() => setSelectedItem(null)}
|
||||
/>
|
||||
)}
|
||||
|
||||
<ImageStatus
|
||||
processingImage={processingImage}
|
||||
onSetProcessingImage={setProcessingImage}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
Reference in New Issue
Block a user