Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Searchbox: History for recently searched items #622

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Dlurak
Copy link
Collaborator

@Dlurak Dlurak commented Oct 2, 2024

Description

Add a history to the searchbox.
There are a few things I'm not sure about.

  • Should we use a icon by the poi class like I've done it or should we use a icon to indicate that it is from the search history?
  • Should we prioritize objects which the user searched for multiple times or favor objects the user searched for recently like I've done it?

TODO:

  • If he user searches for something that is suggested from the history it is shown multiple times: Once in the history and once in the geocoder results. We should remove one of those two. But which one?

Copy link

vercel bot commented Oct 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
osmapp ✅ Ready (Inspect) Visit Preview Oct 2, 2024 2:00pm

@zbycz
Copy link
Owner

zbycz commented Oct 7, 2024

👍 👍 👍

Should we use a icon by the poi class like I've done it or should we use a icon to indicate that it is from the search history?

I would prefer a history icon, so the user knows it is their history. This way it is easier for them to remember it and be sure it is the thing they want (because they wanted it last time). It removes some of the cognitive load for them.

I suggest this icon: import HistoryIcon from '@mui/icons-material/History';

Should we prioritize objects which the user searched for multiple times or favor objects the user searched for recently like I've done it?

I tested current version, and I am not sure myself. Both sounds good. I find the "most recent first" slightly better.

If the user searches for something that is suggested from the history it is shown multiple times: Once in the history and once in the geocoder results. We should remove one of those two. But which one?

Good point, I would remove the one from geocoder. It shows later and user also would have to use some congnitive load to decide if this is what they want. On the other hand, historical result should recognizable easier.

Comment on lines +18 to +25
export const getSkeleton = (
option: GeocoderOption | HistoryOption,
): Feature => {
if (option.type === 'history') {
const { history } = option;
return {
center: history.geometry.coordinates,
type: 'Feature',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to create another function getHistorySkeleton and place it in the src/components/SearchBox/options/history.tsx file?

btw, I think skeleton from search is not much used nowadays. It could be enough to use object with type+center only, as these are the only keys useUpdatePreviewMarker works with.

@@ -110,10 +117,13 @@ export const onSelectedFactory =
overpassOptionSelected(option, setOverpassLoading, bbox, showToast);
break;
case 'geocoder':
geocoderOptionSelected(option, setFeature);
geocoderOptionSelected(option, setFeature, addToHistoryOption);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future, I would like all the Option types to be saved to history after they are selected. There is no reason why Preset or OsmOption shouldn't be offered as well.

Probably leave that to a followup PR. Maybe after #621 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants