Skip to content

Commit fcb055b

Browse files
committed
feat: Add Problem bank to the Unit add sidebar
1 parent 91ab1c1 commit fcb055b

4 files changed

Lines changed: 18 additions & 0 deletions

File tree

src/course-unit/CourseUnit.test.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3224,6 +3224,7 @@ describe('<CourseUnit />', () => {
32243224
expect(openResponseCollapsible).toBeInTheDocument();
32253225
const problemCollapsible = screen.getByTestId('problem-collapsible');
32263226
expect(problemCollapsible).toBeInTheDocument();
3227+
expect(screen.getByRole('button', { name: 'Problem Bank' })).toBeInTheDocument();
32273228

32283229
// Check text templates
32293230
await user.click(within(textCollapsible).getByText(/text/i));
@@ -3277,6 +3278,10 @@ describe('<CourseUnit />', () => {
32773278
name: 'Drag Drop',
32783279
blockType: 'drag-and-drop-v2',
32793280
},
3281+
{
3282+
name: 'Problem Bank',
3283+
blockType: 'itembank',
3284+
},
32803285
].forEach(({ name, blockType }) => {
32813286
it(`calls appropriate handlers on new button click for ${name} block`, async () => {
32823287
const blockButton = await screen.findByRole('button', { name });

src/course-unit/unit-sidebar/AddSidebar.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ const AddNewContent = () => {
148148
case COMPONENT_TYPES.openassessment:
149149
void handleCreateXBlock({ boilerplate: moduleName, category: type, parentLocator: blockId });
150150
break;
151+
case COMPONENT_TYPES.itembank:
152+
void handleCreateXBlock({ type, category: 'itembank', parentLocator: blockId });
153+
break;
151154
case COMPONENT_TYPES.html:
152155
void handleCreateXBlock({
153156
type,
@@ -181,6 +184,10 @@ const AddNewContent = () => {
181184
blockType: 'problem',
182185
name: intl.formatMessage(messages.sidebarAddProblemButton),
183186
},
187+
{
188+
blockType: 'itembank',
189+
name: intl.formatMessage(messages.sidebarAddProblemBankButton),
190+
},
184191
{
185192
blockType: 'drag-and-drop-v2',
186193
name: intl.formatMessage(messages.sidebarAddDragDropButton),

src/course-unit/unit-sidebar/messages.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ const messages = defineMessages({
4646
defaultMessage: 'Open Response',
4747
description: 'Label for the button to create a new Open Response block',
4848
},
49+
sidebarAddProblemBankButton: {
50+
id: 'course-authoring.unit-page.sidebar.add.new.problem-bank',
51+
defaultMessage: 'Problem Bank',
52+
description: 'Label for the button to create a new Problem Bank block',
53+
},
4954
sidebarAddDragDropButton: {
5055
id: 'course-authoring.unit-page.sidebar.add.new.drag-and-drop',
5156
defaultMessage: 'Drag Drop',

src/generic/block-type-utils/index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@
277277

278278
.icon-with-border-problem,
279279
.icon-with-border-drag-and-drop-v2,
280+
.icon-with-border-itembank,
280281
.icon-with-border-openassessment {
281282
border: 1px solid var(--content-library-component-primary-color);
282283

0 commit comments

Comments
 (0)