Skip to content

H3126 | Case : Call button in the Chat Widget#413

Open
dvCodeWorld wants to merge 4 commits into
testfrom
H3126-test
Open

H3126 | Case : Call button in the Chat Widget#413
dvCodeWorld wants to merge 4 commits into
testfrom
H3126-test

Conversation

@dvCodeWorld

@dvCodeWorld dvCodeWorld commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

https://app.clickup.com/t/3687137/86d2nhwjn

Summary by CodeRabbit

  • New Features

    • Added a quick actions menu for the chatbot interface with minimize, fullscreen, new conversation, and close options
    • Enhanced chatbot header with improved fullscreen and minimize toggle behavior
  • Bug Fixes

    • Corrected z-index stacking for UI elements to improve visibility and layering
  • Chores

    • Updated development server configuration

@windsurf-bot

windsurf-bot Bot commented Jun 20, 2026

Copy link
Copy Markdown

PR review rate limit exceeded

@netlify

netlify Bot commented Jun 20, 2026

Copy link
Copy Markdown

Deploy Preview for msg91-chat-widget failed.

Name Link
🔨 Latest commit 9820f98
🔍 Latest deploy log https://app.netlify.com/projects/msg91-chat-widget/deploys/6a3940aeedf25d000831e908

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d7f7e01f-69d3-4d13-ab88-ef94d3536c09

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

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

A new QuickActionsMenu dropdown component is introduced and integrated into both ChatbotDrawer and ChatbotHeader, replacing individual fullscreen/close/minimize/new-chat buttons with a unified menu. ChatbotDrawer gains fullscreen postMessage coordination and Redux-backed minimize dispatch. Two z-index values are reduced, and the dev server is pinned to port 3001.

Changes

QuickActionsMenu Feature Integration

Layer / File(s) Summary
QuickActionsMenu component contract and implementation
components/Interface-Chatbot/QuickActionsMenu.tsx
Defines QuickActionsMenuProps interface with controlled open state, per-action visibility flags, callbacks, and position prop; implements controlled/uncontrolled open logic, outside-click detection via menuRef, memoized trigger button, and conditional rendering of minimize, fullscreen, new conversation, and close menu items.
ChatbotDrawer Redux state, fullscreen/minimize logic, and header wiring
components/Interface-Chatbot/ChatbotDrawer.tsx
Expands Redux selector to include show_msg91, isChatbotMinimized, isMobileSDK, and isFullScreen; adds local fullScreen state and toggleFullScreen that postMessage ENTER_FULL_SCREEN_CHATBOT/EXIT_FULL_SCREEN_CHATBOT; updates handleToggleMinimize to dispatch setDataInDraftReducer and emit MINIMIZE_CHATBOT; replaces conditional New Chat/CloseButton area with DrawerQuickActionsMenu.
ChatbotHeader ExpandButton and QuickActionsMenu wiring
components/Interface-Chatbot/ChatbotHeader.tsx
Adds ExpandButton visible only in minimized state; computes available action flags from existing memoized buttons and state; creates memoized QuickActionsMenuComponent; replaces inline expanded-header action area with conditional QuickActionsMenuComponent render.
Z-index reductions
components/FormComponent.tsx, components/Interface-Chatbot/InterfaceChatbot.css
Reduces collapsed trigger z-index from z-[9999] to z-[9] and .move-to-down-button z-index from 999999 !important to 99 !important.

Dev Server Port Config

Layer / File(s) Summary
Dev server port flag
package.json
Adds -p 3001 to the next dev --turbopack dev script.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant QuickActionsMenu
  participant ChatbotDrawer
  participant Redux
  participant ParentWindow

  rect rgba(100, 149, 237, 0.5)
    note over User,QuickActionsMenu: Minimize flow
    User->>QuickActionsMenu: click Minimize
    QuickActionsMenu->>ChatbotDrawer: onMinimize callback
    ChatbotDrawer->>ChatbotDrawer: toggleFullScreen(false) if fullScreen active
    ChatbotDrawer->>ParentWindow: postMessage(EXIT_FULL_SCREEN_CHATBOT)
    ChatbotDrawer->>Redux: dispatch setDataInDraftReducer({isChatbotMinimized: true})
    ChatbotDrawer->>ParentWindow: emitEventToParent(MINIMIZE_CHATBOT)
  end

  rect rgba(144, 238, 144, 0.5)
    note over User,ParentWindow: Fullscreen flow
    User->>QuickActionsMenu: click Enter Fullscreen
    QuickActionsMenu->>ChatbotDrawer: onToggleFullScreen callback
    ChatbotDrawer->>ParentWindow: postMessage(ENTER_FULL_SCREEN_CHATBOT)
    ChatbotDrawer->>ChatbotDrawer: setFullScreen(true)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐇 A menu sprouts where buttons once roamed,
Minimize, fullscreen — all neatly homed.
The z-index shrinks, no more sky-high stack,
A drawer dispatches and posts a message back.
Tap the three dots, the chatbot obeys —
One tidy dropdown to end the old ways! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions 'Call button' but the changes primarily focus on implementing a QuickActionsMenu component and refactoring header controls with z-index adjustments, not specifically on a call button. Update the title to reflect the main changes: refactoring chatbot header controls with QuickActionsMenu component and adjusting z-index layering, or provide more details if the call button is a specific menu action within the QuickActionsMenu.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch H3126-test

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.

@dvCodeWorld

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@dvCodeWorld

Copy link
Copy Markdown
Collaborator Author

/windsurf-review

@windsurf-bot

windsurf-bot Bot commented Jun 20, 2026

Copy link
Copy Markdown

PR review rate limit exceeded

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@components/Interface-Chatbot/ChatbotDrawer.tsx`:
- Around line 418-423: The local fullScreen state is initialized to false and
never synced with isFullScreen, creating two separate sources of truth for
fullscreen state. Initialize the fullScreen state with the value from
isFullScreen, and add a useEffect hook that updates the local fullScreen state
whenever the isFullScreen prop/value changes. This will ensure the local state
stays synchronized with isFullScreen and prevent inconsistent menu behavior in
the toggleFullScreen function.

In `@components/Interface-Chatbot/ChatbotHeader.tsx`:
- Around line 617-622: The Expand control is currently implemented as a
non-semantic `<div>` element, which is not keyboard-accessible. Replace the
`<div>` containing the onClick handler for `handleToggleMinimize()` with a
semantic `<button>` element. Move all the existing className styling
(cursor-pointer, p-2, rounded-full, hover:bg-gray-200, transition-colors, icn)
and onClick event handler to the new button element, and keep the Maximize2 icon
as a child of the button. This will make the control properly
keyboard-accessible and screen-reader friendly.
- Around line 626-651: The fullscreen action availability is determined using
isFullScreen in the hasFullScreenAction and hasExitFullScreenAction variables,
but the QuickActionsMenu component receives fullScreen state in its
onToggleFullScreen callback, creating a mismatch. Replace the isFullScreen
references in hasFullScreenAction and hasExitFullScreenAction with fullScreen to
ensure the availability logic is consistent with the state that QuickActionsMenu
component actually uses for displaying the correct action.

In `@components/Interface-Chatbot/QuickActionsMenu.tsx`:
- Around line 100-104: The quick-action buttons in the QuickActionsMenu
component have tabIndex={-1} set, which prevents keyboard users from navigating
and selecting menu actions. Remove the tabIndex={-1} attribute from all
quick-action button elements (referenced at lines 114-116, 128-130, 142-144,
154-156) to make them keyboard reachable. The menu container itself may keep its
tabIndex attributes, but individual action buttons should allow normal tab
navigation by removing the negative tabIndex value.

In `@package.json`:
- Line 6: The dev script in package.json now specifies port 3001, but the README
documentation still references http://localhost:3000, which will cause confusion
for users running the project locally. Update all occurrences of
http://localhost:3000 in the README to http://localhost:3001 to align with the
new dev port configuration defined in the dev script.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8d48695f-9797-4f36-9b1c-2fefdd288bff

📥 Commits

Reviewing files that changed from the base of the PR and between 9e36703 and f299f37.

📒 Files selected for processing (6)
  • components/FormComponent.tsx
  • components/Interface-Chatbot/ChatbotDrawer.tsx
  • components/Interface-Chatbot/ChatbotHeader.tsx
  • components/Interface-Chatbot/InterfaceChatbot.css
  • components/Interface-Chatbot/QuickActionsMenu.tsx
  • package.json

Comment on lines +418 to +423
const [fullScreen, setFullScreen] = useState(false);

const toggleFullScreen = (enter: boolean) => {
if (!window?.parent) return;
setFullScreen(enter);
const message = enter

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fullscreen has two unsynced sources of truth.

isFullScreen controls availability, while local fullScreen controls icon/label/action. Since local state starts at false and isn’t synced, menu behavior can become inconsistent.

Suggested fix
-  const [fullScreen, setFullScreen] = useState(false);
+  const [fullScreen, setFullScreen] = useState(isFullScreen);
+
+  useEffect(() => {
+    setFullScreen(isFullScreen);
+  }, [isFullScreen]);
@@
-  const canFullScreen = !isMobileSDK && !isFullScreen;
+  const canFullScreen = !isMobileSDK;

Also applies to: 443-457

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/Interface-Chatbot/ChatbotDrawer.tsx` around lines 418 - 423, The
local fullScreen state is initialized to false and never synced with
isFullScreen, creating two separate sources of truth for fullscreen state.
Initialize the fullScreen state with the value from isFullScreen, and add a
useEffect hook that updates the local fullScreen state whenever the isFullScreen
prop/value changes. This will ensure the local state stays synchronized with
isFullScreen and prevent inconsistent menu behavior in the toggleFullScreen
function.

Comment on lines +617 to +622
<div
className="cursor-pointer p-2 rounded-full hover:bg-gray-200 transition-colors icn"
onClick={(e) => { e.stopPropagation(); handleToggleMinimize(); }}
>
<Maximize2 size={22} style={{ transform: 'rotate(90deg)' }} />
</div>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use a semantic button for the new Expand control.

ExpandButton is a clickable <div>, which is not keyboard-accessible by default.

Suggested fix
-      <div
+      <button
+        type="button"
         className="cursor-pointer p-2 rounded-full hover:bg-gray-200 transition-colors icn"
         onClick={(e) => { e.stopPropagation(); handleToggleMinimize(); }}
       >
         <Maximize2 size={22} style={{ transform: 'rotate(90deg)' }} />
-      </div>
+      </button>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div
className="cursor-pointer p-2 rounded-full hover:bg-gray-200 transition-colors icn"
onClick={(e) => { e.stopPropagation(); handleToggleMinimize(); }}
>
<Maximize2 size={22} style={{ transform: 'rotate(90deg)' }} />
</div>
<button
type="button"
className="cursor-pointer p-2 rounded-full hover:bg-gray-200 transition-colors icn"
onClick={(e) => { e.stopPropagation(); handleToggleMinimize(); }}
>
<Maximize2 size={22} style={{ transform: 'rotate(90deg)' }} />
</button>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/Interface-Chatbot/ChatbotHeader.tsx` around lines 617 - 622, The
Expand control is currently implemented as a non-semantic `<div>` element, which
is not keyboard-accessible. Replace the `<div>` containing the onClick handler
for `handleToggleMinimize()` with a semantic `<button>` element. Move all the
existing className styling (cursor-pointer, p-2, rounded-full,
hover:bg-gray-200, transition-colors, icn) and onClick event handler to the new
button element, and keep the Maximize2 icon as a child of the button. This will
make the control properly keyboard-accessible and screen-reader friendly.

Comment on lines +626 to +651
// Determine which quick-action items are available
const hasMinimizeAction = !!MinimizeButton;
const hasFullScreenAction = !!ScreenSizeToggleButton && !isFullScreen;
const hasExitFullScreenAction = !!ScreenSizeToggleButton && isFullScreen;
const hasCloseAction = !!CloseButton;
const hasNewConversationAction = !!CreateThreadButton;

const showQuickActions = (
hasMinimizeAction ||
hasFullScreenAction ||
hasExitFullScreenAction ||
hasCloseAction ||
hasNewConversationAction
);

const QuickActionsMenuComponent = useMemo(() => (
<QuickActionsMenu
isChatbotMinimized={isChatbotMinimized}
fullScreen={fullScreen}
showMinimize={hasMinimizeAction}
showFullScreen={hasFullScreenAction || hasExitFullScreenAction}
showNewConversation={hasNewConversationAction}
showClose={hasCloseAction}
onMinimize={handleToggleMinimize}
onToggleFullScreen={() => toggleFullScreen(!fullScreen)}
onNewConversation={handleCreateNewSubThread}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Quick-actions fullscreen logic can show the wrong action state.

Availability is computed from isFullScreen, but menu label/behavior uses local fullScreen. If those differ, users get incorrect “Expand/Exit full screen” behavior.

Suggested fix
-  const hasFullScreenAction = !!ScreenSizeToggleButton && !isFullScreen;
-  const hasExitFullScreenAction = !!ScreenSizeToggleButton && isFullScreen;
+  const hasFullScreenAction = !!ScreenSizeToggleButton;
+  const hasExitFullScreenAction = false; // no longer needed separately
@@
-      showFullScreen={hasFullScreenAction || hasExitFullScreenAction}
+      showFullScreen={hasFullScreenAction}
-  const [fullScreen, setFullScreen] = useState(false);
+  const [fullScreen, setFullScreen] = useState(isFullScreen);
+  useEffect(() => setFullScreen(isFullScreen), [isFullScreen]);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/Interface-Chatbot/ChatbotHeader.tsx` around lines 626 - 651, The
fullscreen action availability is determined using isFullScreen in the
hasFullScreenAction and hasExitFullScreenAction variables, but the
QuickActionsMenu component receives fullScreen state in its onToggleFullScreen
callback, creating a mismatch. Replace the isFullScreen references in
hasFullScreenAction and hasExitFullScreenAction with fullScreen to ensure the
availability logic is consistent with the state that QuickActionsMenu component
actually uses for displaying the correct action.

Comment on lines +100 to +104
{open && (
<div
role="menu"
aria-orientation="vertical"
tabIndex={-1}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Menu items are not keyboard reachable.

All quick-action buttons are rendered with tabIndex={-1}, so keyboard users can’t navigate/select actions after opening the menu.

Suggested fix
-        <div
-          role="menu"
-          aria-orientation="vertical"
-          tabIndex={-1}
+        <div
+          role="menu"
+          aria-orientation="vertical"
           className={
@@
-              role="menuitem"
-              tabIndex={-1}
+              role="menuitem"
+              tabIndex={0}
@@
-              role="menuitem"
-              tabIndex={-1}
+              role="menuitem"
+              tabIndex={0}
@@
-              role="menuitem"
-              tabIndex={-1}
+              role="menuitem"
+              tabIndex={0}
@@
-              role="menuitem"
-              tabIndex={-1}
+              role="menuitem"
+              tabIndex={0}

Also applies to: 114-116, 128-130, 142-144, 154-156

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/Interface-Chatbot/QuickActionsMenu.tsx` around lines 100 - 104,
The quick-action buttons in the QuickActionsMenu component have tabIndex={-1}
set, which prevents keyboard users from navigating and selecting menu actions.
Remove the tabIndex={-1} attribute from all quick-action button elements
(referenced at lines 114-116, 128-130, 142-144, 154-156) to make them keyboard
reachable. The menu container itself may keep its tabIndex attributes, but
individual action buttons should allow normal tab navigation by removing the
negative tabIndex value.

Comment thread package.json
"private": true,
"scripts": {
"dev": "next dev --turbopack",
"dev": "next dev -p 3001 --turbopack",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update README localhost URL to match the new dev port.

Line 6 pins local dev to port 3001, but README still directs users to http://localhost:3000. Please update the README to avoid onboarding/run confusion.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` at line 6, The dev script in package.json now specifies port
3001, but the README documentation still references http://localhost:3000, which
will cause confusion for users running the project locally. Update all
occurrences of http://localhost:3000 in the README to http://localhost:3001 to
align with the new dev port configuration defined in the dev script.

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