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

Integrate shopping cart into lesson resource selection side panel #12996

Merged

Conversation

AlexVelezLl
Copy link
Member

@AlexVelezLl AlexVelezLl commented Jan 13, 2025

Summary

  • Integrates shopping cart into lesson resource selection side panel.
  • Implemts functionality to add selected resources to lesson.
  • Adds a guard to show a closing confirmation modal when closing the modal with modified changes.
Compartir.pantalla.-.2025-01-13.16_12_02.mp4

References

Closes #12990.

Reviewer guidance

  • Create or edit a lesson
  • Change browser route path from "/lesson" to "lessontemp".
  • Select/deselect resources to add to the lesson.
  • Check the shopping cart, its reactiveness, buttons, etc.
  • Check that save button works in different scenarios.

Implementation notes

As we shouldnt have repeated resources in a lesson, I have make sure to save unique resoures in the list. This implies that if a user is selecting a resource that is already in the lesson, it will just "ignore" it (because of the unification process). So it wont take it into account to make the save request, neither to show the close confirmation message if no new resources are being added. Does this makes sense?

@github-actions github-actions bot added APP: Coach Re: Coach App (lessons, quizzes, groups, reports, etc.) DEV: frontend labels Jan 13, 2025
Copy link
Member

@marcellamaki marcellamaki left a comment

Choose a reason for hiding this comment

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

A few notes from an initial read through - I'll do a second review tomorrow. I also haven't run this locally yet or tried it out.

@pcenov I'll add you here for manual QA - please let me or Alex know if you have any questions about how to test these changes. Thank you!

@marcellamaki marcellamaki requested a review from pcenov January 15, 2025 22:03
@pcenov
Copy link
Member

pcenov commented Jan 16, 2025

Hi @AlexVelezLl and @marcellamaki, I confirm that this is implemented as specified above. Noticed the following potential issues:

  1. As noted by Alex in the description of the PR the resources which have already been added to the lesson are not marked as selected when one reopens the modal. This wasn't the case in the previous version where all added resources are marked as selected. So that question is - can we have the same implementation here, so that a coach will have a clear indication which resources are already added?

Current implementation:

selection.mp4

Previous:

previous.mp4
  1. It's not possible to preview a resource both by clicking on a card or on the link (perhaps not in scope for this PR?):
cannot.preview.a.resource.mp4
  1. Clicking the back arrow always brings me to the "Manage lesson resources" page while when I am navigating within folders I was expecting to be able to go back to the previous folder:
the.back.arrow.mp4

@rtibbles
Copy link
Member

As noted by Alex in the description of the PR the resources which have already been added to the lesson are not marked as selected when one reopens the modal. This wasn't the case in the previous version where all added resources are marked as selected. So that question is - can we have the same implementation here, so that a coach will have a clear indication which resources are already added?

I think this is desirable - with one change from the previous behaviour - the checkboxes should be marked as selected, but disabled. This is an intentional change we introduced in the quiz workflow, so that resource selection was a 'shopping cart' experience - going to find new resources to include - not a selection and deselection experience. Removing resources is done from the lesson itself, not the resource selection flow.

@rtibbles
Copy link
Member

For 2 - we have two follow up issues for the preview behaviours, so yes, I think out of scope for this PR! #12988 and #12989

For 3 - my understanding is that this is currently intended behaviour. I think we shouldn't block the PR for this, and I know there are other back arrow confusions in resource selection in quiz too, so we should keep a close eye on people's reactions to this as we do broader internal testing.

@AlexVelezLl
Copy link
Member Author

Thank @rtibbles! I have pushed the changes to have these checkboxes selected but disabled :)

Compartir.pantalla.-.2025-01-24.09_04_54.mp4

Copy link
Member

@pcenov pcenov left a comment

Choose a reason for hiding this comment

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

Thanks @AlexVelezLl - I confirm that the checkboxes of the already added resources are disabled now.

Copy link
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

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

I think we could do with a better name for noSelectableResourcesIds see my comment on one instance.

I have a broader question about state management here, which maybe is better deferred from this PR and addressed to @marcellamaki - it seems like we're still using the lessonSummary vuex state, rather than following the pattern we followed in quiz to start from scratch with a composable for editing.

import SelectionIndex from '../views/lessons/LessonSummaryPage/sidePanels/LessonResourceSelection/subPages/SelectionIndex.vue';
import SelectFromBookmarks from '../views/lessons/LessonSummaryPage/sidePanels/LessonResourceSelection/subPages/SelectFromBookmarks.vue';
import SelectFromChannels from '../views/lessons/LessonSummaryPage/sidePanels/LessonResourceSelection/subPages/SelectFromChannels.vue';
import ManageSelectedResources from '../views/lessons/LessonSummaryPage/sidePanels/LessonResourceSelection/subPages/ManageSelectedResources.vue';
Copy link
Member

Choose a reason for hiding this comment

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

Does adding the .vue suffix help with IDE file discovery? Just wondering if we should standardize on one way or the other. Our webpack config handles discovery of vue files without the extension, but maybe IDEs are not handling it as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, its just for VS Code. without it, VS Code expect it to be a js file, and therefore, it just dont find the file. Adding the .vue let us navigate to the file just doing cntrl + click and It is much more comfortable. Although I haven't taken the time to investigate if I can configure VS Code for this.

Copy link
Member

Choose a reason for hiding this comment

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

This may also be influencing why this is not being supported vitejs/vite#178

Vite is also removing support for imports of vue components without the extension.

We are probably going to be better off bending with the wind!

Copy link
Member Author

@AlexVelezLl AlexVelezLl Jan 27, 2025

Choose a reason for hiding this comment

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

We are probably going to be better off bending with the wind!

I agree!

PageNames,
};
},
computed: {
totalSize() {
...mapState('lessonSummary', ['currentLesson', 'workingResources']),
Copy link
Member

Choose a reason for hiding this comment

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

Oh, have we not migrated lesson editing over to using composition API for state? Are we updating the lessonSummary vuex whenever we edit things as well? cc @marcellamaki

Copy link
Member Author

Choose a reason for hiding this comment

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

Are we updating the lessonSummary vuex whenever we edit things as well?

Yes, thats why I had to call this setWorkingResources call here.

And in the LessonSummaryPage, we also update this workingResources array when we remove a resource from the lesson

.

@AlexVelezLl AlexVelezLl force-pushed the tide-up-shopping-cart branch from 82cf6cf to 12467f4 Compare January 27, 2025 21:26
@AlexVelezLl AlexVelezLl force-pushed the tide-up-shopping-cart branch from 4728873 to 85a925d Compare January 27, 2025 21:46
@AlexVelezLl
Copy link
Member Author

Thanks @rtibbles! I have addressed the comments :)

@AlexVelezLl AlexVelezLl requested a review from rtibbles January 27, 2025 21:50
Copy link
Member

@marcellamaki marcellamaki left a comment

Choose a reason for hiding this comment

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

Approving since @pcenov has given the 👍 with manual QA, and it looks like Richards remaining feedback has all been addressed. Thanks @AlexVelezLl!

@AlexVelezLl
Copy link
Member Author

Thanks @marcellamaki!

@AlexVelezLl AlexVelezLl merged commit bf19897 into learningequality:develop Jan 29, 2025
37 checks passed
@AlexVelezLl AlexVelezLl deleted the tide-up-shopping-cart branch January 29, 2025 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APP: Coach Re: Coach App (lessons, quizzes, groups, reports, etc.) DEV: frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Follow up: update shopping cart to consume the "current working state" rather than the saved lesson state
4 participants