Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/learning-header/LearningHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const LearningHeader = ({
<div className="flex-grow-1 course-title-lockup d-flex" style={{ lineHeight: 1 }}>
<CourseInfoSlot courseOrg={courseOrg} courseNumber={courseNumber} courseTitle={courseTitle} />
</div>
<LearningHeaderActionsSlot showDefaultActions={showUserDropdown && !!authenticatedUser} />
<LearningHeaderActionsSlot showDefaultActions={!!authenticatedUser} />
{authenticatedUser && showUserDropdown && (
<AuthenticatedUserDropdown
username={authenticatedUser.username}
Expand Down
11 changes: 8 additions & 3 deletions src/learning-header/LearningHeader.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,16 @@ describe('Header', () => {
expect(screen.getByText(courseData.courseTitle)).toBeInTheDocument();
});

it('hides the user dropdown and the header actions when showUserDropdown is false', () => {
it('displays the header actions for an authenticated user', () => {
render(<Header />);
expect(screen.getByText('Help')).toBeInTheDocument();
});

it('hides only the user dropdown, not the header actions, when showUserDropdown is false', () => {
render(<Header showUserDropdown={false} />);

expect(screen.queryByText(authenticatedUser.username)).not.toBeInTheDocument();
expect(screen.queryByText('Help')).not.toBeInTheDocument();
expect(screen.getByText('Help')).toBeInTheDocument();
});

it('renders v2 slot content for an authenticated user even when showUserDropdown is false', () => {
Expand All @@ -67,7 +72,7 @@ describe('Header', () => {

expect(screen.getByText(V2_WIDGET_TEXT)).toBeInTheDocument();
expect(screen.queryByText(authenticatedUser.username)).not.toBeInTheDocument();
expect(screen.queryByText('Help')).not.toBeInTheDocument();
expect(screen.getByText('Help')).toBeInTheDocument();
});

it('renders v2 slot content for an anonymous user', () => {
Expand Down
7 changes: 3 additions & 4 deletions src/plugin-slots/HeaderNotificationsSlot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This slot renders the notifications tray (bell icon + notification popover) from
1. **Desktop Header** — via `org.openedx.frontend.layout.header_desktop_secondary_menu.v2`
Notifications appear before secondary menu items (e.g., "New", "Help")

2. **Learning Header** — via `org.openedx.frontend.layout.learning_header_actions.v1` (nested within [`.v2`](../LearningHeaderActionsSlot/v2/))
2. **Learning Header** — via [`org.openedx.frontend.layout.learning_header_actions.v2`](../LearningHeaderActionsSlot/v2/)
Notifications appear before the help link

3. **Studio Header** — via `org.openedx.frontend.layout.studio_header_actions.v1`
Expand All @@ -28,9 +28,8 @@ Desktop Header

Learning Header
└── org.openedx.frontend.layout.learning_header_actions.v2
└── org.openedx.frontend.layout.learning_header_actions.v1 (only when showUserDropdown is true and a user is authenticated)
├── org.openedx.frontend.layout.header_notifications_tray.v1 ← This slot
└── org.openedx.frontend.layout.header_learning_help.v1
├── org.openedx.frontend.layout.header_notifications_tray.v1 ← This slot (only when a user is authenticated)
└── org.openedx.frontend.layout.header_learning_help.v1

Studio Header
└── org.openedx.frontend.layout.studio_header_actions.v1
Expand Down
1 change: 0 additions & 1 deletion src/plugin-slots/LearningHeaderActionsSlot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
| Slot ID | Description | Docs |
|---------|-------------|------|
| `org.openedx.frontend.layout.learning_header_actions.v2` | Always rendered, regardless of `showUserDropdown` (Default slot) | [v2 docs](./v2/) |
| `org.openedx.frontend.layout.learning_header_actions.v1` **(Deprecated)** | Notification tray + help link, only rendered when `showUserDropdown` is `true` and a user is authenticated | [v1 docs](./v1/) |
1 change: 0 additions & 1 deletion src/plugin-slots/LearningHeaderActionsSlot/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import LearningHeaderActionsSlot from './v2';

export { default as LearningHeaderActionsSlotV1 } from './v1';
export default LearningHeaderActionsSlot;
123 changes: 0 additions & 123 deletions src/plugin-slots/LearningHeaderActionsSlot/v1/README.md

This file was deleted.

34 changes: 0 additions & 34 deletions src/plugin-slots/LearningHeaderActionsSlot/v1/index.jsx

This file was deleted.

3 changes: 2 additions & 1 deletion src/plugin-slots/LearningHeaderActionsSlot/v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
### Slot ID: `org.openedx.frontend.layout.learning_header_actions.v2`

**Default Content:**
- **Learning Header Actions v1** (via [`LearningHeaderActionsSlotV1`](../v1/)) — Notification tray + help link, only rendered when `showUserDropdown` is `true`
- **Notification Tray** (via [`HeaderNotificationsSlot`](../../HeaderNotificationsSlot/)) — Rendered before the help link
- **Help Link** (via [`LearningHelpSlot`](../../LearningHelpSlot/))

This slot always renders, regardless of the `showUserDropdown` prop passed to `LearningHeader`. Use it to add, hide, or replace the whole actions area independently of `showUserDropdown`.

Expand Down
10 changes: 8 additions & 2 deletions src/plugin-slots/LearningHeaderActionsSlot/v2/index.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
import React from 'react';
import PropTypes from 'prop-types';
import { PluginSlot } from '@openedx/frontend-plugin-framework';
import LearningHeaderActionsSlotV1 from '../v1';
import HeaderNotificationsSlot from '../../HeaderNotificationsSlot';
import LearningHelpSlot from '../../LearningHelpSlot';

const LearningHeaderActionsSlot = ({ showDefaultActions = true }) => (
<PluginSlot
id="org.openedx.frontend.layout.learning_header_actions.v2"
pluginProps={{ showDefaultActions }}
>
{showDefaultActions && <LearningHeaderActionsSlotV1 />}
{showDefaultActions && (
<>
<HeaderNotificationsSlot />
<LearningHelpSlot />
</>
)}
</PluginSlot>
);

Expand Down
1 change: 0 additions & 1 deletion src/plugin-slots/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

### Learning Header
* [`org.openedx.frontend.layout.header_learning_course_info.v1`](./CourseInfoSlot/)
* [`org.openedx.frontend.layout.learning_header_actions.v1`](./LearningHeaderActionsSlot/v1/) **(Deprecated, use `.v2`)**
* [`org.openedx.frontend.layout.learning_header_actions.v2`](./LearningHeaderActionsSlot/v2/)
* [`org.openedx.frontend.layout.header_learning_help.v1`](./LearningHelpSlot/)
* [`org.openedx.frontend.layout.header_learning_logged_out_items.v1`](./LearningLoggedOutItemsSlot/)
Expand Down
Loading