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
Teacher dashboard navigation - tab switching in context #26333
Conversation
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 really like where this is going, and don't have a problem with merging this. Before you get too much further though, have you looked at react-router
? I believe PLC has used it, and it does something very similar to what you've implemented here.
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.
great progress! i left some ideas for refactoring, so let me know if you have questions or want to pair on anything
import React, {Component, PropTypes} from 'react'; | ||
import NavigationBar from '../NavigationBar'; | ||
|
||
export const teacherDashboardLinks = [ |
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 repeated in a few places, so i think it would do well as a type, similar to how we set up types in manageStudentsRedux. maybe it would be something like:
const TeacherDashboardNavType = {
MANAGE_STUDENTS: {
label: "Manage Students",
url: "manage_students"
},
...
}
@madelynkasula I consolidated the routes and pass in @tab. I'm going to merge this now and continue cleaning up/refactoring as the work progresses. Thanks for the feedback! |
Continuation of #26308
I set up a new teacher_dashboard_controller and a base route to
teacher_dashboard/sections/:section_id/
. I also route the versions of the links for each teacher dashboard tab back to the index and usewindow.history.replaceState(null, null, linkUrl);
to modify the url when a new tab is clicked. In the result, going tostudio.code.org/teacher_dashboard/sections/:section_id/
defaults to the progress tab (which is consistent with the current behavior on Pegasus) and going tostudio.code.org/teacher_dashboard/sections/:section_id/<tab_name>
will put you on the new teacher dashboard page with the correct tab selected. Ifstudio.code.org/teacher_dashboard/sections/:section_id/<tab_name>
is refreshed, you stay with the correct tab selected. Navigating back from the teacher_dashboard index will take you wherever you were before, not to the tab you most recently selected.