-
Notifications
You must be signed in to change notification settings - Fork 1
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
Darien classrooms table #74
Conversation
Noting that this is for issue #70 |
I've done a quick review on the user side of things, and here are some observations - although much of what I say may be rendered moot when this PR is rebased.
|
This needs a rebase now and delete classroom button sounds like a regression, so I'll work on patching that up. I'll take a look at the request for refreshing the classrooms list too for Darien. |
selectClassroom(classroom) { | ||
Actions.classrooms.selectClassroom(classroom); | ||
determineClassroomsTable() { | ||
const ClassroomsTable = this.props.selectedProgram.custom ? DarienClassroomsTable : AstroClassroomsTableContainer; |
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.
OK, now I see what you meant when you said "...after puzzling on this for a while I ended up settling with a ternary"
I think this is the way to go, at least for now. Re: "I'd really like to try to clean this up at some point", I'm all for it, but I'm OK to launch something that works first and refactor later. That said...
Thought: I imagine the ideal solution would be to properly plan out a kind of "generic Education Program" system similar to Panoptes' "generic Build-Your-Own Project" system, then plunk the switching code into a central "ProgramsController"/"ProgramsConfigToComponentTranslator" thingy...
switch (this.props.selectedProgram.settings.programType) {
case "wildlife_camera_trap_classroom": ClassroomsTable = DarienClassroomTable; break;
case "standard_auto_created_assignments_classroom": ClassroomsTable = AstroClassroomsTableContainer; break;
...
}
return ClassroomsTable;
...but that might be a pretty darn deep rabbit hole to go down.
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.
It's a good idea, but not worth the time right now even though I dislike what I ended up doing! If another curricula/educational program is added after I2A and the Wildcams, then that's when this should be refactored.
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.
👍
assignmentsStatus={this.props.assignmentsStatus} | ||
classrooms={this.props.classrooms} | ||
match={this.props.match} | ||
maybeDeleteClassroom={this.props.maybeDeleteClassroom} |
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.
Unsure: Is this missing deleteClassroom={this.props.deleteClassroom}
?
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.
maybeDeleteClassroom={this.maybeDeleteClassroom}
This should open the dialog and this.deleteClassroom
is the click handler for confirmation. I missed removing the this.props
part here.
render() { | ||
return ( | ||
<ClassroomsManager | ||
classrooms={this.props.classrooms} | ||
classroomInstructions={this.props.classroomInstructions} | ||
classroomsStatus={this.props.classroomsStatus} | ||
classroomToDelete={this.state.classroomToDelete} | ||
closeConfirmationDialog={this.closeConfirmationDialog} | ||
deleteClassroom={this.deleteClassroom} |
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.
Nyerp this one's bothering me, deleteClassroom
is removed here, but I'm assuming it should have been added back/moved to somewhere else. I still can't tell where it's supposed to go, though.
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.
That's right. I shuffled the classroom delete methods into ClassroomsTableContainer
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.
It was my attempt at making sense of component organization and what should be responsible for what. Clearly, it's all still hard to follow 🤷♀️
2592a33
to
131a743
Compare
I just rebased, so this should be a bit easier to see the changes specific to this PR. |
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.
PR Review
- This PR adds classrooms to the WildCam Darien Program
The Darien Classrooms (under the Darien > Educator) - The Darien Classrooms are significantly different from the baseline I2A Classrooms, notably in that Assignments need to be manually created for each Classroom. (Note: this PR does not include Create Assignment forms yet.)
While the Darien Classroom Manager is in place, the two issues from the previous quick review are still extant.
Issues
- When creating a new Classroom in Darien, that Classroom won't appear on the list until the page is refreshed.
- User cannot delete Classrooms in either Darien or I2A; the popup doesn't appear after user clicks the X icon.
Status
Changes requested: 2 issues to fix.
However, if either of these fixes are meant to be tackled in a separate PR, please let me know.
@shaunanoordin those two issues should now be fixed. I found a bug with classroom creation, too, but I'll save that for another PR. |
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.
PR Review (Update)
The last update addresses both the issues from the last review - users can now delete Classrooms in both Darien and I2A, and new Classrooms in Darien are reflected properly on the list after creation. Nice work, @srallen ! 👍
Status
LGTM, this PR is good to go! Approving & merging.
This will have to merge after #73 because it is using the program filter for classrooms, so please ignore the changes that pertain to #73 until this is rebased.
This adds a view for the Darien educators page which is basically the classrooms manager which toggles between the table list view or the classroom editor. Darien's table will be slightly different than I2A's:
I really wanted to try to be clever with determining which classroom table to display by trying out some higher order components, but after puzzling on this for a while I ended up settling with a ternary. The nest of components to get down to the classrooms table is a bit convoluted and I'd really like to try to clean this up at some point as I'm finding it hard to follow myself and I wrote most of it.
Part of the issue is React Router 4's new way of declarative routes, so there are a few components who's primary purpose is to contain the
<Switch />
and<Routes />
for whatever nested routes they are.The other issue is that Darien and I2A share all of the classroom components up until the table, so I couldn't figure out a clever way to have the routes programmatically determine the table since the table itself isn't going to be a route; it's just a child component of the
<ClassroomsManagerContainer />
component that is assigned to the/educators/classrooms
route. The I2A/educators
also doesn't exist on its own; the I2A home page redirects to the educators page since they won't have a student interface.If you have any good ideas on how to make this better, I'm definitely open to it.