Skip to content

Commit

Permalink
feat: show video section to learners with active subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
Maham Akif authored and Maham Akif committed Aug 6, 2024
1 parent beeacc8 commit 9c32fcc
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/components/search/SearchPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,28 @@ import React from 'react';
import { SearchData } from '@edx/frontend-enterprise-catalog-search';
import { useIntl } from '@edx/frontend-platform/i18n';

import { useSubscriptions } from '../app/data';
import { LICENSE_STATUS } from '../enterprise-user-subsidy/data/constants';
import Search from './Search';
import { SEARCH_TRACKING_NAME } from './constants';
import { getSearchFacetFilters } from './utils';
import { features } from '../../config';

const SearchPage = () => {
const intl = useIntl();

const { data: { subscriptionLicense } } = useSubscriptions();

Check warning on line 15 in src/components/search/SearchPage.jsx

View check run for this annotation

Codecov / codecov/patch

src/components/search/SearchPage.jsx#L15

Added line #L15 was not covered by tests
const hasActivatedAndCurrentSubscription = (
subscriptionLicense?.status === LICENSE_STATUS.ACTIVATED
&& subscriptionLicense?.subscriptionPlan?.isCurrent

Check warning on line 18 in src/components/search/SearchPage.jsx

View check run for this annotation

Codecov / codecov/patch

src/components/search/SearchPage.jsx#L18

Added line #L18 was not covered by tests
);

return (
<SearchData searchFacetFilters={getSearchFacetFilters(intl)} trackingName={SEARCH_TRACKING_NAME}>
<SearchData
searchFacetFilters={getSearchFacetFilters(intl)}
trackingName={SEARCH_TRACKING_NAME}
enableVideos={features.FEATURE_ENABLE_VIDEO_CATALOG && hasActivatedAndCurrentSubscription}
>
<Search />
</SearchData>
);
Expand Down

0 comments on commit 9c32fcc

Please sign in to comment.