add learning materials tab - #1132
Conversation
744383a to
20f2a36
Compare
| * Because of this, we pass the setSearchParams function from the parent | ||
| * rather than from a new "instance" of `useSearchParams`. | ||
| */ | ||
| setSearchParams: UseResourceSearchParamsProps["setSearchParams"] |
There was a problem hiding this comment.
I opened an issue about this in course-search-utils mitodl/course-search-utils#113 with more details.
|
@ChristopherChudzicki in the main nav menu we have "learning materials" as tbd. Are you planning to remove tbd and link to this tab? |
Good call. I'll add that. |
| }) => { | ||
| const [searchParams] = useSearchParams() | ||
| const activeTab = | ||
| TABS.find((t) => t.name === searchParams.get("tab")) ?? |
There was a problem hiding this comment.
Previously the active tab was based on resource_type query parameter.
Now the tabs are:
- All
tab="all"...resource_type=[] - Courses
tab="courses"...resource_type=["course"] - Programs
tab="programs"...resource_type=["program"] - Learning Materials
tab="learning-materials"...resource_type=["video", "podcast", "podcast_episode", "video_playlist", "learning_path"].
I was a little torn about whether to infer the tab based on resource_type query param, or use a separate tab param (which is what I ended up doing).
Using a separate tab really simplifies URLs like href: querifiedSearchUrl({ tab: "learning-materials" }), in the navbar.
My thought is that in the future when we add a "resource_type" sidebar facet (for the LM tab), the URLs would look like ?tab=learning-materials&resource_type="video".
What are the relevant tickets?
Closes https://github.com/mitodl/hq/issues/4620
Description (What does it do?)
This PR adds a "Learning Materials" tab to the search page and channel pages
Screenshots (if ap
How can this be tested?
On this branch: