8000 add codeblock tooltips and fix spacing by BilalG1 · Pull Request #934 · stack-auth/stack-auth · GitHub
[go: up one dir, main page]

Skip to content

Conversation

BilalG1
Copy link
Collaborator
@BilalG1 BilalG1 commented Oct 7, 2025
Screenshot 2025-10-07 at 4 15 53 PM

High-level PR Summary

This PR adds an optional tooltip feature to code blocks and improves the UI layout and spacing in the product catalog view. The CodeBlock component now accepts a tooltip prop that displays an info tooltip next to the copy button. The product catalog view receives several layout improvements including better spacing, reorganized form controls, and the addition of tooltips to code blocks that explain their purpose. The changes also swap item ID display for item display names in some places for better readability.

⏱️ Estimated Review Time: 15-30 minutes

💡 Review Order Suggestion
Order File Path
1 apps/dashboard/src/components/code-block.tsx
2 apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/products/page-client-catalogs-view.tsx

Need help? Join our Discord

Analyze latest changes


Important

Add tooltips to code blocks and adjust spacing in ProductItemRow for improved UI and readability.

  • Code Block Enhancements:
    • Add tooltip prop to CodeBlock in code-block.tsx for displaying tooltips with additional information.
    • Use SimpleTooltip to show tooltips next to the copy button.
  • UI Adjustments:
    • Adjust spacing in ProductItemRow in page-client-catalogs-view.tsx for better layout.
    • Replace itemId with itemDisplayName for better readability.
    • Add tooltips to buttons in ProductCard for checkout and item retrieval.

This description was created by Ellipsis for 5547ddb. You can customize this summary. It will automatically update as commits are pushed.

Summary by CodeRabbit

  • New Features

    • Inline tooltips on code blocks and checkout actions.
    • Per-item expiration editing via a dropdown, including a “Never expires” option.
    • Remove item action integrated directly into the editing row.
  • UI Improvements

    • Redesigned product item editing layout with clearer headers, spacing, and grouped controls.
    • Consistent use of item display names across views and cards.
    • Enhanced checkout code block in product cards with explanatory tooltip.

@BilalG1 BilalG1 marked this pull request as ready for review October 7, 2025 23:14
Copy link
vercel bot commented Oct 7, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
stack-backend Error Error Oct 10, 2025 11:32am
stack-dashboard Error Error Oct 10, 2025 11:32am
stack-demo Error Error Oct 10, 2025 11:32am
stack-docs Error Error Oct 10, 2025 11:32am

Copy link
Contributor
coderabbitai bot commented Oct 7, 2025

Walkthrough

Refactors the product catalog editing UI to use itemDisplayName consistently, adds per-item expiry editing via a dropdown, integrates inline tooltips (including in the checkout code block), and adjusts ProductCard label resolution. Updates CodeBlock component API to accept a tooltip prop and a typed props object.

Changes

Cohort / File(s) Summary
Product catalog UI & editing flow
apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/products/page-client-catalogs-view.tsx
Reworked ProductItemRow layout; uses itemDisplayName across views; groups quantity and remove controls; adds per-item expires editing with DropdownMenu (incl. “Never expires”); wires expires to onSave; updates ProductCard item label derivation; adds tooltips to code blocks and checkout action.
CodeBlock component API
apps/dashboard/src/components/code-block.tsx
Changes function signature to typed CodeBlockProps; adds optional tooltip?: ReactNode; adjusts customRender typing; renders SimpleTooltip in header when provided; updates imports to include ReactNode and SimpleTooltip.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant U as User
    participant R as ProductItemRow
    participant D as DropdownMenu (Expires)
    participant S as onSave handler

    U->>R: Enter edit mode
    R-->>U: Show header (itemDisplayName), qty input, Remove button
    U->>R: Adjust quantity
    U->>D: Open expires menu
    D-->>U: Options (Never, ...EXPIRES_OPTIONS)
    U->>D: Select expires value
    D-->>R: expires = selectedValue
    U->>R: Save changes
    rect rgba(230,255,230,0.4)
    note right of R: New behavior: expires included in save payload
    R->>S: onSave({ itemId, quantity, expires })
    end
    S-->>R: Save result (success/error)
    R-->>U: Update view / show status

    %% Tooltip interaction (CodeBlock/Checkout)
    U->>R: Hover info icon (tooltip)
    R-->>U: Show contextual tooltip
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I nudge the knobs with whiskered care,
Rename the stars so labels fair,
A drop of time—expires set—
Tooltips twinkle, don’t forget.
CodeBlock hums with subtle glow,
Copy, click, and off we go—
A rabbit ships the tidy flow. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description Check ⚠️ Warning The pull request description only contains the boilerplate comment reminding contributors to read the contributing guidelines and does not include any of the required sections such as a summary of changes, motivation, implementation details, or testing instructions. Without those details, reviewers cannot understand the scope, rationale, or impact of the proposed changes. The description does not adhere to the expected repository template beyond the placeholder comment. Please update the pull request description by replacing or augmenting the placeholder comment with a clear summary of the changes, the motivation for them, implementation details, testing instructions, and any relevant issue or documentation links. Ensure you follow the contributing guidelines and the repository’s description template to include all required sections. This will help reviewers accurately assess and approve your changes.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly and accurately summarizes the two main changes introduced—the addition of tooltips to code blocks and the adjustment of UI spacing—without extraneous wording or vague terms. It clearly reflects the core updates in both the CodeBlock component and the ProductItemRow layout, making it easy for reviewers to understand the purpose at a glance.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch payments-info-tooltips

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.

Copy link
claude bot commented Oct 7, 2025

Claude finished @BilalG1's task —— View job


I'll analyze this and get back to you.

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 Overview

Summary

This PR enhances the payment products management interface by adding tooltip functionality to code blocks and improving the layout spacing. The changes involve two main components: the CodeBlock component itself and its usage in the payments catalog view.

The CodeBlock component now supports an optional tooltip prop that renders an informative tooltip using the SimpleTooltip component from @stackframe/stack-ui. The tooltip is positioned alongside the existing copy button in a flexbox container for proper alignment. The component's TypeScript interface has been properly updated to include the new tooltip functionality with type safety.

In the payments catalog view, the ProductItemRow editing interface has been restructured from a 3-row layout to a more compact 2-row layout. This improves visual organization by consolidating related controls (expires and repeat settings) on the same row and better aligning the remove button with the quantity input. Additionally, tooltips have been added to code block examples to provide contextual information about their functionality, and there's a consistency fix where item IDs are displayed instead of display names.

These changes integrate well with the existing codebase architecture, using established UI components and following the project's TypeScript patterns. The tooltip implementation leverages the existing UI library components and maintains consistency with other tooltip usage throughout the application.

Important Files Changed

Changed Files
Filename Score Overview
apps/dashboard/src/components/code-block.tsx 5/5 Added tooltip support to CodeBlock component with proper TypeScript typing and flex layout for tooltip/copy button alignment
apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/products/page-client-catalogs-view.tsx 4/5 Restructured ProductItemRow layout from 3-row to 2-row design, added code block tooltips, and fixed item display consistency

Confidence score: 5/5

  • This PR is safe to merge with minimal risk as it focuses on UI improvements and tooltip additions without touching core business logic
  • Score reflects straightforward UI enhancements with proper TypeScript implementation and good integration with existing components
  • No files require special attention as both changes are well-implemented UI improvements

Sequence Diagram

sequenceDiagram
    participant User
    participant ProductCard
    participant CodeBlock
    participant SimpleTooltip
    participant CopyButton
    
    User->>ProductCard: "Hover over product card"
    ProductCard->>CodeBlock: "Render code example with tooltip prop"
    CodeBlock->>SimpleTooltip: "Create tooltip component with info"
    Note over SimpleTooltip: "Tooltip: 'Retrieves this item for the active customer and reads the current quantity they hold.'"
    CodeBlock->>CopyButton: "Create copy button for code content"
    User->>SimpleTooltip: "Hover over info icon"
    SimpleTooltip-->>User: "Display tooltip text"
    User->>CopyButton: "Click copy button"
    CopyButton-->>User: "Copy code to clipboard"
Loading

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

8000

Copy link
@recurseml recurseml bot left a comment

Choose a reason for hiding this comment

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

Review by RecurseML

🔍 Review performed on 017b43f..5547ddb

✨ No bugs found, your code is sparkling clean

✅ Files analyzed, no issues (2)

apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/products/page-client-catalogs-view.tsx
apps/dashboard/src/components/code-block.tsx

Copy link
Contributor
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 017b43f and 5547ddb.

📒 Files selected for processing (2)
  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/products/page-client-catalogs-view.tsx (6 hunks)
  • apps/dashboard/src/components/code-block.tsx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
{apps/dashboard,apps/dev-launchpad,packages/stack-ui,packages/react}/**/*.{tsx,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

For blocking alerts and errors in UI, do not use toast notifications; use alerts instead

Files:

  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/products/page-client-catalogs-view.tsx
  • apps/dashboard/src/components/code-block.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Prefer ES6 Map over Record when representing key–value collections

Files:

  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/products/page-client-catalogs-view.tsx
  • apps/dashboard/src/components/code-block.tsx
{apps/dashboard,apps/dev-launchpad,packages/stack-ui,packages/react}/**/*.{tsx,jsx,css}

📄 CodeRabbit inference engine (AGENTS.md)

Keep hover/click animations snappy; avoid pre-transition delays on hover and apply transitions after the action (e.g., fade-out on hover end)

Files:

  • apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/products/page-client-catalogs-view.tsx
  • apps/dashboard/src/components/code-block.tsx
🧬 Code graph analysis (2)
apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/products/page-client-catalogs-view.tsx (2)
packages/stack-ui/src/components/ui/input.tsx (1)
  • Input (10-41)
docs/src/components/icons.tsx (1)
  • ChevronsUpDown (88-91)
apps/dashboard/src/components/code-block.tsx (1)
packages/stack-ui/src/components/simple-tooltip.tsx (1)
  • SimpleTooltip (5-46)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub 8000 Check: Vercel Agent Review
  • GitHub Check: docker
  • GitHub Check: lint_and_build (latest)
  • GitHub Check: restart-dev-and-test
  • GitHub Check: docker
  • GitHub Check: all-good
  • GitHub Check: build (22.x)
  • GitHub Check: build (22.x)
  • GitHub Check: setup-tests
  • GitHub Check: Security Check
🔇 Additional comments (5)
apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/payments/products/page-client-catalogs-view.tsx (3)

421-437: LGTM!

The EXPIRES_OPTIONS constant is well-structured with clear labels and descriptions that will help users understand the expiry behavior.


500-577: Improved UI layout organization.

The refactored two-row layout with dedicated space for the item selector, quantity controls, and action buttons improves visual hierarchy and spacing. The grouping of related controls (quantity + remove) is intuitive.


675-675: LGTM!

The tooltip additions provide helpful contextual information for the code blocks, correctly using the new tooltip prop from the updated CodeBlock API.

Also applies to: 1081-1081

apps/dashboard/src/components/code-block.tsx (2)

4-4: LGTM!

The introduction of the CodeBlockProps type with explicit property definitions improves type safety and API clarity. The simplified ReactNode import and optional tooltip property are well-designed additions.

Also applies to: 12-12, 19-28


52-57: LGTM!

The header layout cleanly integrates the optional tooltip alongside the existing CopyButton. The conditional rendering with SimpleTooltip type="info" provides a consistent user experience when tooltips are present.

@BilalG1 BilalG1 requested a review from N2D4 October 8, 2025 17:05
@BilalG1 BilalG1 assigned N2D4 and unassigned BilalG1 Oct 8, 2025
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.

2 participants
0