feat(voice): add VoiceWaveformVisualizer component for voice interaction feedback#21680
feat(voice): add VoiceWaveformVisualizer component for voice interaction feedback#21680sakshisemalti wants to merge 2 commits intogoogle-gemini:mainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a VoiceWaveformVisualizer component. The implementation is mostly solid, but a critical issue was identified that causes an infinite render loop for non-animating states, which would likely freeze the application. A suggested fix for this problem is included in the review.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a new VoiceWaveformVisualizer component. While well-structured, a critical issue exists where STATIC_HEIGHTS is used but undefined, causing a ReferenceError and preventing rendering. The comments highlight this and suggest defining these values as named constants to replace magic numbers, improving readability and maintainability as per repository guidelines.
| VoiceWaveformVisualizerProps | ||
| > = ({ state }) => { | ||
| const isScreenReaderEnabled = useIsScreenReaderEnabled(); | ||
| const [heights, setHeights] = useState<number[]>(STATIC_HEIGHTS); |
There was a problem hiding this comment.
The constant STATIC_HEIGHTS is used here but is not defined, which will cause a ReferenceError at runtime. To improve readability and maintainability, these values should be defined as a named constant (e.g., WAVEFORM_INITIAL_HEIGHTS) at the top of the file, replacing these magic numbers.
| const [heights, setHeights] = useState<number[]>(STATIC_HEIGHTS); | |
| const [heights, setHeights] = useState<number[]>([2, 3, 4, 3, 2]); |
References
- Magic numbers, especially those used for layout or padding, should be replaced with named constants to improve readability and maintainability. This makes the intent clearer and simplifies future updates.
|
|
||
| useEffect(() => { | ||
| if (state !== 'listening' && state !== 'speaking') { | ||
| setHeights(STATIC_HEIGHTS); |
There was a problem hiding this comment.
The constant STATIC_HEIGHTS is used here but is not defined, which will cause a ReferenceError. To avoid code duplication and improve readability, these values should be defined as a named constant (e.g., WAVEFORM_INITIAL_HEIGHTS) at the top of the file, replacing these magic numbers.
| setHeights(STATIC_HEIGHTS); | |
| setHeights([2, 3, 4, 3, 2]); |
References
- Magic numbers, especially those used for layout or padding, should be replaced with named constants to improve readability and maintainability. This makes the intent clearer and simplifies future updates.
|
Thanks for the PR! There is already an open PR for this I believe: #21115 Going to close this as a duplicate, please take a look at the existing PR and feel free to add any comments or things you notice to help it 😄 |
|
Thanks for the pointer! Will take a look at #21115 and see where I can contribute. |
Summary
Adds a VoiceWaveformVisualizer component that renders animated terminal feedback for voice interaction states: listening, processing and speaking. Returns null when idle. Includes screen reader support.
Details
Adds a standalone VoiceWaveformVisualizer component as a foundation for voice UI feedback. The component handles four states (idle, listening, processing, speaking) with animated bar logic and screen reader support. Uses existing theme colors and follows the same patterns as other UI components.
This is a UI building block, integration with the voice input pipeline will follow in a subsequent PR.
Related Issues
Related to #18067
How to Validate
cd packages/clinpx vitest run src/ui/components/VoiceWaveformVisualizer.test.tsxAll tests should pass.
Pre-Merge Checklist