-
Notifications
You must be signed in to change notification settings - Fork 2
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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"
.
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.
👍 Works great!
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
propriate):How can this be tested?
On this branch: