From 9b2de0f1b3e65486422116a0e448ffa25e858f2f Mon Sep 17 00:00:00 2001 From: Paige Williams Date: Wed, 11 Nov 2026 15:30:39 -0800 Subject: [PATCH 1/7] add react table; style search page; add types for Result --- client/app/components/checkbox.css | 21 +++ client/app/components/checkbox.tsx | 9 +- client/app/routes/explore.tsx | 16 +- client/app/routes/search.css | 81 +++++++++ client/app/routes/search.tsx | 257 ++++++++++++++++++++++++----- client/app/types.ts | 32 ++++ client/package-lock.json | 74 +++++++++ client/package.json | 1 + 8 files changed, 436 insertions(+), 55 deletions(-) create mode 100644 client/app/components/checkbox.css create mode 100644 client/app/routes/search.css create mode 100644 client/app/types.ts diff --git a/client/app/components/checkbox.css b/client/app/components/checkbox.css new file mode 100644 index 00000000..d717af5f --- /dev/null +++ b/client/app/components/checkbox.css @@ -0,0 +1,21 @@ +.checkbox-input { + height: 80%; + opacity: 0; + position: absolute; + width: 80%; + z-index: 9; +} + +.checkbox-input:checked ~ label { + background-color: var(--secondary_a); +} + +.checkbox-label { + background: var(--white); + border: 2px solid var(--secondary_a); + display: inline-block; + margin-bottom: 2px; + margin-right: 4px; + padding: 6px; + vertical-align: middle; +} \ No newline at end of file diff --git a/client/app/components/checkbox.tsx b/client/app/components/checkbox.tsx index ca3873dc..9484c4b1 100644 --- a/client/app/components/checkbox.tsx +++ b/client/app/components/checkbox.tsx @@ -1,3 +1,5 @@ +import './checkbox.css'; + const Checkbox = ({ label, onChange, @@ -8,15 +10,16 @@ const Checkbox = ({ checked: boolean; }) => { return ( -
+ <> onChange()} checked={checked} id={`check-${label.toLowerCase()}`} + className="checkbox-input" /> - {label} -
+ {label} + ); }; diff --git a/client/app/routes/explore.tsx b/client/app/routes/explore.tsx index 8dbee053..8f06768b 100644 --- a/client/app/routes/explore.tsx +++ b/client/app/routes/explore.tsx @@ -11,7 +11,6 @@ const ExploreRoute: React.FC = () => { handleSearch, handleQueryChange, categories, - query, } = useSearch(); const onSubmit = (e: React.FormEvent) => { @@ -20,7 +19,7 @@ const ExploreRoute: React.FC = () => { }; return ( -
+
@@ -93,12 +92,13 @@ const ExploreRoute: React.FC = () => {

Categories:

{CATEGORIES.map((category) => ( - handleCategoryTypeChange(category)} - /> +
+ handleCategoryTypeChange(category)} + /> +
))}
diff --git a/client/app/routes/search.css b/client/app/routes/search.css new file mode 100644 index 00000000..6d7fc4a8 --- /dev/null +++ b/client/app/routes/search.css @@ -0,0 +1,81 @@ +.category-name-col { + color: var(--secondary_a) !important; + font-size: 0.75em; + font-weight: bold; + text-transform: uppercase; +} + +.explore-form { + margin-top: calc(var(--margin_top) * 2); +} + +.query-input-group { + position: relative; +} + +#search-icon-label { + border-color: var(--secondary_a); + border-radius: 2em 0 0 2em; + border-right: none; + border-width: 2px; + background: var(--white); + padding: .375rem 1.125rem; +} + +.form-center { + text-align: center; +} + +input[type="text"], +.form-control, +input[type="password"] { + background: var(--white); + border-color: var(--secondary_a); + border-radius: 2em; + border-width: 2px; + font-size: 1.125em; + line-height: 2; +} + +.arrow-right.search-arrow, +.arrow-right.search-arrow::before, +.arrow-right.search-arrow::after { + background: var(--primary_a); +} + +.arrow-right.search-arrow { + position: absolute; + right: 2.5em; + top: 1.5625em; + pointer-events: none; +} + +#query-form-submit { + height: 100%; + opacity: 0; + pointer-events: all; + position: absolute; + right: 0; + top: 0; + width: 5em; + z-index: 9; +} + +#search-text { + border-radius: 0 2em 2em 0; + border-left: none; +} + +.query-input-group::after { + background: var(--secondary_a); + content: ''; + height: 2em; + position: absolute; + right: 6em; + top: .625em; + width: 1px; +} + +.highlight { + background-color: yellow; +} diff --git a/client/app/routes/search.tsx b/client/app/routes/search.tsx index 28ff8191..d96b4b47 100644 --- a/client/app/routes/search.tsx +++ b/client/app/routes/search.tsx @@ -1,7 +1,103 @@ -import React from "react"; +import React, { useMemo, useCallback } from "react"; +import { + createColumnHelper, + tableFeatures, + rowPaginationFeature, + createPaginatedRowModel, + useTable, +} from "@tanstack/react-table"; +import { Table as BTable } from "react-bootstrap"; + import { useSearch } from "../context/searchContext"; import Checkbox from "../components/checkbox"; import { CATEGORIES } from "../utils/constants"; +import type { Result } from "../types"; + +import "./search.css"; + +const features = tableFeatures({ + rowPaginationFeature, + paginatedRowModel: createPaginatedRowModel(), +}); + +const columnHelper = createColumnHelper(); + +const Table: React.FC<{ data: Result[]; columns: any[] }> = ({ + data, + columns, +}) => { + const table = useTable( + { + features, + columns, + data, + initialState: { pagination: { pageIndex: 1, pageSize: 25 } }, + debugTable: false, + }, + (state) => state, // default selector + ); + return ( +
+ + + {table.getRowModel().rows.map((row) => { + return ( + console.log(row.original.link)}> + {row.getAllCells().map((cell) => { + return ( + + + + ); + })} + + ); + })} + + +
+ + + + + +
Page
+ + {(table.state.pagination.pageIndex + 1).toLocaleString()} of{" "} + {table.getPageCount().toLocaleString()} + +
+
+
+ ); +}; const SearchRoute: React.FC = () => { const { @@ -13,50 +109,82 @@ const SearchRoute: React.FC = () => { query, } = useSearch(); - const onSubmit = (e: React.FormEvent) => { + const onSubmit = useCallback((e: React.FormEvent) => { e.preventDefault(); handleSearch(new FormData(e.currentTarget)); - }; + }, []); + + const columns = useMemo(() => { + return columnHelper.columns([ + columnHelper.accessor("category_name", { + cell: (info) => info.getValue(), + meta: { + className: "category-name-col", + }, + }), + columnHelper.accessor("name", { + cell: (info) => info.getValue(), + }), + columnHelper.accessor("description", { + cell: (info) => ( + + ), + }), + columnHelper.accessor("headline", { + cell: (info) => ( + + ), + }), + ]); + }, []); + return ( -
-
+
+
-
- - - +
+ + - - - - handleQueryChange(e.target.value)} - value={query} - /> - + viewBox="0 0 16 16" + > + + + + + handleQueryChange(e.target.value)} + value={query} + /> + + +
@@ -65,15 +193,56 @@ const SearchRoute: React.FC = () => {

Filter By:

{CATEGORIES.map((category) => ( - handleCategoryTypeChange(category)} - /> +
+ handleCategoryTypeChange(category)} + /> +
))}
+
+
+
+
+ + Results: {results.length} + {query ? ` Results for "${query}"` : " Results"} + +
+
+
+
+
+ +
+
+
+
+
+
+ + + ); }; diff --git a/client/app/types.ts b/client/app/types.ts new file mode 100644 index 00000000..4bd34f1c --- /dev/null +++ b/client/app/types.ts @@ -0,0 +1,32 @@ +const Category = { + Place: "Place", + Resource: "Resource", + Citations: "Citations", + Activity: "Activity", + Media: "Media" +} as const; + +export type Category = typeof Category[keyof typeof Category]; + +const ResultType = { + ResourcesActivityEvents: "Resourcesactivityevents", + Resources: "resources", + Media: "media", + Citations: "citations", + Places: "places" +} as const; + +export type ResultType = typeof ResultType[keyof typeof ResultType]; + +export type Result = { + category_name: Category; + description: string; + headline: string; + id: number; + image: string; + link: string; + name: string; + rank: number; + similarity: number; + type: ResultType; +} \ No newline at end of file diff --git a/client/package-lock.json b/client/package-lock.json index c945b63d..4f2f6f60 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -10,6 +10,7 @@ "dependencies": { "@react-router/dev": "^7.11.0", "@react-router/node": "^7.11.0", + "@tanstack/react-table": "^9.3.1", "axios": "^1.13.2", "bootstrap": "^5.3.8", "isbot": "^5", @@ -1848,6 +1849,70 @@ "@swc/counter": "^0.1.3" } }, + "node_modules/@tanstack/react-store": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/@tanstack/react-store/-/react-store-0.11.2.tgz", + "integrity": "sha512-oj5O5DmiMWE+ih+SioX2ayC1kbK7d3fpLx0B75fPJr9nY3zU+hoW010yr64qXsY/9fyiLVE2bn5mGNV3owm8RQ==", + "license": "MIT", + "dependencies": { + "@tanstack/store": "0.11.2", + "use-sync-external-store": "^1.6.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/@tanstack/react-table": { + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/@tanstack/react-table/-/react-table-9.3.1.tgz", + "integrity": "sha512-E6Ya5TnY6EaGyZYIUqig/29Lr/gJSAubQkLJFqiWkUl5nRCr0Xr9hvJot+NiRTtG+TzGxHTiqUW3bnLtQxlHug==", + "license": "MIT", + "dependencies": { + "@tanstack/react-store": "^0.11.2", + "@tanstack/table-core": "9.3.1" + }, + "engines": { + "node": ">=20" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "react": ">=18" + } + }, + "node_modules/@tanstack/store": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/@tanstack/store/-/store-0.11.2.tgz", + "integrity": "sha512-sJ4mjol8uQsHV0gOJzzjwXfh2Fwm+Sz0+8deqiTm4jGbMdjzNSW+xZCFm0kUa870uhd8yi+DpKnZb5Kc4apa0Q==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@tanstack/table-core": { + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/@tanstack/table-core/-/table-core-9.3.1.tgz", + "integrity": "sha512-zQvlxSNi2qGM3L4jh85Z6hqMfdIR5qOfD9KHOU32nuKFJGN0RlJ7UvV1lsPb1fPVhpFYI0VP3jJGxLdLDpTKjQ==", + "license": "MIT", + "dependencies": { + "@tanstack/store": "^0.11.2" + }, + "engines": { + "node": ">=20" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, "node_modules/@types/estree": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", @@ -4195,6 +4260,15 @@ "punycode": "^2.1.0" } }, + "node_modules/use-sync-external-store": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.7.0.tgz", + "integrity": "sha512-6L+EeigHMQhdaIPNIFUKwfWJSwWFQ8gJbJ2DLOs5sDIegTwR9fRxvnM3uciHKjIZhFz+KAv2emhWMRvDmMcY8A==", + "license": "MIT", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, "node_modules/valibot": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/valibot/-/valibot-1.2.0.tgz", diff --git a/client/package.json b/client/package.json index 5e1b0968..4de9f662 100644 --- a/client/package.json +++ b/client/package.json @@ -12,6 +12,7 @@ "dependencies": { "@react-router/dev": "^7.11.0", "@react-router/node": "^7.11.0", + "@tanstack/react-table": "^9.3.1", "axios": "^1.13.2", "bootstrap": "^5.3.8", "isbot": "^5", From f9a48dd54b53992ce58ac259913ed9e5b700f086 Mon Sep 17 00:00:00 2001 From: Paige Williams Date: Wed, 11 Nov 2026 16:53:10 -0800 Subject: [PATCH 2/7] update search form functionality on the search page clean up search types --- client/app/components/checkbox.css | 20 +++++++++-- client/app/components/checkbox.tsx | 5 +-- client/app/context/searchContext.tsx | 49 ++++++++++++++++++------- client/app/routes/explore.tsx | 4 +-- client/app/routes/search.tsx | 54 +++++++++++++++++++++++----- client/app/types.ts | 28 ++++++++++++--- client/app/utils/constants.ts | 1 - 7 files changed, 129 insertions(+), 32 deletions(-) diff --git a/client/app/components/checkbox.css b/client/app/components/checkbox.css index d717af5f..6d1c92ac 100644 --- a/client/app/components/checkbox.css +++ b/client/app/components/checkbox.css @@ -1,15 +1,29 @@ +.checkbox-control { + display: inline-block; + position: relative; +} + .checkbox-input { - height: 80%; + height: 16px; + left: 0; + margin: 0; opacity: 0; position: absolute; - width: 80%; - z-index: 9; + top: 50%; + transform: translateY(-50%); + width: 16px; + z-index: 1; } .checkbox-input:checked ~ label { background-color: var(--secondary_a); } +.checkbox-input:focus-visible + .checkbox-label { + outline: 2px solid var(--secondary_a); + outline-offset: 2px; +} + .checkbox-label { background: var(--white); border: 2px solid var(--secondary_a); diff --git a/client/app/components/checkbox.tsx b/client/app/components/checkbox.tsx index 9484c4b1..09241eda 100644 --- a/client/app/components/checkbox.tsx +++ b/client/app/components/checkbox.tsx @@ -10,16 +10,17 @@ const Checkbox = ({ checked: boolean; }) => { return ( - <> + onChange()} checked={checked} + aria-label={label} id={`check-${label.toLowerCase()}`} className="checkbox-input" /> {label} - + ); }; diff --git a/client/app/context/searchContext.tsx b/client/app/context/searchContext.tsx index 6d634690..93637815 100644 --- a/client/app/context/searchContext.tsx +++ b/client/app/context/searchContext.tsx @@ -1,18 +1,30 @@ -import React, { useCallback, use } from "react"; +import React, { + createContext, + useCallback, + use, + useState, + useMemo, +} from "react"; import type { ReactNode } from "react"; +import {useLocation} from "react-router"; +import type { FilterCategories, Result } from "../types"; +import { CategoryToFilterCategoryMap } from "../types"; import { useNavigate } from "react-router"; import { submitSearchAction } from "./action"; +import { CATEGORIES } from "../types"; type useSearch = { - categories: string[]; - results: any[]; + categories: FilterCategories[]; + results: Result[]; + filteredResults: Result[]; query: string; - handleCategoryTypeChange: (type: string) => void; - handleSearch: (formData: FormData) => Promise; + searchedQuery: string; + handleCategoryTypeChange: (type: FilterCategories) => void; + handleSearch: () => Promise; handleQueryChange: (query: string) => void; }; -const SearchContext = React.createContext(null); +const SearchContext = createContext(null); interface SearchProviderProps { children: ReactNode; @@ -20,15 +32,17 @@ interface SearchProviderProps { export const SearchProvider: React.FC = ({ children }) => { const navigate = useNavigate(); - const [categories, setCategories] = React.useState([]); - const [results, setResults] = React.useState([]); - const [query, setQuery] = React.useState(""); + const location = useLocation(); + const [categories, setCategories] = useState(CATEGORIES); + const [results, setResults] = useState([]); + const [query, setQuery] = useState(""); // search query input by the user + const [searchedQuery, setSearchedQuery] = useState(""); // the executed searched query const handleCategoryTypeChange = useCallback( - (type: string) => { + (type: FilterCategories) => { if (categories.includes(type)) { setCategories( - categories.filter((category: string) => category !== type), + categories.filter((category: FilterCategories) => category !== type), ); } else { setCategories([...categories, type]); @@ -46,16 +60,27 @@ export const SearchProvider: React.FC = ({ children }) => { const response = await submitSearchAction({ categories, query }); const { results } = response; setResults(results); - await navigate("/search"); + setSearchedQuery(query); // update the executed searched query + if (location.pathname !== "/search") { + await navigate("/search"); + } } catch (error) { console.error("Search failed", error); } }, [categories, query, navigate]); + const filteredResults = useMemo(() => { + return results.filter((result) => + categories.includes(CategoryToFilterCategoryMap[result.category_name]), + ); + }, [results, categories]); + const value = { categories, results, + filteredResults, query, + searchedQuery, handleCategoryTypeChange, handleSearch, handleQueryChange, diff --git a/client/app/routes/explore.tsx b/client/app/routes/explore.tsx index 8f06768b..d0a55bba 100644 --- a/client/app/routes/explore.tsx +++ b/client/app/routes/explore.tsx @@ -1,7 +1,7 @@ import React from "react"; import { useSearch } from "../context/searchContext"; import Checkbox from "../components/checkbox"; -import { CATEGORIES } from "../utils/constants"; +import { CATEGORIES } from "../types"; import "./explore.css"; @@ -15,7 +15,7 @@ const ExploreRoute: React.FC = () => { const onSubmit = (e: React.FormEvent) => { e.preventDefault(); - handleSearch(new FormData(e.currentTarget)); + handleSearch(); }; return ( diff --git a/client/app/routes/search.tsx b/client/app/routes/search.tsx index d96b4b47..7e3627af 100644 --- a/client/app/routes/search.tsx +++ b/client/app/routes/search.tsx @@ -10,7 +10,7 @@ import { Table as BTable } from "react-bootstrap"; import { useSearch } from "../context/searchContext"; import Checkbox from "../components/checkbox"; -import { CATEGORIES } from "../utils/constants"; +import { CATEGORIES } from "../types"; import type { Result } from "../types"; import "./search.css"; @@ -31,13 +31,50 @@ const Table: React.FC<{ data: Result[]; columns: any[] }> = ({ features, columns, data, - initialState: { pagination: { pageIndex: 1, pageSize: 25 } }, + initialState: { pagination: { pageIndex: 0, pageSize: 25 } }, debugTable: false, }, (state) => state, // default selector ); return (
+
+ + + + + +
Page
+ + {(table.state.pagination.pageIndex + 1).toLocaleString()} of{" "} + {table.getPageCount().toLocaleString()} + +
+
{table.getRowModel().rows.map((row) => { @@ -105,14 +142,15 @@ const SearchRoute: React.FC = () => { handleSearch, handleQueryChange, categories, - results, + filteredResults, query, + searchedQuery, } = useSearch(); const onSubmit = useCallback((e: React.FormEvent) => { e.preventDefault(); - handleSearch(new FormData(e.currentTarget)); - }, []); + handleSearch(); + }, [handleSearch]); const columns = useMemo(() => { return columnHelper.columns([ @@ -208,8 +246,8 @@ const SearchRoute: React.FC = () => {
- Results: {results.length} - {query ? ` Results for "${query}"` : " Results"} + Results: {filteredResults.length} + {searchedQuery ? ` Results for "${searchedQuery}"` : " Results"}
@@ -240,7 +278,7 @@ const SearchRoute: React.FC = () => {
-
+
diff --git a/client/app/types.ts b/client/app/types.ts index 4bd34f1c..1ba5c8af 100644 --- a/client/app/types.ts +++ b/client/app/types.ts @@ -1,21 +1,41 @@ const Category = { Place: "Place", Resource: "Resource", - Citations: "Citations", + Source: "Source", Activity: "Activity", Media: "Media" } as const; +const FilterCategories = { + places: "places", + resources: "resources", + sources: "sources", + activities: "activities", + media: "media" +} as const; + +export const CATEGORIES = Object.values(FilterCategories); + +export type FilterCategories = typeof FilterCategories[keyof typeof FilterCategories]; + export type Category = typeof Category[keyof typeof Category]; const ResultType = { - ResourcesActivityEvents: "Resourcesactivityevents", + Places: "places", Resources: "resources", - Media: "media", Citations: "citations", - Places: "places" + ResourcesActivityEvents: "Resourcesactivityevents", + Media: "media", } as const; +export const CategoryToFilterCategoryMap = { + Place: FilterCategories.places, + Resource: FilterCategories.resources, + Source: FilterCategories.sources, + Activity: FilterCategories.activities, + Media: FilterCategories.media +} as const; + export type ResultType = typeof ResultType[keyof typeof ResultType]; export type Result = { diff --git a/client/app/utils/constants.ts b/client/app/utils/constants.ts index bc1e3b89..e69de29b 100644 --- a/client/app/utils/constants.ts +++ b/client/app/utils/constants.ts @@ -1 +0,0 @@ -export const CATEGORIES = ["places", "resources", "activities", "sources", "media"]; \ No newline at end of file From b2e565bfc52b068066226dcd3d96d66834abffd3 Mon Sep 17 00:00:00 2001 From: Paige Williams Date: Thu, 12 Nov 2026 11:16:32 -0800 Subject: [PATCH 3/7] adjust styles for search and explore page --- client/app/App.css | 75 ++++++++++++++++++++++++++++++++--- client/app/index.css | 6 --- client/app/routes/explore.tsx | 10 +---- client/app/routes/search.tsx | 34 ++++++++++------ client/app/routes/welcome.css | 5 +++ client/app/routes/welcome.tsx | 4 +- 6 files changed, 100 insertions(+), 34 deletions(-) create mode 100644 client/app/routes/welcome.css diff --git a/client/app/App.css b/client/app/App.css index 1852faca..651ac9be 100644 --- a/client/app/App.css +++ b/client/app/App.css @@ -124,11 +124,7 @@ h2 { margin-top: var(--margin_top); } -p { - font-size: 1.25em; - letter-spacing: .05em; - margin: calc(var(--margin_top) / 2) 0 calc(var(--margin_bottom) * 2) -} + .explore-form-row { align-items: stretch; @@ -185,6 +181,72 @@ button.btn:hover { position: relative; } +.arrow-right, +.arrow-left { + background: var(--theme_color); + display: inline-flex; + height: 2px; + position: relative; + vertical-align: middle; + width: 24px; +} + +.arrow-right { + margin-left: 4px; +} + +.arrow-left { + margin-right: 4px; +} + + .arrow-right::before, + .arrow-right::after, + .arrow-left::before, + .arrow-left::after { + background: var(--theme_color); + content: ""; + height: 2px; + position: absolute; + transform-origin: 50% 50%; + width: 10px; + } + + .arrow-right::before, + .arrow-right::after { + right: -3px; + } + + .arrow-left::before, + .arrow-left::after { + left: -3px; + } + + .arrow-right::before, + .arrow-left::before { + top: -3px; + } + + .arrow-right::before { + transform: rotate(45deg); + } + + .arrow-left::before { + transform: rotate(-45deg); + } + + .arrow-right::after, + .arrow-left::after { + bottom: -3px; + } + + .arrow-right::after { + transform: rotate(-45deg); + } + + .arrow-left::after { + transform: rotate(45deg); + } + button.btn .arrow-right, button.btn .arrow-right::before, button.btn .arrow-right::after { @@ -225,6 +287,7 @@ button.btn:hover .arrow-right::after { padding-left: 40%; text-transform: uppercase; text-align: left; + margin: var(--margin_top) auto; } @media (min-width: 64em) { @@ -241,7 +304,7 @@ button.btn:hover .arrow-right::after { margin: 0; } -main.content-wrapper div.container { +main.content-wrapper div.welcome-container { min-width: 100vw; max-width: 100vw; margin: 0; diff --git a/client/app/index.css b/client/app/index.css index 5fd97966..04225e56 100644 --- a/client/app/index.css +++ b/client/app/index.css @@ -125,12 +125,6 @@ h2 { margin-top: var(--margin_top); } -p { - font-size: 1.25em; - letter-spacing: .05em; - margin: calc(var(--margin_top) / 2) 0 calc(var(--margin_bottom) * 2) -} - .explore-form-row { align-items: stretch; flex-direction: row; diff --git a/client/app/routes/explore.tsx b/client/app/routes/explore.tsx index d0a55bba..fead52dd 100644 --- a/client/app/routes/explore.tsx +++ b/client/app/routes/explore.tsx @@ -65,7 +65,7 @@ const ExploreRoute: React.FC = () => { { /> - -
(), }); const columnHelper = createColumnHelper(); @@ -84,7 +90,7 @@ const Table: React.FC<{ data: Result[]; columns: any[] }> = ({ return (
@@ -147,10 +153,13 @@ const SearchRoute: React.FC = () => { searchedQuery, } = useSearch(); - const onSubmit = useCallback((e: React.FormEvent) => { - e.preventDefault(); - handleSearch(); - }, [handleSearch]); + const onSubmit = useCallback( + (e: React.FormEvent) => { + e.preventDefault(); + handleSearch(); + }, + [handleSearch], + ); const columns = useMemo(() => { return columnHelper.columns([ @@ -207,7 +216,7 @@ const SearchRoute: React.FC = () => { {
-
-
+
+
Results: {filteredResults.length} - {searchedQuery ? ` Results for "${searchedQuery}"` : " Results"} + + {searchedQuery + ? ` Results for "${searchedQuery}"` + : " Results"} +
-
-
-
+
From 0fe95410f3c3d9851da70f921882a044938d5869 Mon Sep 17 00:00:00 2001 From: Paige Williams Date: Thu, 12 Nov 2026 14:36:09 -0800 Subject: [PATCH 5/7] remove unused imports --- client/app/context/searchContext.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/client/app/context/searchContext.tsx b/client/app/context/searchContext.tsx index a53a2087..fdd97bcb 100644 --- a/client/app/context/searchContext.tsx +++ b/client/app/context/searchContext.tsx @@ -3,12 +3,10 @@ import React, { useCallback, use, useState, - useMemo, } from "react"; import type { ReactNode } from "react"; import {useLocation} from "react-router"; import type { FilterCategories, Result } from "../types"; -import { CategoryToFilterCategoryMap } from "../types"; import { useNavigate } from "react-router"; import { submitSearchAction } from "./action"; import { CATEGORIES } from "../types"; From 5a2741071203df82b3588a8fa7b64d62596f3977 Mon Sep 17 00:00:00 2001 From: Paige Williams Date: Thu, 12 Nov 2026 15:46:59 -0800 Subject: [PATCH 6/7] add search input component to use on search and explore page --- client/app/components/header.tsx | 3 +- client/app/components/search-input.css | 44 +++++++++++++++++++ client/app/components/search-input.tsx | 59 ++++++++++++++++++++++++++ client/app/index.css | 55 ------------------------ client/app/routes/explore.tsx | 38 +++-------------- client/app/routes/search.css | 29 ------------- client/app/routes/search.tsx | 43 +++---------------- 7 files changed, 117 insertions(+), 154 deletions(-) create mode 100644 client/app/components/search-input.css create mode 100644 client/app/components/search-input.tsx diff --git a/client/app/components/header.tsx b/client/app/components/header.tsx index 97109d4d..5ac83ca4 100644 --- a/client/app/components/header.tsx +++ b/client/app/components/header.tsx @@ -1,9 +1,10 @@ import React from "react"; import { Link } from "react-router"; import LoginModal from "./login-modal"; -import "./header.css"; import { useLogin } from "../context/loginContext"; +import "./header.css"; + export type HeaderProps = { projIcons: { logo: string; diff --git a/client/app/components/search-input.css b/client/app/components/search-input.css new file mode 100644 index 00000000..f9692553 --- /dev/null +++ b/client/app/components/search-input.css @@ -0,0 +1,44 @@ +.query-input-group { + position: relative; +} + +.query-input-group.has-submit-button::after { + background: var(--secondary_a); + content: ""; + height: 2em; + position: absolute; + right: 6em; + top: 0.625em; + width: 1px; +} + +#query-form-submit { + height: 100%; + opacity: 0; + pointer-events: all; + position: absolute; + right: 0; + top: 0; + width: 5em; + z-index: 9; +} + +.query-input-group:has(#query-form-submit:focus-visible) { + outline: 2px solid var(--secondary_a); + outline-offset: 2px; + border-radius: 2em; +} + +#search-icon-label { + border-color: var(--secondary_a); + border-radius: 2em 0 0 2em; + border-right: none; + border-width: 2px; + background: var(--white); + padding: 0.375rem 1.125rem; +} + +#search-text { + border-radius: 0 2em 2em 0; + border-left: none; +} diff --git a/client/app/components/search-input.tsx b/client/app/components/search-input.tsx new file mode 100644 index 00000000..ba3684c2 --- /dev/null +++ b/client/app/components/search-input.tsx @@ -0,0 +1,59 @@ +import './search-input.css'; + +type SearchInputProps = { + onInputChange: (query: string) => void; + placeholder: string; + submitValue: string; + showSubmitButton: boolean; + value?: string; +}; + +const SearchInput: React.FC = ({ + onInputChange, + placeholder, + submitValue, + showSubmitButton, + value, +}) => { + return ( +
+ + + + + + + onInputChange(e.target.value)} + value={value} + /> + {showSubmitButton && } + +
+ ); +}; + +export default SearchInput; diff --git a/client/app/index.css b/client/app/index.css index 04225e56..b0459c5a 100644 --- a/client/app/index.css +++ b/client/app/index.css @@ -130,28 +130,16 @@ h2 { flex-direction: row; } -.explore-form-row > div { - /* width: 100%; */ -} .explore-form { margin-top: calc(var(--margin_top) * 2); } -.explore-input-group { - /* margin: var(--margin_top) 0 calc(var(--margin_bottom) * 2); */ - padding: 0 10%; -} - hr { font-size: 1.25em; margin: calc(var(--margin_top) * 2) 0 calc(var(--margin_bottom) * 2); } -.explore-form .btn { - /* border: 1px solid var(--primary_d): */ - /* position: relative; */ -} .button-wrapper { /* justify-content: ; */ @@ -369,11 +357,6 @@ main { min-height: calc(100vh - 96px); } - -main[data-theme="dark"] { - /* background: var(--black); */ -} - main[data-theme="light"] { background: var(--white); --btn_border: 2px solid var(--black); @@ -536,19 +519,6 @@ h5 { background: var(--white); } -#search-icon-label { - border-color: var(--secondary_a); - border-radius: 2em 0 0 2em; - border-right: none; - border-width: 2px; - background: var(--white); - padding: .375rem 1.125rem; -} - -#search-text { - border-radius: 0 2em 2em 0; - border-left: none; -} #export-links { @@ -564,16 +534,6 @@ h5 { text-align: right; } -.query-input-group::after { - background: var(--secondary_a); - content: ''; - height: 2em; - position: absolute; - right: 6em; - top: .625em; - width: 1px; -} - .arrow-right.search-arrow, .arrow-right.search-arrow::before, .arrow-right.search-arrow::after { @@ -587,21 +547,6 @@ h5 { pointer-events: none; } -.query-input-group { - position: relative; -} - -#query-form-submit { - height: 100%; - opacity: 0; - pointer-events: all; - position: absolute; - right: 0; - top: 0; - width: 5em; - z-index: 9; -} - /* Filter Category Checkboxs */ #filter-checkboxes { margin: var(--margin_top) auto; diff --git a/client/app/routes/explore.tsx b/client/app/routes/explore.tsx index 4698cd3b..d6455c06 100644 --- a/client/app/routes/explore.tsx +++ b/client/app/routes/explore.tsx @@ -1,6 +1,7 @@ import React, {useEffect} from "react"; import { useSearch } from "../context/searchContext"; import Checkbox from "../components/checkbox"; +import SearchInput from "../components/search-input"; import { CATEGORIES } from "../types"; import "./explore.css"; @@ -45,40 +46,13 @@ const ExploreRoute: React.FC = () => {

-
- - - - - - - + handleQueryChange(e.target.value)} + submitValue="GO" + showSubmitButton={false} /> -
{ return (
-
+
- - - - - - - handleQueryChange(e.target.value)} + submitValue="Apply Filter" + showSubmitButton={true} value={query} /> - -
From 85d1cd71e9c5883a5500e264c86b5c03c55be598 Mon Sep 17 00:00:00 2001 From: Paige Williams Date: Thu, 12 Nov 2026 15:59:26 -0800 Subject: [PATCH 7/7] add hidden table headers --- client/app/routes/search.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client/app/routes/search.tsx b/client/app/routes/search.tsx index c110275d..398de126 100644 --- a/client/app/routes/search.tsx +++ b/client/app/routes/search.tsx @@ -83,6 +83,14 @@ const Table: React.FC<{ data: Result[]; columns: any[] }> = ({
+
+ + + + + + + {table.getRowModel().rows.map((row) => { return (
CategoryNameDescriptionSearch snippet