TT-7290,7216,6739,7244,7081 Enhance MediaRecord and CommentEditor components with audio draft management and scrollbar handling#336
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the renderer discussion/audio-recording UX by (1) adding finer-grained control over MediaRecord’s UI, (2) tracking audio-draft state while composing comments, and (3) improving layout responsiveness by accounting for vertical scrollbar width when computing available panel widths.
Changes:
- Added scrollbar-width measurement utilities and integrated them into
usePaneWidthandDiscussionPanelfor better width calculations when scrollbars appear. - Introduced audio-draft tracking from
CommentEditorup toDiscussionCardto enable actions while an audio draft exists (even before upload/canSave fully propagates). - Added
hideSegmentControlsprop plumbing throughMediaRecord(forwarded toWSAudioPlayer) and used it inCommentEditor’s compact recorder.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/renderer/src/utils/index.ts | Re-exports the new scrollbar utility module from the utils barrel. |
| src/renderer/src/utils/getScrollbarWidth.ts | Adds DOM helpers to measure scrollbar width and detect presence of vertical scrollbars. |
| src/renderer/src/components/usePaneWidth.ts | Incorporates scrollbar width into pane-width calculations and returns it to callers. |
| src/renderer/src/components/MediaRecord.tsx | Adds hideSegmentControls prop and forwards it to WSAudioPlayer. |
| src/renderer/src/components/Discussions/DiscussionPanel.tsx | Adjusts panel width/margins using measured scrollbar width on desktop. |
| src/renderer/src/components/Discussions/DiscussionList.tsx | Removes hard-coded scrollbar spacing, and switches close-button disabling to state-driven anyChanged. |
| src/renderer/src/components/Discussions/DiscussionCard.tsx | Tracks hasAudioDraft and uses it to control save/add enablement; wires callback into CommentEditor. |
| src/renderer/src/components/Discussions/CommentEditor.tsx | Adds onAudioDraftChange, refactors recorder/action button layout, and improves unsaved/draft tracking during recording. |
Comment on lines
+4
to
+16
| const outer = document.createElement('div'); | ||
| outer.style.visibility = 'hidden'; | ||
| outer.style.overflow = 'scroll'; | ||
| // @ts-expect-error msOverflowStyle is IE-specific | ||
| outer.style.msOverflowStyle = 'scrollbar'; | ||
| document.body.appendChild(outer); | ||
|
|
||
| const inner = document.createElement('div'); | ||
| outer.appendChild(inner); | ||
|
|
||
| const scrollbarWidth = outer.offsetWidth - inner.offsetWidth; | ||
| outer.parentNode?.removeChild(outer); | ||
| return scrollbarWidth; |
Comment on lines
+50
to
+54
| const [scrollbarWidth, setScrollbarWidth] = useState(0); | ||
| const cachedScrollbarWidthRef = useMemo( | ||
| () => (typeof document !== 'undefined' ? measureScrollbarWidth() : 0), | ||
| [] | ||
| ); |
added 3 commits
May 29, 2026 12:07
…ponents with audio draft management and scrollbar handling - TT-7290 Added `hideSegmentControls` prop to `MediaRecord` for better UI control. - TT-7081 Implemented scrollbar width measurement and handling in `usePaneWidth` and `DiscussionPanel` to improve layout responsiveness. - Introduced `onAudioDraftChange` callback in `CommentEditor` to manage audio draft state. - Updated `DiscussionCard` to track audio draft status and integrate with `CommentEditor`. - Refactored `DiscussionList` to utilize new state management for changes and scrollbar adjustments.
…ndling for pending audio uploads. Introduced a ref for canSaveRecording to track its state and updated logic to wait for audio comment blob readiness before saving.
- to remove dynamic scrollbar width calculation and update state destructuring to include discussOpen - recalculate measureScrollbarWidth
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
hideSegmentControlsprop toMediaRecordfor better UI control.usePaneWidthandDiscussionPanelto improve layout responsiveness.onAudioDraftChangecallback inCommentEditorto manage audio draft state.DiscussionCardto track audio draft status and integrate withCommentEditor.DiscussionListto utilize new state management for changes and scrollbar adjustments.