Skip to content

Commit 8dfc215

Browse files
committed
style: Fixing nits about sync units
* Stay visible the sync icon in the course outline * Update the message in the sync unit modal * Add warning banner about units in the libraries sync page
1 parent 4bc34c2 commit 8dfc215

File tree

6 files changed

+28
-17
lines changed

6 files changed

+28
-17
lines changed

src/course-libraries/CourseLibraries.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ describe('<CourseLibraries />', () => {
8282
expect(reviewTab).toHaveAttribute('aria-selected', 'true');
8383

8484
userEvent.click(allTab);
85-
const alert = await screen.findByRole('alert');
85+
const alert = (await screen.findAllByRole('alert'))[0];
8686
expect(await within(alert).findByText(
8787
'5 library components are out of sync. Review updates to accept or ignore changes',
8888
)).toBeInTheDocument();
@@ -105,7 +105,7 @@ describe('<CourseLibraries />', () => {
105105
userEvent.click(allTab);
106106
expect(allTab).toHaveAttribute('aria-selected', 'true');
107107

108-
const alert = await screen.findByRole('alert');
108+
const alert = (await screen.findAllByRole('alert'))[0];
109109
expect(await within(alert).findByText(
110110
'5 library components are out of sync. Review updates to accept or ignore changes',
111111
)).toBeInTheDocument();
@@ -133,7 +133,7 @@ describe('<CourseLibraries />', () => {
133133
expect(reviewTab).toHaveAttribute('aria-selected', 'true');
134134

135135
userEvent.click(allTab);
136-
const alert = await screen.findByRole('alert');
136+
const alert = (await screen.findAllByRole('alert'))[0];
137137
expect(await within(alert).findByText(
138138
'5 library components are out of sync. Review updates to accept or ignore changes',
139139
)).toBeInTheDocument();
@@ -156,7 +156,7 @@ describe('<CourseLibraries />', () => {
156156

157157
screen.logTestingPlaygroundURL();
158158

159-
expect(screen.queryByRole('alert')).not.toBeInTheDocument();
159+
expect(screen.queryAllByRole('alert').length).toEqual(1);
160160
});
161161
});
162162

src/course-libraries/CourseLibraries.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
Tabs,
1818
} from '@openedx/paragon';
1919
import {
20-
Cached, CheckCircle, Launch, Loop,
20+
Cached, CheckCircle, Launch, Loop, Info,
2121
} from '@openedx/paragon/icons';
2222

2323
import sumBy from 'lodash/sumBy';
@@ -33,6 +33,7 @@ import { useStudioHome } from '../studio-home/hooks';
3333
import NewsstandIcon from '../generic/NewsstandIcon';
3434
import ReviewTabContent from './ReviewTabContent';
3535
import { OutOfSyncAlert } from './OutOfSyncAlert';
36+
import AlertMessage from '../generic/alert-message';
3637

3738
interface Props {
3839
courseId: string;
@@ -199,6 +200,12 @@ export const CourseLibraries: React.FC<Props> = ({ courseId }) => {
199200
showAlert={showReviewAlert && tabKey === CourseLibraryTabs.all}
200201
setShowAlert={setShowReviewAlert}
201202
/>
203+
{ /* TODO: Remove this alert after implement container in this page */}
204+
<AlertMessage
205+
title={intl.formatMessage(messages.unitsUpdatesWarning)}
206+
icon={Info}
207+
variant="info"
208+
/>
202209
<SubHeader
203210
title={intl.formatMessage(messages.headingTitle)}
204211
subtitle={intl.formatMessage(messages.headingSubtitle)}

src/course-libraries/messages.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ const messages = defineMessages({
116116
defaultMessage: 'Something went wrong! Could not fetch results.',
117117
description: 'Generic error message displayed when fetching link data fails.',
118118
},
119+
unitsUpdatesWarning: {
120+
id: 'course-authoring.course-libraries.home-tab.warning.units',
121+
defaultMessage: 'Currently this page only tracks component updates. To check for unit updates, go to your Course Outline.',
122+
description: 'Warning message shown in library sync page about units updates.',
123+
},
119124
});
120125

121126
export default messages;

src/course-outline/card-header/CardHeader.jsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,6 @@ const CardHeader = ({
133133
) : (
134134
<>
135135
{titleComponent}
136-
{readyToSync && (
137-
<IconButton
138-
className="item-card-button-icon"
139-
data-testid={`${namePrefix}-sync-button`}
140-
alt={intl.formatMessage(messages.readyToSyncButtonAlt)}
141-
iconAs={SyncIcon}
142-
onClick={onClickSync}
143-
/>
144-
)}
145136
<IconButton
146137
className="item-card-button-icon"
147138
data-testid={`${namePrefix}-edit-button`}
@@ -161,6 +152,14 @@ const CardHeader = ({
161152
<TagCount count={contentTagCount} onClick={openManageTagsDrawer} />
162153
)}
163154
{extraActionsComponent}
155+
{readyToSync && (
156+
<IconButton
157+
data-testid={`${namePrefix}-sync-button`}
158+
alt={intl.formatMessage(messages.readyToSyncButtonAlt)}
159+
iconAs={SyncIcon}
160+
onClick={onClickSync}
161+
/>
162+
)}
164163
<Dropdown data-testid={`${namePrefix}-card-header__menu`} onClick={onClickMenuButton}>
165164
<Dropdown.Toggle
166165
className="item-card-header__menu"

src/course-outline/unit-card/UnitCard.test.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ describe('<UnitCard />', () => {
176176

177177
// Should open compare preview modal
178178
expect(screen.getByRole('heading', { name: /preview changes: unit name/i })).toBeInTheDocument();
179-
expect(screen.getByText('Preview not available')).toBeInTheDocument();
179+
expect(screen.getByText('Preview not available for unit changes at this time')).toBeInTheDocument();
180180

181181
// Click on accept changes
182182
const acceptChangesButton = screen.getByText(/accept changes/i);
@@ -196,7 +196,7 @@ describe('<UnitCard />', () => {
196196

197197
// Should open compare preview modal
198198
expect(screen.getByRole('heading', { name: /preview changes: unit name/i })).toBeInTheDocument();
199-
expect(screen.getByText('Preview not available')).toBeInTheDocument();
199+
expect(screen.getByText('Preview not available for unit changes at this time')).toBeInTheDocument();
200200

201201
// Click on ignore changes
202202
const ignoreChangesButton = screen.getByRole('button', { name: /ignore changes/i });

src/library-authoring/component-comparison/messages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const messages = defineMessages({
1919
},
2020
previewNotAvailable: {
2121
id: 'course-authoring.library-authoring.component-comparison.preview-not-available',
22-
defaultMessage: 'Preview not available',
22+
defaultMessage: 'Preview not available for unit changes at this time',
2323
description: 'Message shown when preview is not available.',
2424
},
2525
});

0 commit comments

Comments
 (0)