Skip to content

Conversation

@msynk
Copy link
Member

@msynk msynk commented Nov 18, 2025

closes #11667

Summary by CodeRabbit

  • New Features

    • Enhanced AI Chat Panel with improved styling customization options and expanded theme color variables supporting dark/light and hover/active states.
    • Added environment-based layout controls for better panel positioning.
  • Refactor

    • Reorganized AI Chat Panel internal structure for improved layout management and event handling to prevent unintended panel closures during interaction.

@coderabbitai
Copy link

coderabbitai bot commented Nov 18, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Multiple AppAiChatPanel components across projects are refactored to add container styling via a new Classes parameter and prevent pointer event propagation. Simultaneously, SCSS theming variables are significantly expanded with color variants (dark/light, hover/active states) and environment layout tokens across foreground, background, and border color families.

Changes

Cohort / File(s) Summary
Razor Component Refactoring
src/BlazorUI/Demo/Client/.../Shared/AppAiChatPanel.razor
src/Templates/Boilerplate/.../Components/Layout/AppAiChatPanel.razor
src/Websites/Platform/.../Shared/AppAiChatPanel.razor
Updated BitProPanel component usage to bind container CSS class via Classes="@(new() { Container = "panel-cnt" })". Added onpointerdown="event.stopPropagation()" event handler on chat body BitStack to prevent pointer drag propagation. Restructured markup layout and adjusted button styling.
Panel Container Styling
src/BlazorUI/Demo/Client/.../Shared/AppAiChatPanel.razor.scss
src/Websites/Platform/.../Shared/AppAiChatPanel.razor.scss
Introduced .panel-cnt CSS class setting top, bottom, and height properties using environment-related SCSS variables ($bit-env-inset-top, $bit-env-inset-bottom, $bit-env-height-available).
Theming & Layout Tokens
src/BlazorUI/Demo/Client/.../Styles/abstracts/_bit-css-variables.scss
src/Templates/Boilerplate/.../Styles/abstracts/_bit-css-variables.scss
src/Websites/Platform/.../Styles/abstracts/_bit-css-variables.scss
Expanded public SCSS variable declarations: added dark/light color variants for foreground, background, and border (primary, secondary, tertiary) with hover/active states. Fixed $bit-color-foreground-secondary-active mapping. Introduced new shadow ($bit-box-shadow-callout2) and environment layout tokens (inset, dimension, viewport).

Sequence Diagram

sequenceDiagram
    actor User
    participant Panel as BitProPanel
    participant Body as Chat Body (BitStack)
    participant Outer as Outer Context

    User->>User: Click/Drag on chat body
    User->>Body: onpointerdown event
    Body->>Body: event.stopPropagation()
    Body-->>Outer: ✗ Event propagation blocked
    Panel->>Panel: Panel remains open (no drag/close)

    Note over User,Body: Disabled Drag Feature: Pointer events<br/>no longer bubble to trigger panel dismiss
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Event handling logic: Verify that stopPropagation() correctly prevents unintended panel dismissal without breaking other interactions.
  • SCSS variables scope: Review the extensive new variable declarations across multiple files to ensure naming consistency and proper variable mapping (especially the corrected $bit-color-foreground-secondary-active).
  • Component binding changes: Confirm @bind-IsOpen and Classes parameter usage aligns with BitProPanel's public API across all three AppAiChatPanel instances.
  • Environment token usage: Validate that $bit-env-* variables are consistently defined and applied in .panel-cnt styling rules.

Poem

🐰 A whisker-twitch of polish and design,
The chat panels now stand proud and fine,
No more dragging them around the screen,
CSS variables make colors sheen—
Dark, light, and hover states combine! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR includes significant out-of-scope changes: extensive SCSS variable additions (color variants, typography tokens, environment variables) and styling modifications unrelated to disabling pointer drag. Remove unrelated changes including new SCSS color/typography/environment variables and focus only on adding pointer event handlers and necessary styling classes to disable pointer drag in AiChatPanel components.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and specifically describes the main change: disabling pointer drag functionality for AiChatPanel components across all projects.
Linked Issues check ✅ Passed The PR implements the objective from issue #11667 by adding onpointerdown event handlers with stopPropagation() to prevent pointer drag behavior in multiple AiChatPanel components across different projects.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

@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: 1

🧹 Nitpick comments (2)
src/Websites/Platform/src/Bit.Websites.Platform.Client/Shared/AppAiChatPanel.razor (1)

17-22: Prefer Blazor event modifiers over inline onpointerdown JS

Binding Classes="@(new() { Container = "panel-cnt" })" to match the .panel-cnt styling looks good. For the body stack, instead of inline JS:

<BitStack Class="body" onpointerdown="event.stopPropagation()">

it’s more idiomatic (and CSP-friendly) in Blazor to use an event modifier:

-        <BitStack Class="body" onpointerdown="event.stopPropagation()">
+        <BitStack Class="body" @onpointerdown:stopPropagation="true">

This keeps the same behavior (preventing pointer drag via bubbling) without inline script.

Also applies to: 42-42

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/AppAiChatPanel.razor (1)

41-43: Use event modifier instead of inline onpointerdown JS

The pointer-drag prevention on the body stack is good, but inline JS is avoidable. You can switch to Blazor’s event modifier:

-        <Body>
-            <BitStack Class="body" onpointerdown="event.stopPropagation()">
+        <Body>
+            <BitStack Class="body" @onpointerdown:stopPropagation="true">

Same effect, cleaner and more CSP-friendly.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 3be174e and 5f55bd6.

📒 Files selected for processing (8)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/AppAiChatPanel.razor (1 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/AppAiChatPanel.razor.scss (1 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Styles/abstracts/_bit-css-variables.scss (2 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/AppAiChatPanel.razor (2 hunks)
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Styles/abstracts/_bit-css-variables.scss (1 hunks)
  • src/Websites/Platform/src/Bit.Websites.Platform.Client/Shared/AppAiChatPanel.razor (2 hunks)
  • src/Websites/Platform/src/Bit.Websites.Platform.Client/Shared/AppAiChatPanel.razor.scss (1 hunks)
  • src/Websites/Platform/src/Bit.Websites.Platform.Client/Styles/abstracts/_bit-css-variables.scss (3 hunks)
⏰ 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). (1)
  • GitHub Check: build and test
🔇 Additional comments (14)
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/AppAiChatPanel.razor.scss (1)

28-32: .panel-cnt env-based sizing looks good

The new .panel-cnt rule cleanly ties the panel container to the environment inset/available-height tokens and matches how the component binds Classes.Container = "panel-cnt". No issues from here.

src/Websites/Platform/src/Bit.Websites.Platform.Client/Shared/AppAiChatPanel.razor.scss (1)

28-32: Consistent .panel-cnt styling across projects

This .panel-cnt block mirrors the Demo variant and correctly uses the env inset/available-height tokens for the panel container. Looks consistent and safe.

src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Styles/abstracts/_bit-css-variables.scss (1)

218-220: New callout shadow token is consistent

$bit-box-shadow-callout2 aligns with the existing callout shadow naming and pattern. Just ensure the underlying --bit-shd-cal2 custom property is defined in the theme for all target skins.

src/Websites/Platform/src/Bit.Websites.Platform.Client/Shared/AppAiChatPanel.razor (1)

7-15: Confirm whether Draggable on the floating open button should be removed

Given the PR goal is to disable pointer drag for the AiChatPanel, please double-check whether keeping Draggable on the floating BitButton is intentional. If this is the behavior you want to disable, you can simply drop the flag:

-    <BitButton Float
-               Draggable
+    <BitButton Float
                FloatOffset="1rem"
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/AppAiChatPanel.razor (1)

7-15: Re‑evaluate Draggable on the floating AiChat button

Similar to the Platform and Demo variants, this floating BitButton is still marked Draggable. If the intent is to completely disable pointer drag for the AiChat entry point, you may want to remove it:

-    <BitButton Float
-               Draggable
+    <BitButton Float
                FloatOffset="2rem"

If drag is only meant to be disabled for the panel body (not the launcher), keeping it is fine—but worth confirming.

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Shared/AppAiChatPanel.razor (1)

7-15: Check if Draggable on the floating button aligns with the PR goal

Here too, the floating chat launcher is marked Draggable. If “disable pointer drag” should also apply to this launcher, you can drop the flag:

-    <BitButton Float
-               Draggable
+    <BitButton Float
                FloatOffset="1rem"

Otherwise, if the goal is only to prevent dragging the open panel, leaving it is fine—just worth validating.

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Styles/abstracts/_bit-css-variables.scss (3)

102-107: Consistent color theming expansion across foreground, background, and border tokens.

The addition of dark/light variants with hover/active states provides comprehensive theming coverage. The naming convention is consistent with existing patterns.

Also applies to: 111-116, 120-125, 132-137, 141-146, 150-155, 163-168, 172-177, 181-186


110-110: Correct fix: foreground-secondary-active now maps to correct CSS custom property.

The correction from --bit-clr-fg-sec-hover to --bit-clr-fg-sec-active aligns the variable with its intended semantic purpose.


379-396: Verify abbreviated CSS custom property names match the theme/JS that sets them.

SCSS references use abbreviated env vars (e.g. --bit-env-width-per, --bit-env-width-avl, --bit-env-width-vw, --bit-env-height-per/avl, etc.) while the repo contains JS that sets --bit-env-win-width / --bit-env-win-height (src/BlazorUI/Bit.BlazorUI.Extras/Scripts/general.ts). Confirm the abbreviated names in the SCSS exactly match the CSS custom-property keys emitted by your theme or JS (or update the theme/JS to set the abbreviated keys).
Locations: src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Styles/abstracts/_bit-css-variables.scss and src/BlazorUI/Bit.BlazorUI.Extras/Scripts/general.ts.

src/Websites/Platform/src/Bit.Websites.Platform.Client/Styles/abstracts/_bit-css-variables.scss (5)

102-107: Consistent color theming expansion across foreground, background, and border tokens.

The addition of dark/light variants with hover/active states provides comprehensive theming coverage. The naming convention is consistent with existing patterns.

Also applies to: 111-116, 120-125, 132-137, 141-146, 150-155, 163-168, 172-177, 181-186


110-110: Correct fix: foreground-secondary-active now maps to correct CSS custom property.

The correction from --bit-clr-fg-sec-hover to --bit-clr-fg-sec-active aligns the variable with its intended semantic purpose.


220-220: New shadow variable added.

$bit-box-shadow-callout2 is appropriately added alongside the existing callout shadow. Verify this CSS custom property is defined in the theme system.


248-396: Comprehensive typography and environment token coverage added to Platform file.

These variables (typography h1–overline, spacing, z-index, shape, and environment tokens) are included in this file but are absent from the BlazorUI Demo file (src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Styles/abstracts/_bit-css-variables.scss). Clarify whether this is intentional (Platform-specific scope) or if both files should maintain parity.


379-396: Verified abbreviated CSS custom property names match repository definitions.

  • Definitions: src/BlazorUI/Bit.BlazorUI.Extras/Styles/extra-general.scss — defines --bit-env-width-per, --bit-env-height-per, --bit-env-width-avl, --bit-env-height-avl (and related inset vars).
  • Window size set in script: src/BlazorUI/Bit.BlazorUI.Extras/Scripts/general.ts — sets --bit-env-win-width and --bit-env-win-height.
  • SCSS mappings and usages: src/BlazorUI/Bit.BlazorUI.Extras/Styles/extra-variables.scss and src/Websites/Platform/src/Bit.Websites.Platform.Client/Styles/abstracts/_bit-css-variables.scss (also present in Templates/Boilerplate and Demo copies) reference var(--bit-env-*) exactly.

@msynk msynk merged commit d41e294 into bitfoundation:develop Nov 18, 2025
3 checks passed
@msynk msynk deleted the 11667-infra-aichatpanel-disable-pointer-drag branch November 18, 2025 11:25
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.

The pointer drag feature of the AiChatPanels should be disabled throughout all projects

1 participant