Upgrading the UI to the new verawood sidebar for studio - #253
felipemontoya wants to merge 3 commits into
Conversation
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Thanks for the pull request, @felipemontoya! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #253 +/- ##
==========================================
+ Coverage 95.42% 95.45% +0.03%
==========================================
Files 71 71
Lines 8516 8558 +42
Branches 451 453 +2
==========================================
+ Hits 8126 8169 +43
+ Misses 292 291 -1
Partials 98 98
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 Changes recommended
AIUnitSidebarPanel currently drops a provided locationId and only forwards blockId, which can break context/scoping when the host passes locationId as expected by ConfigurableAIAssistance.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the Studio unit sidebar integration to match Verawood’s redesigned “icon rail + paged sidebar” pattern by wrapping the default sidebar and injecting an AI page when the host supports sidebar pages, while preserving a legacy fallback path for earlier releases.
Changes:
- Add
AIUnitSidebarPanelto extend Studio’s unit sidebar pages (or append below legacy sidebar when pages aren’t available). - Gate the authoring-only
UnitSidebarPagesContextimport behind a Tutor-version-based setting (AI_EXTENSIONS_ENABLE_UNIT_SIDEBAR_PAGE). - Export the new panel + defaults from the UI package, add i18n message(s), tests, and changelog entries.
File summaries
| File | Description |
|---|---|
| tutor/openedx_ai_extensions/plugin.py | Adds Tutor-version-gated setting and changes the authoring slot contribution from Insert to Wrap to support the new sidebar layout. |
| tutor/openedx_ai_extensions/patches/mfe-env-config-runtime-definitions-authoring | Conditionally imports Studio’s UnitSidebarPagesContext only when enabled, otherwise provides null for legacy behavior. |
| frontend/src/messages.ts | Adds the new unit sidebar page title message descriptor. |
| frontend/src/index.tsx | Exports AIUnitSidebarPanel, DEFAULT_UNIT_SIDEBAR_BOXES, and AISidebarBox type from the package entrypoint. |
| frontend/src/AIUnitSidebarPanel.tsx | Implements the wrapper that adds an AI page to the sidebar pages registry, with a legacy append fallback. |
| frontend/src/AIUnitSidebarPanel.test.tsx | Adds unit tests for both “no pages context” and “has pages context” behaviors. |
| frontend/package-lock.json | Updates lock metadata to match the UI package version. |
| CHANGELOG.rst | Documents the new panel, setting, and sidebar integration change in Unreleased. |
Review details
Files not reviewed (1)
- frontend/package-lock.json: Generated file
Suppressed comments (1)
frontend/src/AIUnitSidebarPanel.tsx:108
- The panel currently maps
locationIdtoblockIdunconditionally, and the destructuring omitslocationId. If the host already provideslocationId, it will be dropped andConfigurableAIAssistancewill seelocationId=null, which can break selector scoping. PreferlocationId ?? blockIdand include both in the memo dependencies.
const AIUnitSidebarPanel = ({
children = null,
PagesContext = null,
boxes = DEFAULT_UNIT_SIDEBAR_BOXES,
icon = AutoAwesome,
- Files reviewed: 7/8 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| courseId?: string | null; | ||
| blockId?: string | null; | ||
| unitTitle?: string | null; | ||
| readOnly?: boolean; |
| icon?: React.ComponentType; | ||
| pageKey?: string; | ||
| /** A react-intl MessageDescriptor; Studio's Sidebar formats it itself. */ | ||
| title?: any; |
There was a problem hiding this comment.
there not a good idea to loose the types, if we do really need to pass title I will suggest to update the local version of frontend platform to 8.7.1 that has i18n typed so we can do
import type { IntlShape } from '@edx/frontend-platform/i18n';
type MessageDescriptor = Parameters<IntlShape['formatMessage']>[0];| title?: any; | |
| /** Formatted by Studio's Sidebar for the page heading and icon label. */ | |
| title?: MessageDescriptor; |
| @@ -1 +1,12 @@ | |||
| const { ConfigurableAIAssistance, AIExtensionsCard } = await import("@openedx/openedx-ai-extensions-ui"); | |||
| const { ConfigurableAIAssistance, AIExtensionsCard, AIUnitSidebarPanel } = await import("@openedx/openedx-ai-extensions-ui"); | |||
There was a problem hiding this comment.
ConfigurableAIAssistance is imported but not used
| * open, collapse and resize along with every other page. | ||
| * | ||
| * When there is no pages context to extend — an older release, or Verawood | ||
| * with ENABLE_UNIT_PAGE_NEW_DESIGN turned off, which renders the legacy |
There was a problem hiding this comment.
I checked this behavior and turned off ENABLE_UNIT_PAGE_NEW_DESIGN in Verawood, however it does not insert the component in the legacy sidebar. Studio mounts UnitSidebarPagesProvider regardless of the flag (CourseUnit.tsx), so existingPages is always defined and the fallback branch never runs.
Co-authored-by: Diana Olarte <diana.olarte@edunext.co>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
@dcoa thank you for the review. I have accepted the modification you made and updated the code with the rest of the comments |
|
thank you @felipemontoya for addressing my comments. The PR looks great. there is only one more thing I would like to address and it is user feedback: Empty AI panel (
To solve that I suggest to show a message that explains the unit does not have an AI tool configured (that is also the cheapest change): Changes needed
What the author sees
|


This PR updates the UI to match the new pattern of having an icon and a sidebar that is the default in verawood.