Skip to content

Conversation

davemarco
Copy link
Contributor

@davemarco davemarco commented Jun 9, 2025

Description

Overall case sensitive toggle looks great, but this PR adds some minor cleanup.

PR disables the button during query like the other buttons. Also, previously it used disabled state to represent one of the case sensitive options, which showed the disabled icon on hover, i thought this was undesirable so i just moved to outline for active like vscode.

I also did some refactoring in process

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

Summary by CodeRabbit

  • New Features

    • Added a case sensitivity toggle button to the query input, allowing users to easily switch between case-sensitive and case-insensitive searches.
    • Introduced a combined input component with an integrated case sensitivity toggle for seamless interaction.
  • Refactor

    • Simplified the query input by integrating the case sensitivity toggle directly into the input field for a more streamlined user experience.

@davemarco davemarco requested a review from a team as a code owner June 9, 2025 17:23
Copy link
Contributor

coderabbitai bot commented Jun 9, 2025

Walkthrough

A new CaseSensitiveToggle component and an InputWithCaseSensitive component were introduced to encapsulate case sensitivity toggle logic and UI. The QueryBox component was refactored to use InputWithCaseSensitive, removing its own toggle logic and related props for a simplified interface.

Changes

File(s) Change Summary
.../QueryBox/InputWithCaseSensitive/CaseSenstiveToggle.tsx Added new CaseSensitiveToggle component and its props interface.
.../QueryBox/InputWithCaseSensitive/index.tsx Added new InputWithCaseSensitive component and props type, integrating the toggle into an input component.
.../QueryBox/index.tsx Refactored QueryBox to use InputWithCaseSensitive, removed internal toggle logic and related props.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant QueryBox
    participant InputWithCaseSensitive
    participant CaseSensitiveToggle

    User->>QueryBox: Interact with QueryBox
    QueryBox->>InputWithCaseSensitive: Pass input and case sensitivity props
    InputWithCaseSensitive->>CaseSensitiveToggle: Render toggle as suffix
    User->>CaseSensitiveToggle: Click toggle
    CaseSensitiveToggle->>InputWithCaseSensitive: onCaseSensitiveChange callback
    InputWithCaseSensitive->>QueryBox: (if needed) propagate change
Loading

Possibly related PRs

Suggested reviewers

  • junhaoliao

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 49cfd41 and b809196.

📒 Files selected for processing (1)
  • components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/CaseSenstiveToggle.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}`: - Prefer `false == ` rather than `!`.

**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}: - Prefer false == <expression> rather than !<expression>.

  • components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/CaseSenstiveToggle.tsx
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: lint-check (macos-latest)
  • GitHub Check: lint-check (ubuntu-latest)
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@davemarco davemarco requested a review from junhaoliao June 9, 2025 17:23
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: 3

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between db6d7a2 and 4d204fe.

📒 Files selected for processing (3)
  • components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/CaseSenstiveToggle.tsx (1 hunks)
  • components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/index.tsx (1 hunks)
  • components/log-viewer-webui/client/src/components/QueryBox/index.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}`: - Prefer `false == ` rather than `!`.

**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}: - Prefer false == <expression> rather than !<expression>.

  • components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/index.tsx
  • components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/CaseSenstiveToggle.tsx
  • components/log-viewer-webui/client/src/components/QueryBox/index.tsx
🧬 Code Graph Analysis (1)
components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/index.tsx (1)
components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/CaseSenstiveToggle.tsx (1)
  • CaseSensitiveToggleProps (68-68)
🔇 Additional comments (5)
components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/index.tsx (1)

23-38: Clean component implementation with proper prop handling.

The component correctly combines InputProps with CaseSensitiveToggleProps, omits the suffix prop appropriately, and uses proper prop destructuring and spreading. The integration of the toggle as a suffix is well-designed.

components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/CaseSenstiveToggle.tsx (1)

44-65: Well-structured toggle component with appropriate UI patterns.

The component correctly implements:

  • Conditional tooltip display based on disabled state
  • Visual state indication through button variants (outlined vs text)
  • Proper event handling with useCallback optimization
  • Accessible button with icon and disabled state handling
components/log-viewer-webui/client/src/components/QueryBox/index.tsx (3)

8-8: Good separation of concerns with new component import.

The import of InputWithCaseSensitive and its props type enables clean delegation of the case sensitivity toggle functionality.


11-11: Clean props interface extension.

Extending InputWithCaseSensitiveProps properly inherits all the case sensitivity toggle functionality while maintaining the QueryBox-specific progress prop.


26-33: Simplified component implementation through delegation.

The refactored implementation successfully delegates case sensitivity toggle functionality to InputWithCaseSensitive, reducing complexity and improving maintainability while preserving all existing functionality.

InputProps,
} from "antd";

import CaseSensitiveToggle, {CaseSensitiveToggleProps} from "./CaseSenstiveToggle";
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix the filename typo in the import.

The imported file name contains a typo: "CaseSenstiveToggle" should be "CaseSensitiveToggle".

-import CaseSensitiveToggle, {CaseSensitiveToggleProps} from "./CaseSenstiveToggle";
+import CaseSensitiveToggle, {CaseSensitiveToggleProps} from "./CaseSensitiveToggle";
📝 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
import CaseSensitiveToggle, {CaseSensitiveToggleProps} from "./CaseSenstiveToggle";
import CaseSensitiveToggle, {CaseSensitiveToggleProps} from "./CaseSensitiveToggle";
🤖 Prompt for AI Agents
In
components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/index.tsx
at line 6, fix the typo in the import statement by changing "CaseSenstiveToggle"
to "CaseSensitiveToggle" so the import matches the correct filename.

@@ -0,0 +1,68 @@
import {useCallback} from "react";
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix the filename typo.

The filename "CaseSenstiveToggle.tsx" contains a typo and should be "CaseSensitiveToggle.tsx" to match the component name and maintain consistency.

🤖 Prompt for AI Agents
In
components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/CaseSenstiveToggle.tsx
at line 1, the filename contains a typo "CaseSenstiveToggle.tsx". Rename the
file to "CaseSensitiveToggle.tsx" to match the component name and ensure
consistency across the codebase.


/**
* Renders an Input with a progress bar.
* Renders a Input with a case sensitivity toggle and progress bar.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Renders a Input with a case sensitivity toggle and progress bar.
* Renders an Input with a case sensitivity toggle and progress bar.

Comment on lines 40 to 41
export default InputWithCaseSensitive;
export type {InputWithCaseSensitiveProps};
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
export default InputWithCaseSensitive;
export type {InputWithCaseSensitiveProps};
export type {InputWithCaseSensitiveProps};
export default InputWithCaseSensitive;

Comment on lines 46 to 48
title={(isDisabled) ?
"" :
"Match case"}
Copy link
Member

Choose a reason for hiding this comment

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

i feel that we disable the toggle should not remove the tooltip. would it be better to always show the tooltip so our users know what this toggle is for even during queries?

Copy link
Contributor Author

@davemarco davemarco Jun 9, 2025

Choose a reason for hiding this comment

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

Im not sure, i feel like the tooltip implies interactivity, but u cant click it while search

Copy link
Member

Choose a reason for hiding this comment

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

i believe for better accessibility, it's always better to keep the tooltips mounted

Suggested change
title={(isDisabled) ?
"" :
"Match case"}
title={"Match case"}

@davemarco davemarco requested a review from junhaoliao June 9, 2025 19:09
Copy link
Member

@junhaoliao junhaoliao left a comment

Choose a reason for hiding this comment

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

otherwise all good

Comment on lines 46 to 48
title={(isDisabled) ?
"" :
"Match case"}
Copy link
Member

Choose a reason for hiding this comment

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

i believe for better accessibility, it's always better to keep the tooltips mounted

Suggested change
title={(isDisabled) ?
"" :
"Match case"}
title={"Match case"}



interface CaseSensitiveToggleProps {
disabled?: boolean | undefined;
Copy link
Member

Choose a reason for hiding this comment

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

it should always be defined in our uses, right?

Suggested change
disabled?: boolean | undefined;
disabled: boolean;

Copy link
Contributor Author

@davemarco davemarco Jun 10, 2025

Choose a reason for hiding this comment

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

I clean up a bit. Anyways not always defined since it it in component folder, and it takes generic input props from antd where it can be undefined

Comment on lines 34 to 42
const handleButtonClick = useCallback(() => {
if (false === isDisabled) {
onCaseSensitiveChange(!isCaseSensitive);
}
}, [
isDisabled,
isCaseSensitive,
onCaseSensitiveChange,
]);
Copy link
Member

Choose a reason for hiding this comment

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

do we strictly need the isDisabled check? i.e., would handleButtonClick ever be fired if the button is disabled?

Suggested change
const handleButtonClick = useCallback(() => {
if (false === isDisabled) {
onCaseSensitiveChange(!isCaseSensitive);
}
}, [
isDisabled,
isCaseSensitive,
onCaseSensitiveChange,
]);
const handleButtonClick = useCallback(() => {
onCaseSensitiveChange(!isCaseSensitive);
}, [
isCaseSensitive,
onCaseSensitiveChange,
]);

Comment on lines 32 to 33
const isDisabled = disabled ?? false;

Copy link
Member

Choose a reason for hiding this comment

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

if we may not need to handle the case where disabled is undefined:

Suggested change
const isDisabled = disabled ?? false;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see earlier

>
<Button
color={"default"}
disabled={isDisabled}
Copy link
Member

Choose a reason for hiding this comment

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

if we may not need to handle the case where disabled is undefined:

Suggested change
disabled={isDisabled}
disabled={disabled}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see ealier

disabled={isDisabled}
size={"small"}
icon={
<Typography.Text disabled={isDisabled}>
Copy link
Member

Choose a reason for hiding this comment

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

if we may not need to handle the case where disabled is undefined:

Suggested change
<Typography.Text disabled={isDisabled}>
<Typography.Text disabled={disabled}>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see earlier

Comment on lines 66 to 68

export default CaseSensitiveToggle;
export type {CaseSensitiveToggleProps};
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
export default CaseSensitiveToggle;
export type {CaseSensitiveToggleProps};
export type {CaseSensitiveToggleProps};
export default CaseSensitiveToggle;

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

♻️ Duplicate comments (1)
components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/index.tsx (1)

6-6: Fix the filename typo in the import path.

The imported module path contains a typo: it should reference ./CaseSensitiveToggle to match the component name and filename.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4d204fe and 3c20751.

📒 Files selected for processing (3)
  • components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/CaseSenstiveToggle.tsx (1 hunks)
  • components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/index.tsx (1 hunks)
  • components/log-viewer-webui/client/src/components/QueryBox/index.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}`: - Prefer `false == ` rather than `!`.

**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}: - Prefer false == <expression> rather than !<expression>.

  • components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/index.tsx
  • components/log-viewer-webui/client/src/components/QueryBox/index.tsx
  • components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/CaseSenstiveToggle.tsx
🧬 Code Graph Analysis (2)
components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/index.tsx (1)
components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/CaseSenstiveToggle.tsx (1)
  • CaseSensitiveToggleProps (68-68)
components/log-viewer-webui/client/src/components/QueryBox/index.tsx (1)
components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/index.tsx (1)
  • InputWithCaseSensitiveProps (40-40)
🔇 Additional comments (6)
components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/index.tsx (4)

12-12: Good use of Omit to exclude the suffix prop.

Composing InputProps (minus suffix) with the toggle props cleanly avoids prop conflicts.


23-27: Destructure and forward input props clearly.

Extracting isCaseSensitive and onCaseSensitiveChange and spreading the rest into the Input makes the API concise and flexible.


31-35: Inject the toggle as the input suffix.

Embedding CaseSensitiveToggle in suffix neatly encapsulates the toggle behavior alongside the text input.


40-42: Exports look good.

Exporting the props type separately and default-exporting the component aligns with our module conventions.

components/log-viewer-webui/client/src/components/QueryBox/index.tsx (2)

11-16: Extend the toggle props directly in QueryBoxProps.

Using extends InputWithCaseSensitiveProps cleanly inherits all input and toggle props, simplifying the component API.


33-33: Clean integration of InputWithCaseSensitive.

Spreading inputProps into InputWithCaseSensitive ensures all relevant props (including case toggle) are passed through neatly.

Comment on lines 18 to 25
/**
* Renders an Input with a progress bar.
* Renders an Input with a case sensitivity toggle and progress bar.
*
* @param props
* @param props.progress
* @param props.inputProps
* @param props.onCaseSensitiveChange
* @param props.isCaseSensitive
* @return
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Update JSDoc to reflect actual props.

The @param props.inputProps tag is misleading—there is no inputProps prop. Rename or remove this line and document isCaseSensitive and onCaseSensitiveChange explicitly, along with progress.

🤖 Prompt for AI Agents
In components/log-viewer-webui/client/src/components/QueryBox/index.tsx around
lines 18 to 25, the JSDoc incorrectly documents a non-existent prop named
inputProps. Remove or rename the @param tag for inputProps and explicitly add
@param tags for the actual props isCaseSensitive and onCaseSensitiveChange,
along with progress, to accurately reflect the component's props.

@davemarco davemarco requested a review from junhaoliao June 10, 2025 18:14
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: 4

♻️ Duplicate comments (2)
components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/index.tsx (1)

6-6: Fix the import-path typo.

The filename is still spelled “CaseSenstiveToggle”; rename to “CaseSensitiveToggle” to match the component/file name and avoid module-resolution failures.

components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/CaseSenstiveToggle.tsx (1)

1-1: Rename the file to CaseSensitiveToggle.tsx.

The class/component name and import path expect the correct spelling. Keeping the typo makes cross-file imports fragile.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3c20751 and 568bad9.

📒 Files selected for processing (2)
  • components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/CaseSenstiveToggle.tsx (1 hunks)
  • components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/index.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}`: - Prefer `false == ` rather than `!`.

**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}: - Prefer false == <expression> rather than !<expression>.

  • components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/index.tsx
  • components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/CaseSenstiveToggle.tsx
🧬 Code Graph Analysis (1)
components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/index.tsx (1)
components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/CaseSenstiveToggle.tsx (1)
  • CaseSensitiveToggleProps (67-67)

Comment on lines +32 to +37
const handleButtonClick = useCallback(() => {
onCaseSensitiveChange(!isCaseSensitive);
}, [
isCaseSensitive,
onCaseSensitiveChange,
]);
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Use explicit comparison instead of unary “!” per coding guidelines.

Replace the negation with the preferred style:

-        onCaseSensitiveChange(!isCaseSensitive);
+        onCaseSensitiveChange(false == isCaseSensitive);

This keeps the behaviour identical while aligning with the project’s boolean-expression rule.

🤖 Prompt for AI Agents
In
components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/CaseSenstiveToggle.tsx
around lines 32 to 37, the code uses a unary "!" operator to negate the boolean
isCaseSensitive. To comply with the project's coding guidelines, replace the
negation with an explicit comparison expression that achieves the same boolean
toggle effect without using "!". This will maintain the behavior while adhering
to the boolean-expression rule.

Comment on lines 44 to 60
{...(disabled ?
{disabled: disabled} :
{})}
color={"default"}
size={"small"}
icon={
<Typography.Text
{...(disabled ?
{disabled: disabled} :
{})}
>
Aa
</Typography.Text>
}
variant={isCaseSensitive ?
"outlined" :
"text"}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Invalid Ant Design props (color, variant) will break compilation.

antd’s Button does not accept color or variant; use its type and ghost/danger modifiers instead, e.g.:

-                color={"default"}
+                type={"default"}-                variant={isCaseSensitive ? "outlined" : "text"}
+                ghost={isCaseSensitive}   // outlined-look
+                type={isCaseSensitive ? "default" : "text"}

Leaving the current props will cause a TS error (Property 'variant' does not exist …) and runtime warnings.

📝 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
{...(disabled ?
{disabled: disabled} :
{})}
color={"default"}
size={"small"}
icon={
<Typography.Text
{...(disabled ?
{disabled: disabled} :
{})}
>
Aa
</Typography.Text>
}
variant={isCaseSensitive ?
"outlined" :
"text"}
{...(disabled ?
{disabled: disabled} :
{})}
type={"default"}
size={"small"}
icon={
<Typography.Text
{...(disabled ?
{disabled: disabled} :
{})}
>
Aa
</Typography.Text>
}
ghost={isCaseSensitive} // outlined-look
type={isCaseSensitive ? "default" : "text"}
🤖 Prompt for AI Agents
In
components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/CaseSenstiveToggle.tsx
between lines 44 and 60, the Button component incorrectly uses unsupported props
'color' and 'variant' which cause TypeScript errors and runtime warnings. Remove
these props and replace them by using Ant Design's supported 'type' prop and
modifiers like 'ghost' or 'danger' to achieve the desired styling. Adjust the
Button's appearance logic accordingly to use these valid props instead of
'color' and 'variant'.



interface CaseSensitiveToggleProps {
disabled?: boolean;
Copy link
Member

Choose a reason for hiding this comment

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

sorry i didn't get the previous comment - what's the reason we can't make this prop required?

Suggested change
disabled?: boolean;
disabled: boolean;

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

♻️ Duplicate comments (4)
components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/index.tsx (1)

6-6: ⚠️ Potential issue

Import still referencing the miss-spelled file

The import path keeps the original “CaseSenstiveToggle” typo. The companion file has not been renamed yet, so the typo now leaks into every consumer and will survive tree-shaking / barrel exports.

-import CaseSensitiveToggle, {CaseSensitiveToggleProps} from "./CaseSenstiveToggle";
+import CaseSensitiveToggle, {CaseSensitiveToggleProps} from "./CaseSensitiveToggle";
components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/CaseSenstiveToggle.tsx (3)

1-1: ⚠️ Potential issue

Rename file to match component

The filename “CaseSenstiveToggle.tsx” is miss-spelled; keep the codebase grep-friendly and avoid future import typos by renaming to “CaseSensitiveToggle.tsx”.


32-37: 🧹 Nitpick (assertive)

Boolean negation breaks project style guide

Per the repo’s guideline, prefer false == <expr> over !<expr>.

-        onCaseSensitiveChange(!isCaseSensitive);
+        onCaseSensitiveChange(false == isCaseSensitive);

44-55: ⚠️ Potential issue

color and variant are not valid Ant Design props – build will fail

Ant Design’s <Button> supports type, ghost, danger, etc., but not color or variant. Keeping them causes TS errors and runtime warnings.

A minimal, compile-safe replacement preserving the “outlined vs text” look:

-            <Button
-                color={"default"}
+            <Button
                 disabled={disabled}
                 size={"small"}
                 icon={
                     <Typography.Text disabled={disabled}>
                         Aa
                     </Typography.Text>
                 }
-                variant={isCaseSensitive ?
-                    "outlined" :
-                    "text"}
+                ghost={isCaseSensitive}   /* outlined */
+                type={"default"}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 568bad9 and 49cfd41.

📒 Files selected for processing (2)
  • components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/CaseSenstiveToggle.tsx (1 hunks)
  • components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/index.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}`: - Prefer `false == ` rather than `!`.

**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}: - Prefer false == <expression> rather than !<expression>.

  • components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/CaseSenstiveToggle.tsx
  • components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/index.tsx
🧬 Code Graph Analysis (1)
components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/index.tsx (1)
components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/CaseSenstiveToggle.tsx (1)
  • CaseSensitiveToggleProps (61-61)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: lint-check (ubuntu-latest)
  • GitHub Check: lint-check (macos-latest)
🔇 Additional comments (1)
components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/index.tsx (1)

31-35: Spread already contains disabled; avoid double-source

Because disabled is part of inputProps, passing it again risks divergence if callers mutate it prior to reuse.

-                <CaseSensitiveToggle
-                    disabled={inputProps.disabled}
+                <CaseSensitiveToggle

React will forward disabled together with the rest of inputProps.
[ suggest_optional_refactor ]

Comment on lines +12 to +13
type InputWithCaseSensitiveProps = Omit<InputProps, "suffix"> & CaseSensitiveToggleProps;

Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

disabled becomes mandatory due to type intersection

InputProps declares disabled?: boolean (optional) but CaseSensitiveToggleProps declares disabled: boolean (required).
The intersection forces the final prop to be required, breaking existing call-sites that omit it.

Make disabled optional in CaseSensitiveToggleProps, or remove it so callers rely on InputProps alone.

-interface CaseSensitiveToggleProps {
-    disabled: boolean;
+interface CaseSensitiveToggleProps {
+    disabled?: boolean;

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In
components/log-viewer-webui/client/src/components/QueryBox/InputWithCaseSensitive/index.tsx
around lines 12 to 13, the intersection of InputProps and
CaseSensitiveToggleProps makes the 'disabled' prop required because
CaseSensitiveToggleProps declares it as mandatory while InputProps has it
optional. To fix this, modify CaseSensitiveToggleProps to make 'disabled'
optional or remove 'disabled' from CaseSensitiveToggleProps entirely so that
callers can rely on the optional 'disabled' from InputProps, preventing breaking
existing call-sites.

@davemarco davemarco requested a review from junhaoliao June 10, 2025 19:43
junhaoliao
junhaoliao previously approved these changes Jun 10, 2025
…utWithCaseSensitive/CaseSenstiveToggle.tsx

Co-authored-by: Junhao Liao <junhao@junhao.ca>
@davemarco davemarco merged commit fadc33a into y-scope:main Jun 10, 2025
7 checks passed
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