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

Standardize ContentCardList Component and Introduce ViewMoreButtonStates #11865

Merged
merged 2 commits into from
Feb 13, 2024

Conversation

GarvitSinghal47
Copy link
Contributor

Fixes #11771

Summary

In the process of content creation, we drew inspiration from previous Lesson resource selection components, specifically the ContentCardList component. However, considering the component's last update was three years ago, there are noticeable inconsistencies that we aim to address for a more unified developer interface.

The viewMoreButtonState prop in the ContentCardList component currently relies on a string input. To enhance consistency and maintainability, we propose the transition to a constant-based approach.

Acceptance Criteria:
View More Button State

  • Created and exported a new object named ViewMoreButtonStates in the coach/.../constants/index.js file, structured similarly to existing constants.
  • The new object manages the following states:
    • Loading (previously denoted as waiting)
    • Has more (previously determined by not passing specific strings for loading or not having more)
    • No more
    • Error
  • ContentCardList has been updated to validate the viewMoreButtonStates prop against these constants, ensuring only valid constants are accepted.
  • ContentCardList no longer relies on the absence of errors to display the button; instead, it checks for the ViewMoreButtonStates.hasMore state.
  • Components using the ContentCardList have been updated to incorporate the new constants when passing the prop. Specifically, adjustments have been made in LessonResourceSelectionPage/index.vue, CreateExamPage/index.vue, and CreateExamPage/CreatePracticeQuiz.vue.

These changes aim to standardize the ContentCardList component and introduce a clear set of constants for the viewMoreButtonState prop. This not only improves code consistency but also facilitates easier maintenance and future development.

References

Reviewer guidance


Testing checklist

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical user journeys are covered by Gherkin stories
  • Critical and brittle code paths are covered by unit tests

PR process

  • PR has the correct target branch and milestone
  • PR has 'needs review' or 'work-in-progress' label
  • If PR is ready for review, a reviewer has been added. (Don't use 'Assignees')
  • If this is an important user-facing change, PR or related issue has a 'changelog' label
  • If this includes an internal dependency change, a link to the diff is provided

Reviewer checklist

  • Automated test coverage is satisfactory
  • PR is fully functional
  • PR has been tested for accessibility regressions
  • External dependency files were updated if necessary (yarn and pip)
  • Documentation is updated
  • Contributor is in AUTHORS.md

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

@nucleogenesis nucleogenesis left a comment

Choose a reason for hiding this comment

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

I couldn't manage to replicate getting "View more" in the lesson creation context but the code changes there LGTM.

Things worked properly in the quiz context in any case!

Thanks so much @GarvitSinghal47

@nucleogenesis nucleogenesis merged commit df5965a into learningequality:develop Feb 13, 2024
24 checks passed
@nucleogenesis
Copy link
Member

Force merging this as I've tested it locally but cannot restart the stalled check

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 SIZE: small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LessonResourceSelectionPage/ContentCardList.vue component improvements
2 participants