Skip to content

feat: add TranscriptsDrawer component for managing video transcripts - #4

Merged
pallakartheekreddy merged 3 commits into
Sunbird-Knowlg:v1.0.3from
Deeksha1502:main
Aug 11, 2026
Merged

pallakartheekreddy merged 3 commits into
Sunbird-Knowlg:v1.0.3from
Deeksha1502:main

Conversation

@Deeksha1502

Copy link
Copy Markdown
Collaborator
  • Implemented TranscriptsDrawer to display and manage transcripts for video content.
  • Added functionality to parse and display transcript segments, including editing capabilities.
  • Integrated approval and rejection workflows for transcripts with backend service calls.
  • Enhanced user experience with loading states, error handling, and status updates.

test: add unit tests for useEditor transcript generation logic

  • Created tests to verify transcript creation on video upload based on user input.
  • Ensured that transcript creation is skipped for non-video files and unchecked options.
  • Validated that upload success is not blocked by failed transcript creation.
  • Confirmed that transcript creation logic is correctly decoupled from other submission actions.

- Implemented TranscriptsDrawer to display and manage transcripts for video content.
- Added functionality to parse and display transcript segments, including editing capabilities.
- Integrated approval and rejection workflows for transcripts with backend service calls.
- Enhanced user experience with loading states, error handling, and status updates.

test: add unit tests for useEditor transcript generation logic

- Created tests to verify transcript creation on video upload based on user input.
- Ensured that transcript creation is skipped for non-video files and unchecked options.
- Validated that upload success is not blocked by failed transcript creation.
- Confirmed that transcript creation logic is correctly decoupled from other submission actions.
Copilot AI lite review requested due to automatic review settings August 10, 2026 11:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds end-to-end transcript support for video content in the generic editor: users can opt in to transcript generation during upload, view/manage transcript languages and segments in a new drawer, and pass live captions into the preview player.

Changes:

  • Introduces TranscriptsDrawer UI (language list, segment view/edit, approve/reject flows) and supporting styling/icons/i18n.
  • Adds transcript-related service APIs (create/update/approve/reject/readTranscripts) plus readContent cache: 'no-store' behavior.
  • Updates upload flow to optionally kick off transcript generation for videos, and adds unit tests across hook/UI/service.

Reviewed changes

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

Show a summary per file
File Description
src/useEditor.ts Adds upload-time transcript kickoff + header gating state (hasTranscripts).
src/useEditor.test.ts Tests transcript creation behavior triggered by uploadFile.
src/types.ts Extends drawer kinds + adds transcript data/segment types.
src/test/mockEd.ts Extends mock service with transcript endpoints for tests.
src/services/ContentEditorService.ts Implements transcript endpoints; adds cache: 'no-store' for readContent; adds readTranscripts via /portal.
src/services/ContentEditorService.test.ts Adds unit tests for caching and transcript service endpoints.
src/icons.tsx Adds CaptionsIcon.
src/i18n/translations.en.ts Adds transcript-related strings.
src/editor.scss Adds styles for the video transcript confirm step + transcripts drawer.
src/ContentEditor.tsx Mounts TranscriptsDrawer.
src/constants.ts Adds video mime/extension helpers (isVideoMimeType, etc.).
src/components/UploadCanvas.tsx Adds “generate transcripts?” confirm step for video uploads.
src/components/UploadCanvas.test.tsx Tests video confirm step + checkbox behavior.
src/components/TranscriptsDrawer.tsx New drawer component for viewing/editing/approving/rejecting transcripts.
src/components/TranscriptsDrawer.test.tsx Comprehensive tests for drawer states, segment parsing/editing, approve/reject flows.
src/components/Header.tsx Adds “View transcript” button (currently gated by hasTranscripts).
src/components/Header.test.tsx Tests transcript button visibility and drawer open.
src/components/EditorPreview.tsx Fetches live transcripts and injects them into preview metadata.
src/components/EditorPreview.test.tsx Tests transcript fetch/mapping behavior for preview.
package.json Bumps package version to 2.0.5.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/useEditor.ts Resolved
Comment thread src/useEditor.ts Resolved
Comment thread src/components/UploadCanvas.tsx Resolved
Comment thread src/components/TranscriptsDrawer.tsx Resolved
Comment thread src/components/TranscriptsDrawer.tsx Resolved
Comment thread src/i18n/translations.en.ts Resolved
…unctionality and clarity

- Enhanced TranscriptsDrawer to utilize translation functions for timestamps and status messages.
- Simplified comments and improved documentation for better readability.
- Updated UploadCanvas to reset transcript generation checkbox when uploading a new video.
- Added tests for transcript polling behavior in useEditor hook.
- Improved styling and removed unnecessary comments in editor.scss.
- Updated translations to include new time-related strings.
- Refactored ContentEditorService to clarify API endpoint usage and improve documentation.

@pallakartheekreddy pallakartheekreddy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code review of the transcripts feature. Typecheck and lint are clean, and the new tests pass locally (the 21 failing service tests are the pre-existing localStorage.getItem is not a function jsdom issue, also failing on main — not caused by this PR).

12 inline findings below, roughly ordered by impact:

Correctness / data integrity

  • TranscriptsDrawer.openSegments has no request-sequence guard — a slow fetch for language A can land under language B and be saved onto B.
  • saveSegments PATCHes the parsed segment list back as the full replacement, dropping every field parseSegments did not keep (Whisper's seek/tokens/avg_logprob, non-numeric start/end, whole segments with non-string text).
  • A failing confirmation re-read after a successful approve/reject is reported to the user as "Couldn't complete this action".
  • handleRecheckStatus has no .catch → unhandled rejection and no feedback when the re-read fails.

Cost / lifecycle

  • useEditor polls the expensive ?enrich=all read every 20s forever for any video whose transcripts never materialise (e.g. the user unchecked the box).
  • EditorPreview fetches the same data a third time and remounts the renderer iframe when it resolves.

Smaller / polish

  • Inconsistent default for a missing status (Live in the player mapping vs Draft in the drawer), unreachable statusLabel default, possibly-undefined React key, cross-origin download attribute, hardcoded /portal/ prefix that ignores apiSlug, and EN-only translations.

Nothing here blocks the overall design — the feature is well structured and the test coverage is good.

Comment thread src/useEditor.ts Resolved
Comment thread src/components/EditorPreview.tsx Resolved
Comment thread src/components/EditorPreview.tsx Resolved
Comment thread src/components/EditorPreview.tsx Resolved
Comment thread src/components/TranscriptsDrawer.tsx Resolved
Comment thread src/components/TranscriptsDrawer.tsx Resolved
Comment thread src/components/TranscriptsDrawer.tsx Resolved
Comment thread src/components/TranscriptsDrawer.tsx Resolved
Comment thread src/services/ContentEditorService.ts Resolved
Comment thread src/i18n/translations.en.ts Resolved
- Added scoped styles for the transcripts drawer in editor.scss to maintain consistent font and button styles.
- Implemented new translations for transcripts in Arabic, English, French, Hindi, Portuguese, and Tamil, including various UI strings related to transcript generation, viewing, and status updates.
- Updated ContentEditorService to handle transcript reading and updating with improved caching strategies, including Cache-Control headers to prevent stale responses.
- Enhanced tests for ContentEditorService to ensure proper handling of transcript-related functionality and caching behavior.
- Modified useEditor hook to manage transcript state, including polling for transcript availability and handling non-video content scenarios.
@pallakartheekreddy
pallakartheekreddy merged commit 0207b1a into Sunbird-Knowlg:v1.0.3 Aug 11, 2026
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