studio icon indicating copy to clipboard operation
studio copied to clipboard

Implement pagination for recommended resources

Open akolson opened this issue 1 year ago • 2 comments

Overview

This task involves implementing pagination to show more recommendations. Pagination is based on whether recommendations are above (good) or below (not so good) the relevance threshold. Other tasks include implementing loading and errors states, and API interaction. API interaction is based on data from the public API for now, as the recommendations backend is still in development.

Description and outcomes

  • Design requirements

    • A maximum of 10 recommendations are loaded at a time (See Figma designs).

    • If 10 resources are recommended on initial load;

      • Display the View more link that loads more resources.
        • If < 10 resources are recommended on click View more,
          • Display the Show other resources anyway link that loads resources below the relevance threshold.
          • Hide the Show other resources anyway link when there are no more resources below the relevance threshold.
        • Else display the View more link again that loads more resources.
      Screenshot 2024-05-16 at 17 42 23 image image
    • If < 10 resources are recommended on initial load;

      • Display the Show other resources anyway link that loads resources below the relevance threshold.
      • Hide the Show other resources anyway link when there are no more resources below the relevance threshold.
      image image
    • if 0 resources are recommended on initial load;

      • Display the Show other recommendations link that loads resources below the relevance threshold.
      • Hide the Show other recommendations link when there are no more resources below the relevance threshold.
      image image
    • When loading recommendations initially, an indeterminate spinner is displayed. image

    • Clicking View more, Show other resources anyway, Try again, or Show other recommendations links displays an indeterminate spinner below the current recommendations.
      Screenshot 2024-05-17 at 16 37 35

    • When an error is encountered, an appropriate message and a Try again link, that reloads the failed recommendations, is displayed. image

    • The spinner is dismissed once loading of recommendations is completed or an error occurs.

    • The spinner should always be after the last recommendation (if any).

  • Markup requirements

    • NA
  • Styling requirements

  • Architectural requirements

    • Implement a mock backend that uses data from the public API.
      • Use Mock Service Worker, a client agnostic library, to mock the recommendations request.
      • The endpoint is /mock/recommendations?overrideThreshold=true.
      • overrideThreshold is an optional query parameter that allows recommendations that may not be useful to be returned to the user. It is a boolean, with a default value of false.
    • The mock backend should interact with the UI to provide pagination behavior, and loading and error states as described in the Figma designs.

Acceptance Criteria

  • Clicking the View more, Show other resources anyway, and Show other recommendations links display the intended pagination, and loading behavior.
  • Pagination support text is displayed as specified in the Figma designs.
  • A Try again link is displayed in the event of an error while loading recommendations
  • Appropriate text is displayed incase of errors during loading as specified in the Figma designs.
  • Tests are written to verify correctness of page.

Assumptions and Dependencies

  • The mock backend (See Architectural requirements);

    • Uses data from the public API.
    • Has an overrideThreshold query parameter to return recommendations that may not be useful to a user.
  • Is blocked by;

    • https://github.com/learningequality/studio/issues/4565

Scope

The scope of this task is limited to;

  • Implementing the pagination behavior, and loading and error states of recommended resources as specified in the Figma designs.
  • Implementing a mock backend that uses data from the public API

Accessibility Requirements

NA

Resources

akolson avatar May 16 '24 14:05 akolson

@akolson , Could you assign this to me?

shivam-daksh avatar Oct 07 '24 00:10 shivam-daksh

Hi @shivam-daksh, this is a larger issue that is currently now 'help wanted'. I can chat with my colleagues on whether this would be available for contribution, but since I assigned you some other issues just a while ago, please message us again here after those are resolve. Generally I would recommend searching for 'help wanted' - chances of assignment are higher there.

MisRob avatar Oct 07 '24 12:10 MisRob

Closed by https://github.com/learningequality/studio/pull/4803

akolson avatar Apr 10 '25 13:04 akolson