Skip to content

feat(invideoquiz-editor): add validation for required data#76

Merged
djoseph-apphelix merged 1 commit intorelease-ulmofrom
djoseph-apphelix/TNL2-541
Feb 26, 2026
Merged

feat(invideoquiz-editor): add validation for required data#76
djoseph-apphelix merged 1 commit intorelease-ulmofrom
djoseph-apphelix/TNL2-541

Conversation

@djoseph-apphelix
Copy link
Member

@djoseph-apphelix djoseph-apphelix commented Feb 25, 2026

Description

  • Add "Content not found" alert to the InVideoQuiz editor that displays when the parent unit is missing video or problem components
  • Alert shows "No video found for this unit" and/or "No problem found for this unit" as applicable, with a bold "Content not found" heading
  • Alert is dismissible via a "Dismiss" button and only appears after editor data has finished loading
  • Add unit tests covering all alert scenarios (17 tests)

Screenshot

Screenshot 2026-02-25 at 1 54 45 PM

Impacted user roles:

This change is in the Studio (CMS) course authoring interface — specifically the InVideoQuiz XBlock editor. The impacted roles are:

  • Course Staff — can edit course content in Studio
  • Course Instructors/Admins — full course editing access in Studio
  • Global Staff / Superusers — platform-wide Studio access

Supporting information

Jira ticket : TNL2-541

Testing instructions

  • Open InVideoQuiz editor in a unit with no video components — verify "No video found for this unit" alert appears
  • Open InVideoQuiz editor in a unit with no problem components — verify "No problem found for this unit" alert appears
  • Open InVideoQuiz editor in a unit with neither — verify both messages appear in one alert
  • Open InVideoQuiz editor in a unit with both video and problem components — verify no alert appears
  • Click "Dismiss" — verify alert is hidden

Copilot AI review requested due to automatic review settings February 25, 2026 08:30
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a "Content not found" alert to the InVideoQuizEditor that displays when the parent unit is missing video or problem components. The alert informs users about missing content with specific messages and can be dismissed via a button. The implementation includes comprehensive unit tests covering various alert scenarios.

Changes:

  • Added internationalized alert messages for missing video/problem content
  • Implemented conditional alert display logic based on loaded state and content availability
  • Created 17 unit tests to cover alert display, dismissal, and edge cases

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/editors/containers/InVideoQuizEditor/messages.ts Added four new i18n messages for alert title, content messages, and dismiss button
src/editors/containers/InVideoQuizEditor/index.jsx Implemented alert UI with custom dismiss button, conditional rendering based on content availability
src/editors/containers/InVideoQuizEditor/index.test.jsx Added comprehensive test suite with 17 tests covering alert scenarios and component behavior

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@djoseph-apphelix djoseph-apphelix force-pushed the djoseph-apphelix/TNL2-541 branch 2 times, most recently from e62bef4 to 7ae42b0 Compare February 25, 2026 09:08
Copilot AI review requested due to automatic review settings February 25, 2026 09:08
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

const page = (
<div className="in-video-quiz-editor">
{(hasNoVideos || hasNoProblems) && !contentAlertDismissed && (
<Alert variant="danger" dismissible onClose={() => setContentAlertDismissed(true)}>
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using variant="warning" instead of variant="danger" for this alert. Based on the codebase patterns, "danger" is typically reserved for errors and validation failures that prevent functionality, while "warning" is used for informational alerts. The "Content not found" scenario is informational - the editor still functions, but the user should be aware that video or problem components are missing from the unit. This follows the pattern used in EditorContainer.tsx and other files where warnings notify users about conditions that need attention but don't break functionality.

Suggested change
<Alert variant="danger" dismissible onClose={() => setContentAlertDismissed(true)}>
<Alert variant="warning" dismissible onClose={() => setContentAlertDismissed(true)}>

Copilot uses AI. Check for mistakes.
@djoseph-apphelix djoseph-apphelix changed the title feat: In-video quiz - Create 'Content not found' alert if either problem or video not found in unit feat(invideoquiz-editor): add validation for required data Feb 26, 2026
@djoseph-apphelix djoseph-apphelix merged commit 712dea7 into release-ulmo Feb 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants