Skip to content

Comments

🎨 Palette: Improve "Random idea" button with loading state#72

Open
Krosebrook wants to merge 1 commit intomainfrom
palette-random-idea-ux-6615752517414023914
Open

🎨 Palette: Improve "Random idea" button with loading state#72
Krosebrook wants to merge 1 commit intomainfrom
palette-random-idea-ux-6615752517414023914

Conversation

@Krosebrook
Copy link
Owner

@Krosebrook Krosebrook commented Feb 19, 2026

Improved the "Random idea" button in the Generate page by adding a loading state and using the standardized Button component for better accessibility and UX.


PR created automatically by Jules for task 6615752517414023914 started by @Krosebrook


Summary by cubic

Improved the “Random idea” button on the Generate page by adding a loading state and switching to the design system Button for consistent UX and accessibility. This prevents rapid double-clicks and gives clear feedback while fetching a prompt.

  • New Features
    • Replaced the raw button with Button (ghost, small) for consistent focus and styling.
    • Added loading spinner and disabled state tied to async prompt fetch.

Written for commit e861b80. Summary will update on new commits.

💡 What: Replaced the raw "Random idea" button with a `Button` component that includes a loading spinner and disabled state during async generation.
🎯 Why: Users could click the button multiple times without feedback, and the button style was inconsistent with the design system.
♿ Accessibility: Added proper disabled state and focus management via `Button` component.

Co-authored-by: Krosebrook <214532761+Krosebrook@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings February 19, 2026 06:00
@coderabbitai
Copy link

coderabbitai bot commented Feb 19, 2026

Warning

Rate limit exceeded

@Krosebrook has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 13 minutes and 46 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch palette-random-idea-ux-6615752517414023914

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Krosebrook, 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 significantly enhances the user experience and accessibility of the "Random idea" button on the Generate page. By introducing a dedicated loading state and migrating the button to a standardized Button component, the changes provide clear visual feedback during prompt generation, prevent unintended multiple clicks, and ensure consistent UI behavior across the application.

Highlights

  • Enhanced User Experience: Implemented a loading state for the "Random idea" button to provide visual feedback during asynchronous operations, preventing user confusion and potential double-submissions.
  • Component Standardization: Replaced the custom "Random idea" button with the design system's Button component, improving accessibility, consistency, and simplifying future maintenance.
  • Accessibility Improvement: Ensured the button's disabled state and loading indicator are properly managed, aligning with best practices for interactive UI elements.
  • Documentation Update: Added a new learning entry to .jules/palette.md documenting the importance of async button feedback and the use of the Button component for such scenarios.
Changelog
  • .jules/palette.md
    • Added a new learning entry about the importance of async button feedback and using the Button component for loading states.
  • client/src/pages/Generate.tsx
    • Introduced isRandomLoading state to manage the loading status of the random prompt feature.
    • Modified handleRandomPrompt to set isRandomLoading before and after fetching a random prompt, ensuring the loading state is always reset.
    • Replaced the native <button> element for "Random idea" with the Button component.
    • Added variant="ghost", size="sm", and updated className for styling the new Button component.
    • Implemented conditional rendering for the button icon, displaying a Loader2 spinner when isRandomLoading is true and the Shuffle icon otherwise.
    • Disabled the button using disabled={loading || isRandomLoading} during generation or random prompt fetching.
Activity
  • PR created automatically by Jules for task 6615752517414023914, initiated by @Krosebrook.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request successfully adds a loading state to the 'Random idea' button, improving user experience by providing visual feedback during an async operation. The implementation correctly uses a separate loading state and replaces the native <button> with the design system's Button component. My review includes a suggestion to improve error handling for a better user experience and a comment on styling for better long-term maintainability.

Comment on lines +101 to +104
const prompt = await getRandomPrompt();
if (prompt) {
setTopic(prompt);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The current implementation doesn't provide feedback to the user if getRandomPrompt() fails. The getRandomPrompt hook swallows errors and returns null, so the spinner will just disappear without any explanation, leading to a confusing user experience. We should inform the user that the action failed by showing a toast notification.

      const prompt = await getRandomPrompt();
      if (prompt) {
        setTopic(prompt);
      } else {
        toast({
          variant: "destructive",
          title: "Failed to get random idea",
          description: "Please try again.",
        });
      }

onClick={handleRandomPrompt}
className="text-xs text-primary hover:text-primary/80 flex items-center gap-1 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary rounded-sm"
disabled={loading || isRandomLoading}
className="text-xs text-primary hover:text-primary/80 h-auto p-0 hover:bg-transparent"
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The className prop is overriding several styles from the Button component's size="sm" prop, specifically min-height and padding (with h-auto and p-0). This often indicates that the component library might be missing a suitable variant, like a link variant for text-style buttons.

While this works, fighting the component's built-in styles can make maintenance harder. As a small cleanup, the text-xs class is redundant here because it's already applied by size="sm".

                    className="text-primary hover:text-primary/80 h-auto p-0 hover:bg-transparent"

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

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 improves the user experience of the "Random idea" button on the Generate page by adding a loading state to prevent double-submissions and provide visual feedback during the async operation. The button has been upgraded from a raw HTML <button> element to the standardized Button component from the design system.

Changes:

  • Added loading state management (isRandomLoading) with proper try/finally error handling for the random prompt button
  • Replaced raw button element with accessible Button component including disabled state and loading spinner
  • Documented the async button feedback pattern in .jules/palette.md for future reference

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
client/src/pages/Generate.tsx Added isRandomLoading state, wrapped handleRandomPrompt with try/finally, converted button to Button component with loading spinner and disabled state
.jules/palette.md Documented the async button feedback pattern as a learning for future development

Comment on lines +220 to +231
<Button
type="button"
variant="ghost"
size="sm"
onClick={handleRandomPrompt}
className="text-xs text-primary hover:text-primary/80 flex items-center gap-1 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary rounded-sm"
disabled={loading || isRandomLoading}
className="text-xs text-primary hover:text-primary/80 h-auto p-0 hover:bg-transparent"
data-testid="button-random-prompt"
>
<Shuffle className="w-3 h-3" />
{isRandomLoading ? <Loader2 className="w-3 h-3 animate-spin" /> : <Shuffle className="w-3 h-3" />}
Random idea
</button>
</Button>
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

Consider adding accessibility attributes for better screen reader support. The AiSuggestButton component includes aria-busy={isLoading} on the Button and aria-hidden="true" on the icon elements. While not consistently applied across the codebase, these attributes improve the experience for users with assistive technologies by:

  1. aria-busy announces the loading state to screen readers
  2. aria-hidden="true" on decorative icons prevents redundant announcements

Example:

  • Add aria-busy={isRandomLoading} to the Button
  • Add aria-hidden="true" to both the Loader2 and Shuffle icons

Copilot uses AI. Check for mistakes.
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.

1 participant