added tooltip for the waves/dms collapsed version#1555
Conversation
Signed-off-by: ragnep <ragneinfo@gmail.com>
|
Warning Rate limit exceeded@ragnep has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 3 minutes and 13 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (2)
WalkthroughAdds conditional tooltip support (react-tooltip Tooltip) to two left-sidebar wave components with touch-device detection and conditional data-tooltip-id attachment; removes an obsolete inline comment from WavesMessagesWrapper. No public API changes. Changes
Sequence Diagram(s)sequenceDiagram
participant User as User (hover / touch)
participant Comp as Wave Component
participant Device as useDeviceInfo
participant Tooltip as react-tooltip Tooltip
User->>Comp: hover / focus / tap
Comp->>Device: hasTouchScreen()
alt not touch && condensed
Comp->>Tooltip: render with id, placement, content
Tooltip-->>User: display tooltip (formatted wave name)
else touch OR not condensed
Comp-->>User: no tooltip (default interaction)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
components/brain/left-sidebar/web/WebBrainLeftSidebarWave.tsx (2)
34-45: Consider simplifying the touch detection pattern.The globalScope pattern with type assertions is verbose. Since this is a client-side component, you can simplify the touch detection:
- const globalScope = globalThis as typeof globalThis & { - window?: Window; - navigator?: Navigator; - }; - const browserWindow = globalScope.window; - const browserNavigator = globalScope.navigator; - const isTouchDevice = - !!browserWindow && - ("ontouchstart" in browserWindow || - (browserNavigator?.maxTouchPoints ?? 0) > 0 || - browserWindow.matchMedia?.("(pointer: coarse)")?.matches); + typeof window !== "undefined" && + ("ontouchstart" in window || + (navigator?.maxTouchPoints ?? 0) > 0 || + window.matchMedia?.("(pointer: coarse)")?.matches);
147-167: Consider using TailwindCSS classes instead of inline styles.The inline
styleprop deviates from the coding guidelines that specify using TailwindCSS for styling. Consider using theclassNameprop instead, which react-tooltip supports.Additionally, verify that the
zIndex: 10000value doesn't conflict with other high-z-index elements in your application (e.g., modals, dropdowns, or navigation overlays).As per coding guidelines.
Example refactor using className with Tailwind:
- {showTooltip && ( - <Tooltip - id={tooltipId} - place="right" - positionStrategy="fixed" - style={{ - background: "#37373E", - color: "white", - padding: "6px 10px", - fontSize: "12px", - fontWeight: 500, - borderRadius: "6px", - boxShadow: "0 4px 12px rgba(0, 0, 0, 0.3)", - zIndex: 10000, - }} - > - <span className="tw-text-xs"> - {formattedWaveName} - </span> - </Tooltip> - )} + {showTooltip && ( + <Tooltip + id={tooltipId} + place="right" + positionStrategy="fixed" + className="!tw-bg-[#37373E] !tw-text-white !tw-px-2.5 !tw-py-1.5 !tw-text-xs !tw-font-medium !tw-rounded-md !tw-shadow-lg !tw-z-[10000]" + > + {formattedWaveName} + </Tooltip> + )}Note: The
!prefix may be needed to override react-tooltip's default styles.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
components/brain/left-sidebar/web/WebBrainLeftSidebarWave.tsx(5 hunks)components/shared/WavesMessagesWrapper.tsx(0 hunks)
💤 Files with no reviewable changes (1)
- components/shared/WavesMessagesWrapper.tsx
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx}: Do not include any comments in the code
Use react-query for data fetching
Always add readonly before props
**/*.{ts,tsx}: Use TypeScript for source code and follow existing code style and naming conventions
Adhere to clean code standards as measured by SonarQube
Files:
components/brain/left-sidebar/web/WebBrainLeftSidebarWave.tsx
**/*.tsx
📄 CodeRabbit inference engine (.cursorrules)
**/*.tsx: Use FontAwesome for icons
Use TailwindCSS for stylingImplement React components as functional components using hooks (no class components)
Files:
components/brain/left-sidebar/web/WebBrainLeftSidebarWave.tsx
⏰ 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: Analyze (javascript-typescript)
🔇 Additional comments (3)
components/brain/left-sidebar/web/WebBrainLeftSidebarWave.tsx (3)
13-13: LGTM: Correct react-tooltip v5 import.The named import follows the correct pattern for react-tooltip v5.
93-94: Good UX decision: disabling tooltips on touch devices.The conditional logic correctly shows tooltips only in condensed mode on non-touch devices, where hover interactions work properly.
109-109: LGTM: Correct react-tooltip v5 anchor linking.The conditional spreading of
data-tooltip-idfollows the correct pattern for linking the anchor to the Tooltip component.
Signed-off-by: ragnep <ragneinfo@gmail.com>
Signed-off-by: ragnep <ragneinfo@gmail.com>
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
components/brain/left-sidebar/web/WebUnifiedWavesListWaves.tsx (1)
88-92: Use theuseDeviceInfohook for consistency.This file implements inline touch device detection, while
WebBrainLeftSidebarWave.tsxuses theuseDeviceInfohook for the same purpose. This creates code duplication and potential inconsistencies in touch detection logic.Apply this diff to use the shared hook:
- const globalScope = globalThis as typeof globalThis & { - window?: Window; - navigator?: Navigator; - }; - const browserWindow = globalScope.window; - const browserNavigator = globalScope.navigator; - - const isTouchDevice = - !!browserWindow && - ("ontouchstart" in browserWindow || - (browserNavigator?.maxTouchPoints ?? 0) > 0 || - browserWindow.matchMedia?.("(pointer: coarse)")?.matches); + const { hasTouchScreen } = useDeviceInfo();Then update line 99:
- const showCreateTooltip = !isTouchDevice && isCondensed; + const showCreateTooltip = !hasTouchScreen && isCondensed;You'll also need to add the import at the top of the file:
import useDeviceInfo from "@/hooks/useDeviceInfo";
🧹 Nitpick comments (1)
components/brain/left-sidebar/web/WebUnifiedWavesListWaves.tsx (1)
178-190: Consider removing the unnecessary div wrapper.The
<div>wrapper around the PrimaryButton in the non-condensed view (line 178) appears unnecessary since no tooltip is attached. Unlike the condensed version, this wrapper doesn't serve a layout or functional purpose.If there's no specific layout reason, you can remove the wrapper:
- <div> - <PrimaryButton - onClicked={openWave} - loading={false} - disabled={false} - padding="tw-px-2 tw-py-2" - > - <FontAwesomeIcon - icon={faPlus} - className="tw-size-4 tw-flex-shrink-0" - /> - </PrimaryButton> - </div> + <PrimaryButton + onClicked={openWave} + loading={false} + disabled={false} + padding="tw-px-2 tw-py-2" + > + <FontAwesomeIcon + icon={faPlus} + className="tw-size-4 tw-flex-shrink-0" + /> + </PrimaryButton>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
components/brain/left-sidebar/web/WebBrainLeftSidebarWave.tsx(5 hunks)components/brain/left-sidebar/web/WebUnifiedWavesListWaves.tsx(4 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx}: Do not include any comments in the code
Use react-query for data fetching
Always add readonly before props
**/*.{ts,tsx}: Use TypeScript for source code and follow existing code style and naming conventions
Adhere to clean code standards as measured by SonarQube
Files:
components/brain/left-sidebar/web/WebUnifiedWavesListWaves.tsxcomponents/brain/left-sidebar/web/WebBrainLeftSidebarWave.tsx
**/*.tsx
📄 CodeRabbit inference engine (.cursorrules)
**/*.tsx: Use FontAwesome for icons
Use TailwindCSS for stylingImplement React components as functional components using hooks (no class components)
Files:
components/brain/left-sidebar/web/WebUnifiedWavesListWaves.tsxcomponents/brain/left-sidebar/web/WebBrainLeftSidebarWave.tsx
🧬 Code graph analysis (2)
components/brain/left-sidebar/web/WebUnifiedWavesListWaves.tsx (1)
components/utils/button/PrimaryButton.tsx (1)
PrimaryButton(3-32)
components/brain/left-sidebar/web/WebBrainLeftSidebarWave.tsx (1)
hooks/useDeviceInfo.ts (1)
useDeviceInfo(22-78)
⏰ 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: Analyze (javascript-typescript)
🔇 Additional comments (5)
components/brain/left-sidebar/web/WebBrainLeftSidebarWave.tsx (3)
13-14: LGTM!The imports are appropriate for adding tooltip functionality with touch device detection.
34-34: LGTM!The touch device detection and conditional tooltip logic is well-implemented. Tooltips are appropriately disabled on touch devices where hover interactions aren't available.
Also applies to: 82-83
98-98: LGTM!The conditional attribute spreading is a clean pattern that keeps unnecessary attributes out of the DOM when tooltips are disabled.
components/brain/left-sidebar/web/WebUnifiedWavesListWaves.tsx (2)
22-22: LGTM!Correct import for the tooltip functionality.
99-100: LGTM!The tooltip configuration logic correctly restricts tooltips to non-touch devices in condensed mode.
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (1)
components/brain/left-sidebar/web/WebUnifiedWavesListWaves.tsx (1)
153-170: Replace inline styles with TailwindCSS and add positionStrategy="fixed".This tooltip implementation has two issues that were previously flagged:
- Uses inline styles instead of TailwindCSS, violating the coding guideline
- Missing
positionStrategy="fixed"which is present inWebBrainLeftSidebarWave.tsx, causing inconsistent positioning behaviorAs per coding guidelines.
Apply this diff to align with TailwindCSS and ensure consistency:
{showCreateTooltip && ( <Tooltip id={createWaveTooltipId} place="right" - style={{ - background: "#37373E", - color: "white", - padding: "6px 10px", - fontSize: "12px", - fontWeight: 500, - borderRadius: "6px", - boxShadow: "0 4px 12px rgba(0, 0, 0, 0.3)", - zIndex: 10000, - }} + positionStrategy="fixed" + className="!tw-bg-iron-700 !tw-text-white !tw-px-2.5 !tw-py-1.5 !tw-text-xs !tw-font-medium !tw-rounded-md !tw-shadow-lg !tw-z-[10000]" > - <span className="tw-text-xs">Create wave</span> + Create wave </Tooltip>
🧹 Nitpick comments (1)
components/brain/left-sidebar/web/WebUnifiedWavesListWaves.tsx (1)
179-191: Remove unnecessary wrapper div.The wrapping
<div>at line 179 is unnecessary since there's no tooltip in the non-condensed view. Unlike the condensed view (line 140) which needs the wrapper to group the button and tooltip together, this div serves no purpose.Apply this diff to remove the wrapper:
shouldRenderCreateWaveButton ? ( - <div> - <PrimaryButton - onClicked={openWave} - loading={false} - disabled={false} - padding="tw-px-2 tw-py-2" - > - <FontAwesomeIcon - icon={faPlus} - className="tw-size-4 tw-flex-shrink-0" - /> - </PrimaryButton> - </div> + <PrimaryButton + onClicked={openWave} + loading={false} + disabled={false} + padding="tw-px-2 tw-py-2" + > + <FontAwesomeIcon + icon={faPlus} + className="tw-size-4 tw-flex-shrink-0" + /> + </PrimaryButton> ) : undefined
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
components/brain/left-sidebar/web/WebUnifiedWavesListWaves.tsx(4 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx}: Do not include any comments in the code
Use react-query for data fetching
Always add readonly before props
**/*.{ts,tsx}: Use TypeScript for source code and follow existing code style and naming conventions
Adhere to clean code standards as measured by SonarQube
Files:
components/brain/left-sidebar/web/WebUnifiedWavesListWaves.tsx
**/*.tsx
📄 CodeRabbit inference engine (.cursorrules)
**/*.tsx: Use FontAwesome for icons
Use TailwindCSS for stylingImplement React components as functional components using hooks (no class components)
Files:
components/brain/left-sidebar/web/WebUnifiedWavesListWaves.tsx
🧬 Code graph analysis (1)
components/brain/left-sidebar/web/WebUnifiedWavesListWaves.tsx (1)
components/utils/button/PrimaryButton.tsx (1)
PrimaryButton(3-32)
⏰ 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: Analyze (javascript-typescript)
|



Summary by CodeRabbit
New Features
Chores