From 6f37118960919faf6c531420aad7b17633335c23 Mon Sep 17 00:00:00 2001 From: Navin Karkera Date: Wed, 17 Dec 2025 22:13:12 +0530 Subject: [PATCH] refactor: update placeholder block and import details page (#2761) * Updates placeholder block color and icon. * Moves `View Imported Content` & `Retry import` buttons in import details page inside alert at the top. * Updates page title to include Import status in import details page. --- src/generic/block-type-utils/index.scss | 25 ----- src/library-authoring/components/BaseCard.tsx | 8 +- .../import-course/ImportDetailsPage.tsx | 102 +++++++++++------- .../import-course/PlaceholderCard.tsx | 6 +- .../import-course/messages.ts | 5 + 5 files changed, 76 insertions(+), 70 deletions(-) diff --git a/src/generic/block-type-utils/index.scss b/src/generic/block-type-utils/index.scss index f0636a8ce..70e488214 100644 --- a/src/generic/block-type-utils/index.scss +++ b/src/generic/block-type-utils/index.scss @@ -198,28 +198,3 @@ } } } - -.component-style-import-placeholder { - background-color: #AB0E01; - - .pgn__icon:not(.btn-icon-before) { - color: white; - } - - .btn-icon { - &:hover, &:active, &:focus { - background-color: darken(#AB0E01, 15%); - } - } - - .btn { - background-color: lighten(#AB0E01, 10%); - border: 0; - - &:hover, &:active, &:focus { - background-color: lighten(#AB0E01, 20%); - border: 1px solid var(--pgn-color-primary-base); - margin: -1px; - } - } -} diff --git a/src/library-authoring/components/BaseCard.tsx b/src/library-authoring/components/BaseCard.tsx index f60a3a1cd..52bd341fd 100644 --- a/src/library-authoring/components/BaseCard.tsx +++ b/src/library-authoring/components/BaseCard.tsx @@ -12,7 +12,7 @@ import ComponentCount from '@src/generic/component-count'; import TagCount from '@src/generic/tag-count'; import { BlockTypeLabel, type ContentHitTags, Highlight } from '@src/search-manager'; import { skipIfUnwantedTarget } from '@src/utils'; -import { Report } from '@openedx/paragon/icons'; +import { ExtensionOff } from '@openedx/paragon/icons'; import messages from './messages'; type BaseCardProps = { @@ -48,9 +48,9 @@ const BaseCard = ({ + (tags.level2?.length || 0) + (tags.level3?.length || 0); }, [tags]); - const itemIcon = getItemIcon(itemType); + const itemIcon = !props.isPlaceholder ? getItemIcon(itemType) : ExtensionOff; const intl = useIntl(); - const itemComponentStyle = !props.isPlaceholder ? getComponentStyleColor(itemType) : 'component-style-import-placeholder'; + const itemComponentStyle = !props.isPlaceholder ? getComponentStyleColor(itemType) : 'component-style-other'; return ( @@ -67,7 +67,7 @@ const BaseCard = ({ + } actions={(
{ const intl = useIntl(); const navigate = useNavigate(); const [enableRefeshState, setEnableRefreshState] = useState(true); - const { libraryId } = useLibraryContext(); + const { libraryId, libraryData } = useLibraryContext(); const { courseId, migrationTaskId } = useParams(); const { showToast } = useContext(ToastContext); const [disableReimport, setDisableReimport] = useState(false); @@ -228,7 +228,25 @@ const ImportDetailsContent = () => { if (migrationStatus === 'Succeeded') { return ( - + + + {libraryData?.title || ''} | {intl.formatMessage(messages.importSuccessfulAlertTitle)} | {process.env.SITE_NAME} + + + navigate(collectionLink())} + > + + , + ]} + > @@ -260,21 +278,31 @@ const ImportDetailsContent = () => { }} />

-
- -
); } if (migrationStatus === 'Failed') { return ( - + + + {libraryData?.title || ''} | {intl.formatMessage(messages.importFailedAlertTitle)} | {process.env.SITE_NAME} + + + + + , + ]} + > @@ -291,22 +319,30 @@ const ImportDetailsContent = () => {

-
- -
); } if (migrationStatus === 'Partial Succeeded') { return ( - + + + {libraryData?.title || ''} | {intl.formatMessage(messages.importPartialAlertTitle)} | {process.env.SITE_NAME} + + + navigate(collectionLink())} + > + + , + ]} + > @@ -370,16 +406,6 @@ const ImportDetailsContent = () => { )} - -
- -
); } @@ -423,17 +449,13 @@ export interface MigrationSummary { export const ImportDetailsPage = () => { const intl = useIntl(); const { libraryId, libraryData, readOnly } = useLibraryContext(); - const { courseId } = useParams(); - const { - data: courseDetails, - } = useCourseDetails(courseId); return (
+ + {libraryData?.title || ''} | {process.env.SITE_NAME} +
- - {courseDetails?.title ?? ''} | {process.env.SITE_NAME} -
{ - const truncatedDescription = description ? `${description.substring(0, 40) }...` : undefined; + const intl = useIntl(); + const defaultDescription = intl.formatMessage(messages.placeholderCardDescription); + const truncatedDescription = description ? `${description.substring(0, 40) }...` : defaultDescription; /* istanbul ignore next */ return (