From 92888fb414a6df133e53fa124b18264674b32ad7 Mon Sep 17 00:00:00 2001 From: Christine <132790780+aesteri@users.noreply.github.com> Date: Mon, 4 Nov 2024 03:13:08 +0900 Subject: [PATCH 1/3] fixed start/end date and route connection --- .env | 2 +- src/components/SearchBar.tsx | 32 +++------- src/routes/root.tsx | 115 ++++++++++------------------------- src/types/index.d.ts | 3 +- 4 files changed, 43 insertions(+), 109 deletions(-) diff --git a/.env b/.env index beafddf..3d0cb70 100644 --- a/.env +++ b/.env @@ -1 +1 @@ -VITE_API_URL=https://api-url:port \ No newline at end of file +VITE_API_URL=https://hytech.duckdns.org \ No newline at end of file diff --git a/src/components/SearchBar.tsx b/src/components/SearchBar.tsx index c3a753e..d2df3a0 100644 --- a/src/components/SearchBar.tsx +++ b/src/components/SearchBar.tsx @@ -29,22 +29,6 @@ function SearchBarWithFilter({ const { name } = e.target; const { value } = e.target; - const filt: SearchFilter = { - notes: "", - filename: "", - }; - - if (name == "") { - filt.notes = value; - filt.filename = value; - } - - setSearchFilters((prevFilters) => ({ - ...prevFilters, - notes: filt.notes, - filename: filt.filename, - [name]: value, - })); // Update local state based on input switch (name) { @@ -60,6 +44,9 @@ function SearchBarWithFilter({ case "afterDate": setAfterDate(value); break; + case "search_text": + setSearchTerm(value); + break; default: break; } @@ -69,14 +56,12 @@ function SearchBarWithFilter({ const handleClear = () => { setSearchTerm(""); setSearchFilters({ - notes: "", - filename: "", + searchText: "", location: "", eventType: "", beforeDate: "", afterDate: "", }); - setSearchTerm(""); setSelectedLocation(""); setSelectedEventType(""); setBeforeDate(""); @@ -85,7 +70,7 @@ function SearchBarWithFilter({ }; const handleSearch = () => { - setSearch((prev) => !prev); + setSearch(true); }; return ( @@ -94,16 +79,15 @@ function SearchBarWithFilter({

Search and Filter Data

- {/* Search Bar */} { handleFilterChange(e); - setSearchTerm(e.target.value); }} /> @@ -144,7 +128,7 @@ function SearchBarWithFilter({