Skip to content

Commit e16390f

Browse files
committed
feat: Update banner in unit page from library
1 parent f15e930 commit e16390f

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

src/course-unit/CourseUnit.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import { UnitSidebarProvider } from './unit-sidebar/UnitSidebarContext';
4848
import { UnitSidebarPagesProvider } from './unit-sidebar/UnitSidebarPagesContext';
4949
import { UNIT_VISIBILITY_STATES } from './constants';
5050
import { isUnitPageNewDesignEnabled } from './utils';
51+
import { useHelpUrls } from '@src/help-urls/hooks';
5152

5253
const StatusBar = ({ courseUnit }: { courseUnit: any; }) => {
5354
const { selectedPartitionIndex, selectedGroupsLabel } = courseUnit.userPartitionInfo ?? {};
@@ -164,6 +165,7 @@ const CourseUnit = () => {
164165
const intl = useIntl();
165166
const { blockId } = useParams();
166167
const { courseId } = useCourseAuthoringContext();
168+
const urls = useHelpUrls(['syncLibraryUpdates']);
167169

168170
if (courseId === undefined) {
169171
// istanbul ignore next - This shouldn't be possible; it's just here to satisfy the type checker.
@@ -283,6 +285,11 @@ const CourseUnit = () => {
283285
<FormattedMessage {...messages.alertLibraryUnitReadOnlyLinkText} />
284286
</Alert.Link>
285287
),
288+
learnMore: (
289+
<Alert.Link href={urls['syncLibraryUpdates']}>
290+
<FormattedMessage {...messages.alertLibraryUnitReadOnlyLearnMoreText} />
291+
</Alert.Link>
292+
),
286293
},
287294
)}
288295
variant="info"

src/course-unit/messages.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,19 @@ const messages = defineMessages({
4545
},
4646
alertLibraryUnitReadOnlyText: {
4747
id: 'course-authoring.course-unit.alert.read-only.text',
48-
defaultMessage: 'This unit can only be edited from the {link}.',
48+
defaultMessage: 'Only certain edits are possible for {link}. {learnMore}',
4949
description: 'Text of the alert when the unit is read only because is a library unit',
5050
},
5151
alertLibraryUnitReadOnlyLinkText: {
5252
id: 'course-authoring.course-unit.alert.read-only.link.text',
53-
defaultMessage: 'library',
53+
defaultMessage: 'library content',
5454
description: 'Text of the link in the alert when the unit is read only because is a library unit',
5555
},
56+
alertLibraryUnitReadOnlyLearnMoreText: {
57+
id: 'course-authoring.course-unit.alert.read-only.learn-more.text',
58+
defaultMessage: 'Learn More',
59+
description: 'Text of the learn more link in the alert when the unit is read only because is a library unit',
60+
},
5661
statusBarDraftChangesBadge: {
5762
id: 'course-authoring.course-unit.status-bar.publish-status.draft-changes',
5863
defaultMessage: 'Unpublished changes',

src/help-urls/data/api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export interface HelpUrls {
2929
register: string;
3030
schedule: string;
3131
socialSharing: string;
32+
syncLibraryUpdates: string;
3233
teamCourse: string;
3334
teamLibrary: string;
3435
textbooks: string;

0 commit comments

Comments
 (0)