Improve AI prompt button UX and fix AudioContext initialization#14
Improve AI prompt button UX and fix AudioContext initialization#14
Conversation
- Show "Copy prompt" text on mobile (was hidden on small screens) - Fix first-click sound by lazily initializing AudioContext in play() - Change copied message to "Paste into your AI!" for clearer next step https://claude.ai/code/session_01R7NXwectGATMAhTcFRxbnF
✅ Deploy Preview for scqcs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Summary of ChangesHello @kmay89, 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 focuses on enhancing the user experience of the AI prompt copy buttons by standardizing their visual presentation and clarifying their text labels. Concurrently, it addresses a critical issue with AudioContext initialization, ensuring that audio playback is reliable and consistent by creating the context on-demand when a sound is triggered, thereby respecting browser autoplay policies and preventing silent audio failures. Highlights
Changelog
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 successfully improves the user experience for the AI prompt copy buttons and fixes a bug in the AudioContext initialization. The UI changes make the button styling consistent and the labels clearer. The JavaScript change correctly defers AudioContext creation until it's needed within a user gesture, resolving an issue where sounds might not play on hover. The changes are well-executed. I've added a couple of suggestions to remove some minor code redundancy introduced by these improvements.
- Remove duplicate .hero-ai-prompt .ai-prompt-copy rule (identical to base) - Remove empty init() method and its call since AudioContext is now lazy https://claude.ai/code/session_01R7NXwectGATMAhTcFRxbnF
Summary
This PR improves the user experience of the AI prompt copy buttons and fixes the AudioContext initialization to work reliably across browsers.
Key Changes
UI/UX Improvements:
5px 10pxand font-size to10pxacross all screen sizesAudioContext Fix:
init()method's one-time click listener to theplay()methodImplementation Details
The AudioContext initialization change addresses a potential issue where the one-time listener might not fire before a sound is requested, causing audio to fail silently. By creating the context on-demand in
play(), we ensure it's always available when needed while still respecting browser security requirements.https://claude.ai/code/session_01R7NXwectGATMAhTcFRxbnF