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:
Chris Chávez
2024-10-22 13:47:07 -05:00
committed by GitHub
parent 966e1c3d91
commit 21cbf80f23
17 changed files with 179 additions and 39 deletions

View File

@@ -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'],

View File

@@ -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>