feat: Show published components on content picker (#1420)
* feat: Show published components on content picker --------- Co-authored-by: Braden MacDonald <braden@opencraft.com>
This commit is contained in:
@@ -19,11 +19,13 @@ const contentHit: ContentHit = {
|
||||
org: 'org1',
|
||||
breadcrumbs: [{ displayName: 'Demo Lib' }],
|
||||
displayName: 'Text Display Name',
|
||||
description: 'This is a text: ID=1',
|
||||
formatted: {
|
||||
displayName: 'Text Display Formated Name',
|
||||
content: {
|
||||
htmlContent: 'This is a text: ID=1',
|
||||
},
|
||||
description: 'This is a text: ID=1',
|
||||
},
|
||||
tags: {
|
||||
level0: ['1', '2', '3'],
|
||||
|
||||
@@ -106,6 +106,7 @@ const ComponentCard = ({ contentHit }: ComponentCardProps) => {
|
||||
const {
|
||||
openComponentInfoSidebar,
|
||||
componentPickerMode,
|
||||
showOnlyPublished,
|
||||
} = useLibraryContext();
|
||||
|
||||
const {
|
||||
@@ -114,12 +115,12 @@ const ComponentCard = ({ contentHit }: ComponentCardProps) => {
|
||||
tags,
|
||||
usageKey,
|
||||
} = contentHit;
|
||||
const description: string = (/* eslint-disable */
|
||||
blockType === 'html' ? formatted?.content?.htmlContent :
|
||||
blockType === 'problem' ? formatted?.content?.capaContent :
|
||||
undefined
|
||||
) ?? '';/* eslint-enable */
|
||||
const displayName = formatted?.displayName ?? '';
|
||||
const componentDescription: string = (
|
||||
showOnlyPublished ? formatted.published?.description : formatted.description
|
||||
) ?? '';
|
||||
const displayName: string = (
|
||||
showOnlyPublished ? formatted.published?.displayName : formatted.displayName
|
||||
) ?? '';
|
||||
|
||||
const handleAddComponentToCourse = () => {
|
||||
window.parent.postMessage({
|
||||
@@ -133,7 +134,7 @@ const ComponentCard = ({ contentHit }: ComponentCardProps) => {
|
||||
<BaseComponentCard
|
||||
componentType={blockType}
|
||||
displayName={displayName}
|
||||
description={description}
|
||||
description={componentDescription}
|
||||
tags={tags}
|
||||
actions={(
|
||||
<ActionRow>
|
||||
|
||||
Reference in New Issue
Block a user