-
Notifications
You must be signed in to change notification settings - Fork 483
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
Allow teachers to hide all lessons in a unit with one click #48863
Conversation
import React from 'react'; | ||
import {connect} from 'react-redux'; | ||
import {getStore} from '../../../redux'; | ||
import PropTypes from 'prop-types'; | ||
import Button from '@cdo/apps/templates/Button'; | ||
import FontAwesome from '../../../templates/FontAwesome'; | ||
import ReactTooltip from 'react-tooltip'; | ||
import {toggleHiddenLesson} from '@cdo/apps/code-studio/hiddenLessonRedux'; | ||
import {unitCalendarLesson} from '../../../templates/progress/unitCalendarLessonShapes'; | ||
import _ from 'lodash'; | ||
import style from './bulk-lesson-visibility-toggle.module.scss'; |
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.
these are entirely unordered, and some use an absolute syntax while others use a relative syntax. are there any standards for this?
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.
We don't have any standards for order unfortunately :(
For absolute vs relative syntax: I'll use relative if it's in the the files is in the same directory and otherwise use @cdo/apps
. I'm not sure if that's just a personal preference though
scriptName: PropTypes.string.isRequired | ||
}; | ||
|
||
function toggleHiddenLessons(scriptName, sectionId, lessons, hidden) { |
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.
is it ok that this function is just floating around down here, or should it be somewhere else?
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 normally put these at the top, but, again, not sure if that's just personal preference
function toggleHiddenLessons(scriptName, sectionId, lessons, hidden) { | ||
lessons.forEach(lesson => { | ||
// For some reason, sectionId is a number here, and needs to be a string | ||
// for the redux toggle stuff to work. |
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.
is this related to the propTypes above? https://github.com/code-dot-org/code-dot-org/pull/48863/files#diff-df37c341b4e24afa4446ab42d92a84705737c3bc034cf85dfdcd51183bedc078R50. or is there something else I'm missing?
}) /*, | ||
dispatch => ({ | ||
toggleHiddenLesson(unitName, sectionId, lessonId, hidden) { | ||
dispatch(toggleHiddenLesson(unitName, sectionId, lessonId, hidden)); | ||
} | ||
}) */ |
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 copied this from ProgressLessonTeacherInfo.jsx
, but it seems to work fine without it? do I need this?
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 would remove the commented out code here. Not sure why it's in ProgressLessonTeacherInfo
<p> | ||
Make all lessons in this Unit visible or hidden for your students. | ||
</p> | ||
</ReactTooltip> |
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.
HelpTip
has a Portal here, should I use one too? i'm not sure what the benefit is
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.
Out of curiosity, why didn't you use HelpTip
here? (I'm not sure what benefit a Portal gets you either 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.
It just doesn't look very good, and doesn't have a way to pass in options to override the default look. I suppose I also could have modified it to let me pass in classNames/icons stuff, would that make more sense?
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 think this is fine in that case! Was just curious
e3f419a
to
4bdb37f
Compare
import style from './bulk-lesson-visibility-toggle.module.scss'; | ||
import i18n from '@cdo/locale'; | ||
|
||
function BulkLessonVisibilityToggle({lessons, sectionId, scriptName}) { |
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.
if it's not too much trouble, it would be great to use unitName
instead of scriptName
. We're in the process of change the term "script" to "unit"
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.
A couple of questions but looks good!
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.
The question you ask about how it looks a little low feedback without disabling whichever button was just pressed- do the 'visible/hidden' fields in each lesson update automatically, or does it require a page load?
The visible/hidden toggle for each lesson updates immediately, without a page load. They're just lower on the screen, so depending on the screen size/etc it might not be visible, or immediately clear that something happened. |
Add two buttons to the top of the unit overview page (right above the first lesson tile) that have the option to "show all" and "hide all" with a tooltip to the right of it that says "Make all lessons in this Unit visible or hidden for your students".
The new buttons tie in to the existing logic for the toggle buttons down the rest of the page, and flip them dynamically.
Questions:
Links
Testing story