Skip to content

XS-13706 | XS-13744 [Merch Improvement]: Add Tax section on Pricing & Availability page - #414

Open
KarthickXola wants to merge 7 commits into
xola:masterfrom
KarthickXola:XS-13706
Open

KarthickXola wants to merge 7 commits into
xola:masterfrom
KarthickXola:XS-13706

Conversation

@KarthickXola

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings March 16, 2026 13:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Replaces a plain <div> with <Dialog.Panel> from Headless UI in the Drawer component. This scopes the click-outside-to-close behavior properly to the panel content.

Changes:

  • Swap inner <div> for <Dialog.Panel> in the Drawer component for correct Headless UI dialog semantics

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/Drawer.jsx
{position === "right" ? <CloseButton onClose={onClose} /> : null}

<div
<Dialog.Panel
@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown

Review Change Stack

Summary

  • Added a temporary interaction guard for drawer close events.
  • Switched the drawer panel to Dialog.Panel.
  • Added mouse and touch capture handlers.
  • Added the testUIKIT1 marker.
  • Changed the default drawer position from right to left.
  • Removed the title wrapper.
  • useRef is used but not imported.

Walkthrough

Drawer now guards close events after panel interaction, uses Dialog.Panel, updates close-button handling, adds a testUIKIT1 marker, removes the title wrapper, and defaults its position to left.

Changes

Drawer interaction handling

Layer / File(s) Summary
Guard close events
src/components/Drawer.jsx
The drawer temporarily ignores the next close event after panel mouse or touch interaction. Dialog and close-button handlers use the guarded callback.
Wire the panel and default position
src/components/Drawer.jsx
The content container now uses Dialog.Panel with capture handlers. The title wrapper was removed, testUIKIT1 was added, and the default position changed from right to left.

Merge Risk: 🔴 Critical · up to 6fd8d

The Drawer can currently fail to render because useRef is not imported; even when it renders, titles are missing and close controls do not dismiss the drawer. These are release-blocking correctness regressions that should be fixed before merging, alongside smaller debug-output and formatting cleanup.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


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

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


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5f4330e5-4642-4b69-aa4e-00a85e285ebe

📥 Commits

Reviewing files that changed from the base of the PR and between 0670087 and 6fd8d48.

📒 Files selected for processing (1)
  • src/components/Drawer.jsx
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • xola/x2-seller (manual)

Included review availability: 0 reviews are currently available. Based on recent review activity, included reviews refill at 5 per hour.

Comment thread src/components/Drawer.jsx
Comment on lines +35 to +36
const shouldIgnoreCloseRef = useRef(false);
const resetCloseGuardTimeoutRef = useRef(null);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
rg -n -C 2 'useRef|from .*react' src/components/Drawer.jsx

Repository: xola/ui-kit

Length of output: 667


🏁 Script executed:

#!/bin/bash
set -euo pipefail
sed -n '1,90p' src/components/Drawer.jsx
printf '\nReact import and useRef occurrences:\n'
rg -n '^(import .*react|.*useRef)' src/components/Drawer.jsx
printf '\nPackage/lint context:\n'
rg -n '"(react|eslint|eslint-plugin-react-hooks)"|react-hooks|no-undef' package.json .eslintrc* 2>/dev/null || true

Repository: xola/ui-kit

Length of output: 4245


🏁 Script executed:

#!/bin/bash
set -euo pipefail
python3 - <<'PY'
from pathlib import Path
import re

path = Path("src/components/Drawer.jsx")
source = path.read_text()
imports = re.findall(r'import\s+([^;]+?)\s+from\s+["\']react["\']', source)
uses_ref = bool(re.search(r'\buseRef\s*\(', source))
has_ref_binding = any(re.search(r'\buseRef\b', item) for item in imports)
print({
    "uses_useRef": uses_ref,
    "react_imports": imports,
    "useRef_bound_by_react_import": has_ref_binding,
    "unbound_useRef": uses_ref and not has_ref_binding,
})
PY

Repository: xola/ui-kit

Length of output: 288


Import useRef from React. Drawer calls useRef, but the React import does not bind it. Every render throws ReferenceError: useRef is not defined.

🧰 Tools
🪛 GitHub Check: View Lint Report

[failure] 35-35: src/components/Drawer.jsx#L35
[prettier/prettier] Delete ·


[failure] 35-35: src/components/Drawer.jsx#L35
[no-undef] 'useRef' is not defined.


[failure] 36-36: src/components/Drawer.jsx#L36
[prettier/prettier] Delete ·


[failure] 36-36: src/components/Drawer.jsx#L36
[no-undef] 'useRef' is not defined.

Source: Linters/SAST tools

Comment thread src/components/Drawer.jsx
Comment on lines +35 to +54
const shouldIgnoreCloseRef = useRef(false);
const resetCloseGuardTimeoutRef = useRef(null);

const handleContentInteraction = () => {
shouldIgnoreCloseRef.current = true;
if (resetCloseGuardTimeoutRef.current) {
window.clearTimeout(resetCloseGuardTimeoutRef.current);
}
resetCloseGuardTimeoutRef.current = window.setTimeout(() => {
shouldIgnoreCloseRef.current = false;
}, 0);
};

const handleClose = () => {
if (shouldIgnoreCloseRef.current) {
shouldIgnoreCloseRef.current = false;
return;
}
onClose();
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Remove the whitespace that fails Prettier.

Prettier reports trailing whitespace in Lines 35-54 and whitespace-only content before the panel content on Lines 111-112. Remove the extra spaces.

Also applies to: 111-112

🧰 Tools
🪛 GitHub Check: View Lint Report

[failure] 35-35: src/components/Drawer.jsx#L35
[prettier/prettier] Delete ·


[failure] 35-35: src/components/Drawer.jsx#L35
[no-undef] 'useRef' is not defined.


[failure] 36-36: src/components/Drawer.jsx#L36
[prettier/prettier] Delete ·


[failure] 36-36: src/components/Drawer.jsx#L36
[no-undef] 'useRef' is not defined.


[failure] 38-38: src/components/Drawer.jsx#L38
[prettier/prettier] Delete ·


[failure] 39-39: src/components/Drawer.jsx#L39
[prettier/prettier] Delete ·


[failure] 40-40: src/components/Drawer.jsx#L40
[prettier/prettier] Delete ·


[failure] 41-41: src/components/Drawer.jsx#L41
[prettier/prettier] Delete ·


[failure] 42-42: src/components/Drawer.jsx#L42
[prettier/prettier] Delete ·


[failure] 43-43: src/components/Drawer.jsx#L43
[prettier/prettier] Delete ·


[failure] 44-44: src/components/Drawer.jsx#L44
[prettier/prettier] Delete ·


[failure] 45-45: src/components/Drawer.jsx#L45
[prettier/prettier] Delete ·


[failure] 46-46: src/components/Drawer.jsx#L46
[prettier/prettier] Delete ·


[failure] 48-48: src/components/Drawer.jsx#L48
[prettier/prettier] Delete ·


[failure] 49-49: src/components/Drawer.jsx#L49
[prettier/prettier] Delete ·


[failure] 50-50: src/components/Drawer.jsx#L50
[prettier/prettier] Delete ·


[failure] 51-51: src/components/Drawer.jsx#L51
[prettier/prettier] Delete ·


[failure] 52-52: src/components/Drawer.jsx#L52
[prettier/prettier] Delete ·


[failure] 53-53: src/components/Drawer.jsx#L53
[prettier/prettier] Delete ·


[failure] 54-54: src/components/Drawer.jsx#L54
[prettier/prettier] Delete ·

Source: Linters/SAST tools

Comment thread src/components/Drawer.jsx
Comment on lines +48 to +54
const handleClose = () => {
if (shouldIgnoreCloseRef.current) {
shouldIgnoreCloseRef.current = false;
return;
}
onClose();
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- Drawer.jsx ---'
cat -n src/components/Drawer.jsx

printf '%s\n' '--- Sidebar consumers ---'
rg -n -A12 -B8 'onClose|Drawer|CloseButton' src/components/Sidebar src/components 2>/dev/null | head -n 240

printf '%s\n' '--- close-button definitions/usages ---'
rg -n -A10 -B8 'CloseButton' src

printf '%s\n' '--- relevant dependency versions ---'
rg -n '"`@headlessui/react`"|"react"|"ahooks"' package.json yarn.lock package-lock.json pnpm-lock.yaml 2>/dev/null | head -n 80

printf '%s\n' '--- Drawer stories ---'
rg -n -A12 -B5 'Drawer' src/stories src 2>/dev/null | head -n 180

Repository: xola/ui-kit

Length of output: 49425


🏁 Script executed:

#!/bin/bash
set -eu

cat -n src/components/Drawer.jsx
printf '\n--- Sidebar close consumers ---\n'
rg -n -A12 -B8 'onClose|Drawer|CloseButton' src/components/Sidebar src/components 2>/dev/null | head -n 240
printf '\n--- CloseButton definitions/usages ---\n'
rg -n -A10 -B8 'CloseButton' src
printf '\n--- dependency versions ---\n'
rg -n '"`@headlessui/react`"|"react"|"ahooks"' package.json yarn.lock package-lock.json pnpm-lock.yaml 2>/dev/null | head -n 80
printf '\n--- Drawer stories ---\n'
rg -n -A12 -B5 'Drawer' src/stories src 2>/dev/null | head -n 180

Repository: xola/ui-kit

Length of output: 49753


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- Button implementation ---'
fd -t f -i 'Button*.jsx' src/components | xargs -r -n1 sh -c 'echo "--- $0"; cat -n "$0"' | head -n 260

printf '%s\n' '--- exact onClick forwarding ---'
rg -n -A18 -B12 'onClick' src/components/Buttons src/components/Button* 2>/dev/null | head -n 220

printf '%s\n' '--- standalone callback-contract check ---'
python3 - <<'PY'
from pathlib import Path
drawer = Path("src/components/Drawer.jsx").read_text()
sidebar = Path("src/components/Sidebar/Sidebar.jsx").read_text()

checks = {
    "CloseButton receives handleClose": "<CloseButton onClose={handleClose} />" in drawer,
    "CloseButton passes onClick to Button": "onClick={onClose}" in drawer,
    "handleClose has no parameter": "const handleClose = () =>" in drawer,
    "handleClose calls onClose without argument": "onClose();" in drawer,
    "Sidebar requires truthy close argument": "onClose={(e) => !!e && handleDrawerStateChange" in sidebar,
}
for name, result in checks.items():
    print(f"{name}: {result}")
PY

Repository: xola/ui-kit

Length of output: 16509


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- Button implementation ---'
fd -t f -i 'Button*.jsx' src/components | xargs -r -n1 sh -c 'echo "--- $0"; cat -n "$0"' | head -n 260

printf '%s\n' '--- exact onClick forwarding ---'
rg -n -A18 -B12 'onClick' src/components/Buttons src/components/Button* 2>/dev/null | head -n 220

printf '%s\n' '--- callback-contract check ---'
python3 - <<'PY'
from pathlib import Path
drawer = Path("src/components/Drawer.jsx").read_text()
sidebar = Path("src/components/Sidebar/Sidebar.jsx").read_text()

checks = {
    "CloseButton receives handleClose": "<CloseButton onClose={handleClose} />" in drawer,
    "CloseButton passes onClick to Button": "onClick={onClose}" in drawer,
    "handleClose has no parameter": "const handleClose = () =>" in drawer,
    "handleClose calls onClose without argument": "onClose();" in drawer,
    "Sidebar requires truthy close argument": "onClose={(e) => !!e && handleDrawerStateChange" in sidebar,
}
for name, result in checks.items():
    print(f"{name}: {result}")
PY

Repository: xola/ui-kit

Length of output: 16498


Forward the close callback argument.

Button forwards the click event to handleClose, but handleClose calls onClose() without it. Sidebar ignores falsy close arguments, so both drawer close buttons do nothing.

-const handleClose = () => {
+const handleClose = (closeArgument) => {
...
-    onClose();
+    onClose(closeArgument);
📝 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
const handleClose = () => {
if (shouldIgnoreCloseRef.current) {
shouldIgnoreCloseRef.current = false;
return;
}
onClose();
};
const handleClose = (closeArgument) => {
if (shouldIgnoreCloseRef.current) {
shouldIgnoreCloseRef.current = false;
return;
}
onClose(closeArgument);
};
🧰 Tools
🪛 GitHub Check: View Lint Report

[failure] 48-48: src/components/Drawer.jsx#L48
[prettier/prettier] Delete ·


[failure] 49-49: src/components/Drawer.jsx#L49
[prettier/prettier] Delete ·


[failure] 50-50: src/components/Drawer.jsx#L50
[prettier/prettier] Delete ·


[failure] 51-51: src/components/Drawer.jsx#L51
[prettier/prettier] Delete ·


[failure] 52-52: src/components/Drawer.jsx#L52
[prettier/prettier] Delete ·


[failure] 53-53: src/components/Drawer.jsx#L53
[prettier/prettier] Delete ·


[failure] 54-54: src/components/Drawer.jsx#L54
[prettier/prettier] Delete ·

Comment thread src/components/Drawer.jsx
}
onClose();
};
console.log("Drawer rendered with isOpen:", isOpen, "position:", position, "sideIndent:", sideIndent);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the render-time debug log.

console.log runs on every render and pollutes production output. Remove it before merge.

Comment thread src/components/Drawer.jsx
Comment on lines +102 to +119
{position === "right" ? <CloseButton onClose={handleClose} /> : null}
<Dialog.Panel
className={clsx(
"flex h-full w-full flex-col overflow-y-auto bg-white px-4 py-8 shadow-xl sm:px-6",
sizes[size],
classNames.children,
)}
onMouseDownCapture={handleContentInteraction}
onTouchStartCapture={handleContentInteraction}
>
<div className="w-full">
{/* eslint-disable-next-line react/jsx-max-depth */}
<Dialog.Title>{title}</Dialog.Title>
</div>

<div className={clsx("relative mt-3 flex-1", classNames.content)}>
{"testUIKIT1"}
{content}
</div>
</div>
</Dialog.Panel>

{position === "left" ? <CloseButton onClose={onClose} /> : null}
{position === "left" ? <CloseButton onClose={handleClose} /> : null}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
rg -n -C 3 '\bDrawer\b' src/stories

Repository: xola/ui-kit

Length of output: 3079


🏁 Script executed:

#!/bin/bash
set -euo pipefail
printf '%s\n' '--- Drawer story ---'
cat -n src/stories/Overlay/Drawer.stories.jsx
printf '%s\n' '--- Drawer component ---'
cat -n src/components/Drawer.jsx
printf '%s\n' '--- Story history/status ---'
git status --short
git diff --stat

Repository: xola/ui-kit

Length of output: 10141


Add Drawer Storybook coverage for all close paths.

Update src/stories/Overlay/Drawer.stories.jsx to cover panel interaction, both close-button positions, and the left default. Do not add a rendered Jest test.

🧰 Tools
🪛 GitHub Check: View Lint Report

[failure] 111-112: src/components/Drawer.jsx#L111-L112
[prettier/prettier] Delete ⏎······································


[failure] 114-114: src/components/Drawer.jsx#L114
[react/jsx-curly-brace-presence] Curly braces are unnecessary here.

Source: Coding guidelines

Comment thread src/components/Drawer.jsx
Comment on lines 113 to 116
<div className={clsx("relative mt-3 flex-1", classNames.content)}>
{"testUIKIT1"}
{content}
</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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Restore the title in the rendered panel.

title remains a public prop, and src/components/Sidebar/Sidebar.jsx passes title={leftDrawer.title} and title={rightDrawer.title}. The new content block renders only the marker and content, so both drawer titles disappear. Render title again before content.

🧰 Tools
🪛 GitHub Check: View Lint Report

[failure] 114-114: src/components/Drawer.jsx#L114
[react/jsx-curly-brace-presence] Curly braces are unnecessary here.

Comment thread src/components/Drawer.jsx
</div>

<div className={clsx("relative mt-3 flex-1", classNames.content)}>
{"testUIKIT1"}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Do not render testUIKIT1 as user-facing text.

If testUIKIT1 is a test hook, attach it to a data-testid attribute. Otherwise, remove it. The current JSX inserts the literal marker into every Drawer and triggers react/jsx-curly-brace-presence.

🧰 Tools
🪛 GitHub Check: View Lint Report

[failure] 114-114: src/components/Drawer.jsx#L114
[react/jsx-curly-brace-presence] Curly braces are unnecessary here.

Source: Linters/SAST tools

This branch has not been deployed

No deployments
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.

3 participants