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

feat: display search result cards in catalog tab #1059

Merged
merged 18 commits into from
Oct 27, 2023
Merged

Conversation

katrinan029
Copy link
Contributor

@katrinan029 katrinan029 commented Oct 12, 2023

Description

Display formatted search results on budget detail "Catalog" tab for top-down assignment based off the search filtering/search results from ticket https://2u-internal.atlassian.net/browse/ENT-7339.

Solution

Implement Paragon's Datatable and cards with the appropriate badges for exec ed and open courses.

Widescreen

Screenshot 2023-10-13 at 10 27 11 AM

Narrow screen

Screenshot 2023-10-13 at 10 35 55 AM

Datatable

Screenshot 2023-10-13 at 10 27 11 AM
Screenshot 2023-10-13 at 10 25 45 AM

For all changes

  • Ensure adequate tests are in place (or reviewed existing tests cover changes)

Only if submitting a visual change

  • Ensure to attach screenshots
  • Ensure to have UX team confirm screenshots

@katrinan029 katrinan029 mentioned this pull request Oct 12, 2023
3 tasks
@katrinan029 katrinan029 requested review from a team and adamstankiewicz October 12, 2023 23:07
@katrinan029 katrinan029 marked this pull request as ready for review October 12, 2023 23:07
@codecov
Copy link

codecov bot commented Oct 13, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (c0a7605) 83.72% compared to head (46a1ab8) 83.78%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1059      +/-   ##
==========================================
+ Coverage   83.72%   83.78%   +0.05%     
==========================================
  Files         449      450       +1     
  Lines        9531     9550      +19     
  Branches     1988     1994       +6     
==========================================
+ Hits         7980     8001      +21     
+ Misses       1508     1506       -2     
  Partials       43       43              
Files Coverage Δ
...edit-management/BudgetDetailCatalogTabContents.jsx 100.00% <100.00%> (ø)
...nts/learner-credit-management/cards/CourseCard.jsx 100.00% <100.00%> (+20.00%) ⬆️
.../components/learner-credit-management/constants.js 100.00% <100.00%> (ø)
...onents/learner-credit-management/data/constants.js 95.45% <100.00%> (+0.45%) ⬆️
src/components/learner-credit-management/index.jsx 66.66% <ø> (ø)
...learner-credit-management/search/CatalogSearch.jsx 100.00% <100.00%> (ø)
...-credit-management/search/CatalogSearchResults.jsx 94.73% <100.00%> (-0.92%) ⬇️
...components/learner-credit-management/data/utils.js 95.50% <83.33%> (-0.88%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/components/learner-credit-management/data/utils.js Outdated Show resolved Hide resolved
src/components/learner-credit-management/data/utils.js Outdated Show resolved Hide resolved

import { FormattedMessage } from '@edx/frontend-platform/i18n';
import { SearchHeader } from '@edx/frontend-enterprise-catalog-search';

import { configuration } from '../../../config';
import CatalogSearchResults from './CatalogSearchResults';

const CatalogSearch = () => {
const { budgetId } = useParams();
const CatalogSearch = ({ catalogUuid }) => {
Copy link
Member

Choose a reason for hiding this comment

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

[question] Is it expected that mousing out of the window and back into this component would trigger another more queries to Algolia? As seen below with the "Network" tab open, it looks like there are Algolia queries API calls being made when the user's cursor leaves the window and then again when subsequently re-entering. It's especially noticeable when the "Network" tab is throttled to "Fast 3G" or "Slow 3G", as the skeleton loading states become visible.

algolia_queries_catalog_lcm.mov
algolia_queries_catalog_lcm_2.mov

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is happening because the page is re-rendering every time the user navigates to the sidebar and back. It looks like this is a larger issue with the app because I'm seeing other pages re-render as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Screen.Recording.2023-10-26.at.2.55.37.PM.mov

Copy link
Member

Choose a reason for hiding this comment

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

Ugh, yeah, you're correct. Didn't notice it was impacting other pages at the time I left the comment; we can defer on this issue within the PR.

Copy link
Member

@adamstankiewicz adamstankiewicz left a comment

Choose a reason for hiding this comment

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

LGTM! Just a couple nit-level comments and a clarifying question about this thread (will follow-up in Slack).


import { FormattedMessage } from '@edx/frontend-platform/i18n';
import { SearchHeader } from '@edx/frontend-enterprise-catalog-search';

import { configuration } from '../../../config';
import CatalogSearchResults from './CatalogSearchResults';

const CatalogSearch = () => {
const { budgetId } = useParams();
const CatalogSearch = ({ catalogUuid }) => {
Copy link
Member

Choose a reason for hiding this comment

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

Ugh, yeah, you're correct. Didn't notice it was impacting other pages at the time I left the comment; we can defer on this issue within the PR.

Comment on lines 20 to 21
import defaultLogoImg from '../../../static/default-card-header-dark.png';
import defaultCardImg from '../../../static/default-card-header-light.png';
Copy link
Member

Choose a reason for hiding this comment

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

I don't feel we do, but could convinced otherwise. The fallbackSrc is important because without it, it messes up the card grid with one or more cards with differing heights without the image. Having a missing logo image doesn't affect the card heights in the same way, so having a fallback isn't as important.

const searchClient = algoliasearch(configuration.ALGOLIA.APP_ID, configuration.ALGOLIA.SEARCH_API_KEY);

const searchFilters = `enterprise_catalog_query_uuids:${budgetId}`;
const searchFilters = `enterprise_catalog_uuids:${catalogUuid}`;
Copy link
Member

Choose a reason for hiding this comment

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

Yes, we want the search results to include all courses, including both course types (i.e., Open Courses and Executive Education). From a data perspective, these are both still courses, though they have different learning types. We want to exclude programs and pathways.

const searchFilters = `enterprise_catalog_uuids:${catalogUuid} AND content_type: course`;

src/components/learner-credit-management/data/constants.js Outdated Show resolved Hide resolved
@katrinan029 katrinan029 merged commit 017f349 into master Oct 27, 2023
5 checks passed
@katrinan029 katrinan029 deleted the knguyen2/ENT-7591 branch October 27, 2023 21:53
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.

3 participants