Back button added
Fixes issue:
Fixes #4
Changes:
A back button is included which could take back through the previous pages in the order of their visit.
It works good. 👍
One limitation is that the history is available only for a single session.
You may want to store the search history in a file, locally, in json or any convenient format, so, that this data can be used in further interesting features and is available through multiple sessions. Note that this will not compromise the user's privacy.
Additionally, you may place the back button at the leftmost side. The button must not be displayed initially when there is no history.
Kindly make the above changes and this feature will be good to be merged. 👍
Can you please explain the first point again? What I got is that, we need to store the search history of all sessions so that it can be used later. But I have this doubt that why do we need histories of previous sessions once they have been closed?
Though the current state of the feature looks good and conforms to the user's immediate need to go back, we are looking forward to preparing for future features.
If we store the history in a file, we may use this data to provide the user valuable insights like understanding the user's current level of knowledge and suggest learning paths.
Yes, in this case, the user may not be interested in seeing what he/ she searched for the previous day but having this will benefit in the long run. For this, you just need to store the stack array along with the timestamp in a file in appropriate format and make corresponding adjustments. 👍
Okay I got it now.. thanks :+1:
These changes have been made:
- The history feature is now accessible through localStorage API.
- Initially the back button is disabled. It can only be used when the user visits some pages.
- A github octicon is also added beside GitHub link.
Unknowingly I made some errors in the last commit. Now all such errors are removed and more features are added :
- The history feature is now accessible through localStorage API.
- Initially the back button is disabled. It can only be used when the user visits some pages. The appearance of top division is also changed so as to make back button at the leftmost corner where it should be.
- A github octicon is also added beside GitHub link.
- After visiting Favourites page also we can go back accordingly.
- Earlier when we visit Favourites page, the search bar contains the title of last page visited which is ideally wrong since we are not on that page. So that error is also removed.
Kindly review it and suggest any other improvement that can be made.
@AdiChat Kindly review it. All suggested changes have been made and conflicts are removed.
On searching, the OpenGenus logo (on the top left corner) is getting displaced and is moved behind (partially) the search bar. You need to resolve this UI issue. :+1:
Also, the back button is considering history for a particular tab that is different behavior for two tabs. Ideally, it should work uniformly for all tabs and across all sessions. Additionally, you may create a history page history.html to display the searches made along with the timestamp.
Kindly make the appropriate changes and it will be good to be merged. :+1:
This is the current scenario :
- If user opens more than one tab then due to visiting pages in different order, the back button of each tab will take through the respective page orders.
- If more than one tab is being used then the timestamps of pages visited are related to each other also i.e. if user visits
binary searchin one tab then the history page of another tab will contain this entry ofbinary searchalso even if that tab searched for it or not.
So we can either have totally independent relation (by having independent page order and timestamp of each tab) or a dependent relation (by having related timestamps and page orders of back button visit) or a combination of both (by having independent page visits due back button but dependent timestamps) between two tabs. @AdiChat Kindly guide what should be done in this case.
The simple solution would be to maintain a single global history irrespective of multiple tabs. To the end user, the back button might not work as expected. The end goal of storing history is to provide the user suggestions on what to learn/ explore next. Considering this, you can maintain a single history with timestamps without considering from which tab, it is coming from.