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: Subtitles for each LOB #13

Merged
merged 1 commit into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,23 @@ const ProductTypeBanner = ({
}
};

const normalizeProductDescription = () => {
switch (productTypeName) {
case COURSE:
return formatMessage(messages.productTypeCourseDescription);
case BOOT_CAMP:
return formatMessage(messages.productTypeBootCampDescription);
case EXECUTIVE_EDUCATION:
return formatMessage(messages.productTypeExecutiveEducationDescription);
case DEGREE:
return formatMessage(messages.productTypeDegreeDescription);
case PROGRAM:
return formatMessage(messages.productTypeProgramDescription);
default:
return '';
}
};

const renderTitle = () => {
const productTypeHeaderText = normalizeProductTitle(productTypeName);
return (
Expand Down Expand Up @@ -67,6 +84,9 @@ const ProductTypeBanner = ({
return (
<Stack>
{renderTitle(productTypeName)}
<span>
{normalizeProductDescription(productTypeName)}
</span>
<Stack {...infoStackProps}>
<span>
{formatMessage(messages.productTypeBannerResults, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,30 @@ const RecommendationCard = ({ rec, productType, handleCourseCardClick }) => {
const { logoImageUrl } = owners[0];

return (
<Hyperlink destination={marketingUrl} target="_blank" showLaunchIcon={false}>
<Card
className="product-card"
onClick={() => handleCourseCardClick(courseKey, productType)}
>
<Card.ImageCap
src={cardImageUrl}
logoSrc={logoImageUrl}
fallbackSrc={cardImageCapFallbackSrc}
fallbackLogoSrc={cardImageCapFallbackSrc}
/>
<Card.Header title={title} />
<Card.Section>
{partner.map((orgName, index) => (
// eslint-disable-next-line react/no-array-index-key
<Chip key={index} className="chip-max-width">
{orgName}
</Chip>
))}
</Card.Section>
</Card>
</Hyperlink>
<Card
className="product-card"
onClick={() => handleCourseCardClick(courseKey, productType)}
>
<Card.ImageCap
as={Hyperlink}
destination={marketingUrl}
target="_blank"
showLaunchIcon={false}
src={cardImageUrl}
logoSrc={logoImageUrl}
fallbackSrc={cardImageCapFallbackSrc}
fallbackLogoSrc={cardImageCapFallbackSrc}
/>
<Card.Header title={title} size="sm" />
<Card.Section>
{partner.map((orgName, index) => (
// eslint-disable-next-line react/no-array-index-key
<Chip key={index} className="chip-max-width">
{orgName}
</Chip>
))}
</Card.Section>
</Card>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,31 @@ const messages = defineMessages({
defaultMessage: 'degrees',
description: 'Header text for degrees',
},
productTypeCourseDescription: {
id: 'product.type.course.description',
defaultMessage: 'Find new interests and advance career opportunities',
description: 'Description of courses product',
},
productTypeProgramDescription: {
id: 'product.type.program.description',
defaultMessage: 'Series of courses for a deep understanding of a topic',
description: 'Description of programs product',
},
productTypeBootCampDescription: {
id: 'product.type.boot_camp.description',
defaultMessage: 'Intensive, hands-on, project based learning',
description: 'Description of bootcamps product',
},
productTypeExecutiveEducationDescription: {
id: 'product.type.executive_education.description',
defaultMessage: 'Expert-led, fully supported courses that build career-critical skills',
description: 'Description of executive education product',
},
productTypeDegreeDescription: {
id: 'product.type.degree.description',
defaultMessage: 'Online degree programs from top universities',
description: 'Description of degrees product',
},
});

export default messages;
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
} from '@testing-library/react';
import { mergeConfig } from '@edx/frontend-platform';
import { sendTrackEvent } from '@edx/frontend-platform/analytics';
import messages from '../messages';
import { SkillsBuilderWrapperWithContext, contextValue } from '../../../test/setupSkillsBuilder';
import { getProductRecommendations } from '../../../utils/search';
import { mockData } from '../../../test/__mocks__/jobSkills.mockData';
Expand Down Expand Up @@ -142,6 +143,14 @@ describe('view-results', () => {
expect(screen.getByText('"Prospector" programs')).toBeTruthy();
expect(screen.getByText('"Prospector" courses')).toBeTruthy();
});

it('provides subtitles for each line of business', () => {
expect(screen.getByText(messages.productTypeDegreeDescription.defaultMessage)).toBeTruthy();
expect(screen.getByText(messages.productTypeBootCampDescription.defaultMessage)).toBeTruthy();
expect(screen.getByText(messages.productTypeExecutiveEducationDescription.defaultMessage)).toBeTruthy();
expect(screen.getByText(messages.productTypeProgramDescription.defaultMessage)).toBeTruthy();
expect(screen.getByText(messages.productTypeCourseDescription.defaultMessage)).toBeTruthy();
});
});

describe('fetch recommendations', () => {
Expand Down