Skip to content

Commit 1d23bed

Browse files
authored
fix: Nits on the banners [FC-0123] (openedx#3022)
- Fixes this issue: openedx#2868 (comment) - Text updated in the analysis banner. - The text in the unit from libraries appears to have been resolved in previous PRs. And this banner is updated with a new text. - Fixes this issue: openedx#2605
1 parent 6e4c776 commit 1d23bed

5 files changed

Lines changed: 18 additions & 5 deletions

File tree

src/course-unit/CourseUnit.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2542,7 +2542,7 @@ describe('<CourseUnit />', () => {
25422542
});
25432543
await executeThunk(fetchCourseSectionVerticalData(courseId), store.dispatch);
25442544

2545-
expect(screen.getByText(/this unit can only be edited from the \./i)).toBeInTheDocument();
2545+
expect(screen.getByText(messages.alertLibraryUnitReadOnlyLinkText.defaultMessage)).toBeInTheDocument();
25462546

25472547
// Edit button should be enabled even for library imported units
25482548
const unitHeaderTitle = screen.getByTestId('unit-header-title');
@@ -3451,7 +3451,7 @@ describe('<CourseUnit />', () => {
34513451
});
34523452
await executeThunk(fetchCourseSectionVerticalData(courseId), store.dispatch);
34533453

3454-
expect(screen.getByText(/this unit can only be edited from the \./i)).toBeInTheDocument();
3454+
expect(screen.getByText(messages.alertLibraryUnitReadOnlyLinkText.defaultMessage)).toBeInTheDocument();
34553455

34563456
// Does not render the "Add Components" section
34573457
expect(screen.queryByText(addComponentMessages.title.defaultMessage)).not.toBeInTheDocument();

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;

src/library-authoring/import-course/messages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ const messages = defineMessages({
171171
},
172172
importCourseAnalysisCompleteAllContentBody: {
173173
id: 'library-authoring.import-course.review-details.analysis-complete.100.body',
174-
defaultMessage: 'All course content will imported into a collection in your library called {courseName}. See details below.',
174+
defaultMessage: 'All course content will be imported into a collection in your library called {courseName}. See details below.',
175175
description: 'Body of the info card when course import analysis is complete and all data can be imported.',
176176
},
177177
importCourseAnalysisCompleteSomeContentTitle: {

0 commit comments

Comments
 (0)