Skip to content

Commit

Permalink
Show Back to Search unless NOT from search (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
blms committed Feb 20, 2025
1 parent e125678 commit aa03288
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
7 changes: 6 additions & 1 deletion client/src/components/ListPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ const ListPage = (props: Props) => {
actions={[{
as: Link,
asProps: (item) => ({
to: `${location.pathname}/${item.id}`
to: {
pathname: `${location.pathname}/${item.id}`,
state: {
fromList: true,
}
}
}),
name: 'navigate',
icon: 'arrow alternate circle right outline',
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/RecordPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const RecordPage = (props: Props) => {
const menuBarRef = useRef(null);
const { height: minHeight } = useSidebar(menuBarRef);

const { state: { fromSearch } = {} } = location;
const { state: { fromList } = {} } = location;

return (
<Container
Expand Down Expand Up @@ -81,7 +81,7 @@ const RecordPage = (props: Props) => {
{ props.renderTitle() }
</Menu.Item>
)}
{ fromSearch && (
{ !fromList && (
<Menu.Item
position='right'
>
Expand Down
9 changes: 1 addition & 8 deletions client/src/pages/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,7 @@ const Search = () => {
>
<SearchResults
as={Link}
asProps={(document) => ({
to: {
pathname: `/documents/${document.id}`,
state: {
fromSearch: true
}
}
})}
asProps={(document) => ({ to: `/documents/${document.id}` })}
link
renderDescription={(document) => document.artwork.date_descriptor}
renderEmptyList={() => null}
Expand Down

0 comments on commit aa03288

Please sign in to comment.