Skip to content

fix: prevent system prompt icon layout shift with invisible placeholder#144

Merged
AnthonyRonning merged 1 commit intomasterfrom
claude/issue-143-20250714_035334
Jul 15, 2025
Merged

fix: prevent system prompt icon layout shift with invisible placeholder#144
AnthonyRonning merged 1 commit intomasterfrom
claude/issue-143-20250714_035334

Conversation

@AnthonyRonning
Copy link
Contributor

@AnthonyRonning AnthonyRonning commented Jul 14, 2025

Fixes layout shift issue when system prompt icon loads for paid users by implementing invisible placeholder approach.

Changes

  • Always render system prompt container div to reserve space
  • Use invisible CSS class instead of conditional rendering
  • Prevent layout shift when billing status loads for paid users
  • Maintain accessibility with proper button disabled state

Fixes #143

Generated with Claude Code

Summary by CodeRabbit

  • Style

    • Improved consistency of the system prompt section by always displaying the toggle button, which is now disabled and visually indicated as such when editing is not allowed.
  • User Interface

    • The system prompt toggle button remains visible but is disabled when editing is unavailable, ensuring a more consistent user experience.
    • The system prompt container is always rendered, improving layout stability regardless of editing permissions.

@coderabbitai
Copy link

coderabbitai bot commented Jul 14, 2025

Walkthrough

The rendering logic for the system prompt section in the chat UI was updated so that the container and toggle button are always present in the DOM. When editing is not allowed, the section is visually hidden and the toggle button is disabled, rather than omitting these elements entirely.

Changes

File(s) Change Summary
frontend/src/components/ChatBox.tsx Modified system prompt UI to always render the container and toggle button, using "invisible" and "disabled" states when editing is disallowed. Updated button classes and attributes for consistent presence and accessibility.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ChatBox
    participant SystemPromptSection

    User->>ChatBox: Loads chat interface
    ChatBox->>SystemPromptSection: Render system prompt UI
    alt Editing allowed
        SystemPromptSection->>User: Show toggle button (enabled)
        User->>SystemPromptSection: Click toggle to expand/collapse
        SystemPromptSection->>User: Show/hide editable textarea
    else Editing not allowed
        SystemPromptSection->>User: Show toggle button (disabled, invisible)
    end
Loading

Assessment against linked issues

Objective Addressed Explanation
Always render system prompt icon/placeholder to prevent chatbox shifting (#143)
Use invisible or hidden placeholder when editing not allowed (#143)
Disable toggle and editing controls for non-paid users, but keep UI stationary (#143)

Possibly related PRs

Poem

A button that hides, but never will flee,
In the chatbox it waits, as still as can be.
Paid or not, the space is reserved,
No more shifting UI—consistency preserved!
With invisible grace, the prompt holds its place,
And the rabbit hops on, with a smile on its face. 🐇


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 48ffe0e and 115a0a5.

📒 Files selected for processing (1)
  • frontend/src/components/ChatBox.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/components/ChatBox.tsx
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR implements an elegant solution to prevent layout shifts in the chat interface when the system prompt icon loads for paid users. Instead of conditionally rendering the system prompt container ({canEditSystemPrompt && ...}), it now always renders the container but uses the invisible CSS class to hide it when necessary. This approach reserves the space upfront, preventing the chat interface from jumping when the billing status loads.

The change aligns well with the existing chat component architecture and follows web accessibility best practices by maintaining the element in the DOM structure. The button's disabled state is properly managed, and all existing functionality (like the active prompt indicator) remains intact.

Confidence score: 5/5

  1. This PR is extremely safe to merge with minimal risk
  2. The changes are isolated to UI rendering behavior, with no functional changes to the underlying system prompt logic
  3. Files needing attention: None - the changes are straightforward and well-contained in ChatBox.tsx

1 file reviewed, no comments
Edit PR Review Bot Settings | Greptile

@AnthonyRonning AnthonyRonning force-pushed the claude/issue-143-20250714_035334 branch from 48ffe0e to 115a0a5 Compare July 14, 2025 21:13
- Always render system prompt container div to reserve space
- Use 'invisible' CSS class instead of conditional rendering
- Prevent layout shift when billing status loads for paid users
- Maintain accessibility with proper button disabled state

Fixes #143

Co-authored-by: Anthony <AnthonyRonning@users.noreply.github.com>
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR also includes several additional changes beyond the layout fix covered in previous reviews:

  1. Added support for two new pro-tier language models:

    • Mistral Small 3.1 24B (128k token limit, vision support)
    • Qwen 2.5 72B (128k token limit)
  2. Updated pricing configuration to reflect these new models across all tiers

  3. Improved model filtering logic to exclude transcription models

  4. Version bump from 1.1.4 to 1.1.5 across multiple configuration files:

    • frontend/package.json
    • frontend/src-tauri/Cargo.toml
    • frontend/src-tauri/tauri.conf.json
    • iOS configuration files

PR Description Notes:

  • The PR description focuses only on the layout fix but includes significant model additions that should have been mentioned

Confidence score: 4/5

  1. Changes are well-tested and mostly isolated, but broader than described
  2. While the layout fix is safe, the addition of new models warrants more careful testing
  3. Files needing attention: ModelSelector.tsx and pricingConfig.tsx to verify model configurations

8 files reviewed, no comments
Edit PR Review Bot Settings | Greptile

@cloudflare-workers-and-pages
Copy link

Deploying maple with  Cloudflare Pages  Cloudflare Pages

Latest commit: 115a0a5
Status: ✅  Deploy successful!
Preview URL: https://9bd0dd60.maple-ca8.pages.dev
Branch Preview URL: https://claude-issue-143-20250714-03-hpjn.maple-ca8.pages.dev

View logs

@AnthonyRonning AnthonyRonning merged commit 62b9efd into master Jul 15, 2025
6 of 7 checks passed
@AnthonyRonning AnthonyRonning deleted the claude/issue-143-20250714_035334 branch July 15, 2025 02:27
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.

Cache whether the system prompt icon should be there for paid users

1 participant