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

Adds invitation for participants to view the new progress view #58372

Merged
merged 13 commits into from
May 8, 2024

Conversation

kobryan0619
Copy link
Contributor

@kobryan0619 kobryan0619 commented May 2, 2024

This PR creates a modal inviting users to use the new section progress view. This PR:

  • Creates the pop-up with the right elements.
  • Allows the user to dismiss the pop-up or accept the invitation
  • Logs the events to amplitude.
  • Save data that the invitation has been seen or delayed.
  • Accurately process a "delayed" invitation
image

(NEW): It DOES

  • "Remember" the status of the invitation if a user switches between the tabs in the dashboard.

Links

Ticket

Testing story

  • Tests coming in separate PR.

Deployment strategy

Follow-up work

  • Fix issue with tabs not recognizing the data.
  • fix issue with image being slow to load

@kobryan0619 kobryan0619 marked this pull request as ready for review May 2, 2024 03:11
@kobryan0619 kobryan0619 requested a review from a team as a code owner May 2, 2024 03:11
@MollyPeredo
Copy link

Looks great! Just one tweak - can you remove the teal border-radius on the "close" button?
image

@kobryan0619
Copy link
Contributor Author

Looks great! Just one tweak - can you remove the teal border-radius on the "close" button?
image

Screen.Recording.2024-05-02.at.9.29.28.AM.mov

That's actually a focus indicator that moves through out the component as a user tab navigates. This outline is also what shows up in other modals - is there a different focus indicator you'd prefer for this?

@dju90
Copy link
Contributor

dju90 commented May 2, 2024

It does not: "Remember" the status of the invitation if a user switches between the tabs in the dashboard. It DOES however remember the status of the invitation if a teacher reloads or logs out and back in.

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?

Copy link
Contributor

@lfryemason lfryemason left a 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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Invtation -> Invitation

Suggested change
dateProgressTableInvtationDelayed:
dateProgressTableInvitationDelayed:

@@ -174,6 +179,12 @@ class SectionProgress extends Component {
className={dashboardStyles.dashboardPage}
data-testid="section-progress-v1"
>
{allowUserToSelectV2View && (
Copy link
Contributor

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) {
Copy link
Contributor

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

@MollyPeredo
Copy link

Looks great! Just one tweak - can you remove the teal border-radius on the "close" button?
image

Screen.Recording.2024-05-02.at.9.29.28.AM.mov
That's actually a focus indicator that moves through out the component as a user tab navigates. This outline is also what shows up in other modals - is there a different focus indicator you'd prefer for this?

Ahhhhh, got it. This is perfect then, thanks!

Copy link
Contributor

@lfryemason lfryemason left a 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,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

nit

function InviteToV2ProgressModal({
sectionId,

// from redux
Copy link
Contributor

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.

Copy link
Contributor Author

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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 = () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const timeSinceInvitationLastDelayed = () => {
const numDaysSinceInvitationLastDelayed = () => {

Optional nit.

@kobryan0619 kobryan0619 merged commit fb27c28 into staging May 8, 2024
2 checks passed
@kobryan0619 kobryan0619 deleted the invitation-for-V2-progress-view branch May 8, 2024 17:20
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.

4 participants