Implement pagination for recommended resources
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
10recommendations are loaded at a time (See Figma designs). -
If
10resources are recommended on initial load;- Display the
View morelink that loads more resources.- If
< 10resources are recommended on clickView more,- Display the
Show other resources anywaylink that loads resources below the relevance threshold. - Hide the
Show other resources anywaylink when there are no more resources below the relevance threshold.
- Display the
- Else display the
View morelink again that loads more resources.
- If
- Display the
-
If
< 10resources are recommended on initial load;- Display the
Show other resources anywaylink that loads resources below the relevance threshold. - Hide the
Show other resources anywaylink when there are no more resources below the relevance threshold.
- Display the
-
if
0resources are recommended on initial load;- Display the
Show other recommendationslink that loads resources below the relevance threshold. - Hide the
Show other recommendationslink when there are no more resources below the relevance threshold.
- Display the
-
When loading recommendations initially, an indeterminate spinner is displayed.
-
Clicking
View more,Show other resources anyway,Try again, orShow other recommendationslinks displays an indeterminate spinner below the current recommendations.
-
When an error is encountered, an appropriate message and a
Try againlink, that reloads the failed recommendations, is displayed. -
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
- See Figma designs for 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. overrideThresholdis an optional query parameter that allows recommendations that may not be useful to be returned to the user. It is aboolean, with a default value offalse.
- The mock backend should interact with the UI to provide pagination behavior, and loading and error states as described in the Figma designs.
- Implement a mock backend that uses data from the public API.
Acceptance Criteria
- Clicking the
View more,Show other resources anyway, andShow other recommendationslinks display the intended pagination, and loading behavior. - Pagination support text is displayed as specified in the Figma designs.
- A
Try againlink 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
overrideThresholdquery 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 , Could you assign this to me?
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.
Closed by https://github.com/learningequality/studio/pull/4803