Skip to content
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

Merged
merged 5 commits into from Dec 13, 2018

Conversation

Erin007
Copy link
Contributor

@Erin007 Erin007 commented Dec 12, 2018

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 use window.history.replaceState(null, null, linkUrl); to modify the url when a new tab is clicked. In the result, going to studio.code.org/teacher_dashboard/sections/:section_id/ defaults to the progress tab (which is consistent with the current behavior on Pegasus) and going to studio.code.org/teacher_dashboard/sections/:section_id/<tab_name> will put you on the new teacher dashboard page with the correct tab selected. If studio.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.

teacher-navigation-1

Copy link
Contributor

@islemaster islemaster left a 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.

Copy link
Contributor

@maddiedierker maddiedierker left a 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

apps/src/sites/studio/pages/teacher_dashboard/index.js Outdated Show resolved Hide resolved
import React, {Component, PropTypes} from 'react';
import NavigationBar from '../NavigationBar';

export const teacherDashboardLinks = [
Copy link
Contributor

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"
  },
  ...
}

dashboard/config/routes.rb Outdated Show resolved Hide resolved
@Erin007 Erin007 changed the base branch from staging-next to staging December 13, 2018 21:06
@Erin007
Copy link
Contributor Author

Erin007 commented Dec 13, 2018

@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!

@Erin007 Erin007 merged commit 0301513 into staging Dec 13, 2018
@Erin007 Erin007 deleted the teacher-dashboard-routes branch December 13, 2018 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants