-
Notifications
You must be signed in to change notification settings - Fork 32
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: Add highlight content card to stepper and individual sets #912
Conversation
d7efc93
to
d1e2ec0
Compare
@@ -69,7 +69,7 @@ const ContentHighlightStepper = ({ enterpriseId }) => { | |||
const newHighlightSet = { | |||
title: highlightTitle, | |||
isPublished: true, | |||
// TODO: pass along the selected content keys! | |||
content_key: Object.keys(currentSelectedRowIds).map(key => key.split(':')[1]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, while this technically should work, it may not be optimal. That is, you're parsing the content_key
from the aggregation_key
field for the course. While the latter part of the aggregation_key
is the format of content_key
that enterprise-catalog expects here, it is a bit risky to assume that the content_key
can be derived from the aggregation_key
in this way, if that makes sense.
For example, content_key
for courses in enterprise-catalog is derived from the key
field, whereas content_key
for programs/pathways content in enterprise-catalog is derived from the uuid
field.
I think what you have now should be fine for now because your assumption is currently true, but we may want to add a TODO comment here to suggest finding a solution of extracting the appropriate content_key
value from each selected highlighted content item based on its content type (i.e., key
for courses, and uuid
for programs/pathways).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might try rubber ducking later on (outside of this PR) on finding a more optimal solution here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving Open as reference in the future
src/components/ContentHighlights/HighlightStepper/ContentHighlightStepper.jsx
Outdated
Show resolved
Hide resolved
src/components/ContentHighlights/HighlightStepper/ContentSearchResultCard.jsx
Outdated
Show resolved
Hide resolved
src/components/ContentHighlights/HighlightStepper/HighlightStepperConfirmContent.jsx
Outdated
Show resolved
Hide resolved
94382b1
to
db03859
Compare
Codecov ReportBase: 83.65% // Head: 83.73% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #912 +/- ##
==========================================
+ Coverage 83.65% 83.73% +0.07%
==========================================
Files 391 393 +2
Lines 8768 8833 +65
Branches 1846 1855 +9
==========================================
+ Hits 7335 7396 +61
- Misses 1403 1407 +4
Partials 30 30
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
src/components/ContentHighlights/ContentHighlightsCardItemsContainer.jsx
Outdated
Show resolved
Hide resolved
src/components/ContentHighlights/ContentHighlightsCardItemsContainer.jsx
Outdated
Show resolved
Hide resolved
src/components/ContentHighlights/ContentHighlightsCardItemsContainer.jsx
Outdated
Show resolved
Hide resolved
<Hyperlink destination={hyperlink} target="_blank"> | ||
<Truncate lines={3} title={title}>{title}</Truncate> | ||
</Hyperlink> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, not sure a way around this, but it looks like the external link icon wraps onto a 4th line, since the text truncation doesn't consider the Hyperlink
icon. And it looks like we can't have Truncate
wrap Hyperlink
instead.
I think for the purpose of this PR we should leave it as you have it, but let's confirm with Alena if this is OK. I personally feel having the external link icon sometimes wrap to a 4th line doesn't look all that clean and would possibly prefer a different approach to indicating opening in a new tab, e.g.:
Of course, let's defer to the decision is by Alena.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving open for future reference
@@ -306,3 +330,68 @@ export const TEST_COURSE_HIGHLIGHTS_DATA = [ | |||
], | |||
}, | |||
]; | |||
|
|||
export const testCourseData = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[clarification] Is this only used by tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, it reflects sample data coming from the algolia's search clients hits
that have been destructured to Content cards metadata
}, | ||
]; | ||
|
||
export const testCourseAggregation = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[clarification] Is this only used by tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, this represents the selectedRowIds between state changes of the stepper.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Got it. I wonder if it'd be worth moving these 2 variables intended only for tests into a different file to not confuse with application constants (e.g., data/tests/constants.js
)?
src/components/ContentHighlights/HighlightStepper/ContentConfirmContentCard.jsx
Outdated
Show resolved
Hide resolved
src/components/ContentHighlights/HighlightStepper/ContentConfirmContentCard.jsx
Outdated
Show resolved
Hide resolved
src/components/ContentHighlights/HighlightStepper/ContentConfirmContentCard.jsx
Outdated
Show resolved
Hide resolved
src/components/ContentHighlights/HighlightStepper/ContentConfirmContentCard.jsx
Outdated
Show resolved
Hide resolved
src/components/ContentHighlights/HighlightStepper/ContentConfirmContentCard.jsx
Outdated
Show resolved
Hide resolved
19caed8
to
f2dc1e6
Compare
f2dc1e6
to
dc1d591
Compare
} | ||
const cardInfo = { | ||
cardImgSrc: cardImageUrl, | ||
cardLogoSrc: partners?.length === 1 ? partners[0].logoImageUrl : undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: partners
is listed as a required prop. if that's the case, we should be able to assume partners.length
would work without the ?.
. If that breaks tests, the test itself may need to ensure the partners
is passed with an empty array vs. undefined
.
} | ||
const cardInfo = { | ||
cardImgSrc: cardImageUrl, | ||
cardLogoSrc: partners?.length === 1 ? partners[0].logoImageUrl : undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: partners
is listed as a required prop. if that's the case, we should be able to assume partners.length
would work without the ?.
. If that breaks tests, the test itself may need to ensure the partners
is passed with an empty array vs. undefined
.
src/components/ContentHighlights/SkeletonContentCardContainer.jsx
Outdated
Show resolved
Hide resolved
}, | ||
]; | ||
|
||
export const testCourseAggregation = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Got it. I wonder if it'd be worth moving these 2 variables intended only for tests into a different file to not confuse with application constants (e.g., data/tests/constants.js
)?
import SkeletonContentCard from './SkeletonContentCard'; | ||
import { HIGHLIGHTS_CARD_GRID_COLUMN_SIZES } from './data/constants'; | ||
|
||
const SkeletonContentCardContainer = ({ length, columnSizes }) => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: length
-> totalItems
const deleteSelectedRowId = useCallback((rowId) => { | ||
const currentRowIds = { ...currentSelectedRowState }; | ||
delete currentRowIds[rowId]; | ||
setState(s => ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we can nix the currentSelectedRowState
state variable in favor of something like below:
const deleteSelectedRowId = useCallback((rowId) => {
const currentRowIds = { ...currentSelectedRowState };
setState((s) => {
const currentRowIds = { ...s };
delete currentRowIds[rowId];
return {
...s,
stepperModal: {
...s.stepperModal,
currentSelectedRowIds: currentRowIds,
},
};
});
});
Added initial cards for user selection in the highlight stepper content review section.
Added Price at the footer of the cards.
Added API integration with content highlight set items, displaying content highlight set items from highlight set.
Added Trashcan to remove items on the final step of the stepper
Added hyperlink on titles of cards
Added parameters/logics to take into account multiple content types for highlight cards
Added Relevant testing
Updating test reflecting changes and from reference PR #895
Highlight Set items
Step 2 of Highlight Stepper
Step 3 of Highlight Stepper
For all changes
Only if submitting a visual change