-
Notifications
You must be signed in to change notification settings - Fork 0
feat: additional filtering for books #28
Conversation
|
This PR adds a lot of functionality, so it should be tested thoroughly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a thorough review, but I noticed a few things while taking a quick look:
When adding a few filters to a search, then closing the filter tab and reopening it, the filters are no longer shown in the fields - but they are still active, and there is no way to remove them from the search without refreshing the page.
Additionally, according to the project description, filter selections should be remembered even if the page is refreshed.
I think the question mark works, but it took me a few tries before I realised I had to hover and wait. I tried clicking it first, and nothing happened. So it's understandable once you get it, but not immediately obvious. |
Agree. Placement is fine, but just make it appear straight away when hovering and it's fine. Nevermind, apparently this is a limitation on the browser itself. However, a visible line of helper text under "Language" would be simpler and work everywhere. |
|
Since this PR adds a lot of functionality and covers different requirements, i figured i'd let Claude have a crack at reviewing (also it says in project 1 to use AI for quality control so this fits nicely). Here is the response: Commit 767901c (use sessionStorage to save filters) is a step in the right direction, but it only solves half of the problem. What it does now What is still missing How to fix it, and how it relates to #32 The filters should follow the same pattern. After #32 the state owner is App, so the fix is: // App (after #32 is merged)
const [filters, setFilters] = useState<BookFilters>(() =>
JSON.parse(sessionStorage.getItem("filters") ?? "{}"),
);
const handleFilterChange = (newFilters: BookFilters) => {
sessionStorage.setItem("filters", JSON.stringify(newFilters));
setFilters(newFilters);
};
const booksQuery = useBooks({ query, page, filters });and That fixes closing/reopening the panel, reload, and go-back in one change, and removes the mismatch between what the fields show and what is applied. Merge order |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested it and everything looks like it's working well! I like the addition of the badge showing the number of active filters!
I have also included a few minor stylistic tweaks (e.g. the search bar and filter button have a 2px height difference, which is a bit annoying).
Co-authored-by: Henrik Strøm-Andersen <hestro@stud.ntnu.no>
|
Adjusted the height now. Just used 48px instead of 44px so the number is divisible by 16. Just a stylistic choice, nothing more than that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect!
This PR adds filtering for books based on multiple attributes.
Filter books based on:
To be merged after #27.