Skip to content

Commit

Permalink
search fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gregordr committed May 27, 2024
1 parent b416202 commit c782a54
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion frontend/src/Components/Shared/PhotoGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function Photo(props: any) {
!!(props.searchByImageEnabled) && <IconButton
className={classes.searchButton}
style={{ opacity: opacity * 1.5 }}
onClick={(e) => { props.searchByImageId(); e.stopPropagation() }}
onClick={(e) => { props.history.push(); props.searchByImageId(); e.stopPropagation() }}
onMouseOver={props.hoverEventHandler} >
<Search style={{ fontSize: "28", color: "white" }}></Search>
</IconButton>
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/Components/Shared/PhotoPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export default function PhotoPage(props: { handleDrawerToggle: () => void; drawe
};

useEffect(() => {
history.push(rawSearchQuery === "" ? {} : { search: qs.stringify({ search: rawSearchQuery }) })
// history.push(rawSearchQuery === "" ? {} : { search: qs.stringify({ search: rawSearchQuery }) })
setPhotos([])
fetchPhotos();
fetchAlbums();
Expand Down Expand Up @@ -339,22 +339,22 @@ export default function PhotoPage(props: { handleDrawerToggle: () => void; drawe

const searchByText = (text: string) => {
setSearchBarText(text)
history.push({ search: qs.stringify({ search: text }) })
history.replace({ search: qs.stringify({ search: text }) })
}

const searchByTag = (tag: string) => {
setSearchBarText(searchTypes.tag + tag)
history.push({ search: qs.stringify({ search: searchTypes.tag + tag }) })
history.replace({ search: qs.stringify({ search: searchTypes.tag + tag }) })
}

const searchByImageId = (id: string) => {
setSearchBarText(searchTypes.image + id)
history.push({ search: qs.stringify({ search: searchTypes.image + id }) })
history.replace({ search: qs.stringify({ search: searchTypes.image + id }) })
}

const searchByFace = (id: string, box: Box) => {
setSearchBarText(searchTypes.face + id + "||" + box.toJSON())
history.push({ search: qs.stringify({ search: searchTypes.face + id + "||" + box.toJSON() }) })
history.replace({ search: qs.stringify({ search: searchTypes.face + id + "||" + box.toJSON() }) })
}

const viewButtonFunctions = {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/Components/Shared/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default function AutocompleteSearchBar(props: any) {
params.inputProps.onChange({ target: { value: newValue } });
setValue(newValue)
}}
onRequestSearch={props.onRequestSearch}
// onRequestSearch={props.onRequestSearch}
/>
<div ref={params.InputProps.ref}>
<div {...params.inputProps} />
Expand Down

0 comments on commit c782a54

Please sign in to comment.