-
Notifications
You must be signed in to change notification settings - Fork 484
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
Adds invitation for participants to view the new progress view #58372
Conversation
Can you clarify what this means? Does it mean that if I click "close" on the invitation, then switch to a different dashboard tab and then switch back, the invitation will re-appear? |
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.
Looks great, a couple nit-picks and that's it. Code structure and logic are all sound!
@@ -213,6 +215,9 @@ export default function currentUser(state = initialState, action) { | |||
progressTableV2ClosedBeta: progress_table_v2_closed_beta, | |||
isLti: is_lti, | |||
isTeacher: user_type === UserTypes.TEACHER, | |||
dateProgressTableInvtationDelayed: |
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.
nit: Invtation -> Invitation
dateProgressTableInvtationDelayed: | |
dateProgressTableInvitationDelayed: |
@@ -174,6 +179,12 @@ class SectionProgress extends Component { | |||
className={dashboardStyles.dashboardPage} | |||
data-testid="section-progress-v1" | |||
> | |||
{allowUserToSelectV2View && ( |
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.
Nit: could we move this logic to the SectionProgressSelector
? That class contains all the logic for the banners and determines whether to show v1 or v2. I feel like this popup fits better there.
}); | ||
}; | ||
|
||
if (invitationOpen) { |
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.
Optional nit: I find if (!invitationOpen) { return null} ...
to be slightly clearer because it shows the early return before the big blob of content to show. Completely optional nit pick
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.
Fantastic! A few optional nits, but I have no problem merging as is!
|
||
function InviteToV2ProgressModal({ | ||
sectionId, | ||
|
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.
nit
function InviteToV2ProgressModal({ | ||
sectionId, | ||
|
||
// from redux |
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.
Hmm, I have complicated thoughts about this kind of comment. On one hand I can see how it would be useful to the reader, on the other, these kinds of comments tend to get stale and unreliable very quickly.
Do you see value in keeping this in the codebase long term or was this better for your initial iteration?
I think my personal preference is to remove it, especially since there is already a list of props that are from redux in the connect
function at the bottom of the file. But, I'll leave it up to you as an optional nit.
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.
Yeah, this is probably another place where it would be nice, as an org/team to get on the same page. I see this from redux
comment kinda a lot in our codebase. I don't know if it is just because it is the "codebase I grew up with" or if there is a bigger meaning here, but I actually like the separation between "here's the props passsed in from another component" distinction.
const startingDate = new Date(dateProgressTableInvitationDelayed); | ||
const today = new Date(); | ||
const differenceInMilliseconds = today.getTime() - startingDate.getTime(); | ||
const differenceInDays = differenceInMilliseconds / (1000 * 3600 * 24); |
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.
const differenceInDays = differenceInMilliseconds / (1000 * 3600 * 24); | |
const differenceInDays = differenceInMilliseconds / MILLISECONDS_IN_ONE_DAY; |
Optional nit: move this to a constant with a meaningful name.
const [invitationOpen, setInvitationOpen] = React.useState(false); | ||
|
||
React.useEffect(() => { | ||
const timeSinceInvitationLastDelayed = () => { |
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.
const timeSinceInvitationLastDelayed = () => { | |
const numDaysSinceInvitationLastDelayed = () => { |
Optional nit.
This PR creates a modal inviting users to use the new section progress view. This PR:
(NEW): It DOES
Links
Ticket
Testing story
Deployment strategy
Follow-up work