Skip to content

Thulasizwe/en/dropdown tag#3395

Merged
James-Baloyi merged 9 commits intoshesha-io:mainfrom
czwe-01:thulasizwe/en/dropdown-tag
Jun 17, 2025
Merged

Thulasizwe/en/dropdown tag#3395
James-Baloyi merged 9 commits intoshesha-io:mainfrom
czwe-01:thulasizwe/en/dropdown-tag

Conversation

@czwe-01
Copy link
Copy Markdown
Collaborator

@czwe-01 czwe-01 commented Jun 12, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a new custom tag component for dropdowns, enhancing tag display options and tooltip support.
    • Added support for an optional description on dropdown options and label values, shown as tooltips.
  • Enhancements

    • Improved dropdown and tag styling options, including device-aware visibility and solid color backgrounds.
    • Enhanced configurability of dropdown display styles and tag appearance in the settings panel.
    • Updated tooltips and panel labels for better clarity in settings forms.
    • Adjusted default tag background color and refined preset color options.
  • Bug Fixes

    • Minor formatting improvements for better readability in component rendering.
  • Refactor

    • Unified tag rendering logic across dropdown-related components for consistency.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jun 12, 2025

Walkthrough

The updates introduce a new ReflistTag component to replace direct usage of Ant Design's Tag for tag-style dropdowns and read-only displays, enhancing tag rendering with additional props and tooltip support. Related styling and settings logic are refactored to support these changes, including updates to dropdown settings forms, style utilities, and option models.

Changes

File(s) Change Summary
dropdown.tsx, genericRefListDropDown.tsx, readOnlyDisplayFormItem/index.tsx Replaced Ant Design Tag usage with new ReflistTag component for tag rendering, passing enhanced props.
refListDropDown/reflistTag.tsx Introduced new ReflistTag component rendering a styled tag with tooltip and optional icon.
refListDropDown/models.ts Added optional description property to ISelectOption interface.
dropdown/model.ts Added optional description property to ILabelValue interface.
dropdown/style.ts Simplified useStyles signature and removed tag height styling.
designer-components/dropdown/settingsForm.ts Refactored dropdown settings form for improved tag style and display style configurability.
designer-components/dropdown/utils.ts Changed default tag background color and removed two preset colors.
designer-components/entityPicker/settingsForm.ts Renamed tooltip property to customTooltip for dialog width setting.
designer-components/refListStatus/index.tsx Reformatted JSX for improved readability, no logic changes.
designer-components/wizard/styles.ts Removed white-space: nowrap from wizard steps content style to allow text wrapping.
designer-components/wizard/tabs.tsx Removed vertical property from useStyles hook argument.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Dropdown
    participant ReflistTag
    participant Tooltip

    User->>Dropdown: Selects value(s) (tags mode)
    Dropdown->>ReflistTag: Render tag with props (label, value, icon, tooltip, etc.)
    ReflistTag->>Tooltip: Wrap Tag with tooltip text
    Tooltip-->>User: Displays styled tag with tooltip on hover
Loading

Suggested reviewers

  • James-Baloyi

Poem

In the meadow of code, new tags now bloom,
With tooltips and icons, they banish the gloom.
ReflistTag hops in, so lively and spry,
Bringing colors and labels that catch the eye.
Dropdowns rejoice, as settings take flight—
A rabbit’s delight, everything feels just right!
🐇✨


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 94fb8d1 and f0fd227.

📒 Files selected for processing (2)
  • shesha-reactjs/src/designer-components/wizard/styles.ts (2 hunks)
  • shesha-reactjs/src/designer-components/wizard/tabs.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • shesha-reactjs/src/designer-components/wizard/styles.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-attempt
🔇 Additional comments (1)
shesha-reactjs/src/designer-components/wizard/tabs.tsx (1)

48-53: Confirm overflow pipe-through & removal of vertical flag

overflow is now forwarded to useStyles, while vertical has been dropped.
The change itself looks fine, but please double-check that:

  1. IWizardStylesProps (in styles.ts) still contains an overflow field and no longer expects vertical; otherwise the type check will fail silently when JS consumers miss the prop.
  2. Styles previously relying on the vertical prop are now handled purely by the vertical className applied on line 101 – verify that the stylesheet has matching selectors so behaviour stays unchanged.

No action required if both points are already covered.

✨ 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.

Copy link
Copy Markdown
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: 7

🧹 Nitpick comments (3)
shesha-reactjs/src/components/refListDropDown/models.ts (1)

58-67:

Details

❓ Verification inconclusive

Add brief jsdoc & run code-wide reference check for new description field

The optional description?: string addition is sensible, however:

  1. There is no comment explaining the intent / UI usage – please add a short JSDoc so future devs know this is consumed as a tooltip.
  2. Ensure every place that constructs an ISelectOption now initialises (or at least ignores) description, otherwise undefined tooltips may surface.
   /** Optional text shown as tooltip when the option is rendered as a tag */
+  description?: string;

Consider running a quick repo-wide grep to verify call-sites:


🏁 Script executed:

rg "description:" --type ts,tsx

Length of output: 62


🏁 Script executed:

#!/bin/bash
# Locate all usages of ISelectOption to identify where options are constructed
rg -n "ISelectOption" -g "*.ts" -g "*.tsx"

# Search for any explicit description property assignments in TS/TSX files
rg -n "description\s*:" -g "*.ts" -g "*.tsx"

Length of output: 387


🏁 Script executed:

#!/bin/bash
set -e

echo "=== Listing some TS/TSX files ==="
find . -maxdepth 5 -type f \( -iname "*.ts" -o -iname "*.tsx" \) | head -n 20

echo
echo "=== Searching for ISelectOption usages ==="
rg -n "ISelectOption"

echo
echo "=== Searching for any 'description' property assignments ==="
rg -n "description\s*?:"

Length of output: 292


🏁 Script executed:

#!/bin/bash
# List top-level files and directories to confirm repository structure
echo "=== Root directory listing ==="
find . -maxdepth 2 | sed 's/^/ /' | head -n 50

# Locate any TS/TSX files in the repo (ignoring node_modules)
echo
echo "=== TS/TSX files found ==="
find . -type f -not -path "*/node_modules/*" \( -iname "*.ts" -o -iname "*.tsx" \) | head -n 20

# Search for ISelectOption usages (include hidden/ignored to be safe)
echo
echo "=== Usages of ISelectOption ==="
rg -n "ISelectOption" -uu

# Search for any explicit description property assignments
echo
echo "=== 'description' property assignments ==="
rg -n "description\s*?:" -uu

Length of output: 738


TS/TSX files not detected–please verify manually

I wasn’t able to locate any .ts/.tsx files (including shesha-reactjs/src/components/refListDropDown/models.ts) in the sandbox. Please ensure you’re on the correct branch and that the files are checked out locally, then:

  • Confirm that models.ts exists and contains the new description?: string field.
  • Add a JSDoc comment above description to explain its UI usage, for example:
    /** Optional text shown as tooltip when the option is rendered as a tag */
    description?: string;
  • Once the files are present, run a repo-wide search for description: in TS/TSX files to ensure every ISelectOption instantiation handles it:
    rg "description:" --type ts,tsx
  • Verify that call-sites either initialize description or deliberately omit it to avoid undefined tooltips.
shesha-reactjs/src/designer-components/dropdown/utils.ts (1)

35-38: Default tag background changed to empty string – verify visual fallback

background.color was #fff; now it’s ''.
Ant Design falls back to transparent, not theme‐based colour, so tags may become invisible on light backgrounds.

Please confirm this is the intended design and that designer previews / runtime render as expected for all themes.

shesha-reactjs/src/components/refListDropDown/reflistTag.tsx (1)

13-19: Move cursor style from Tooltip to Tag for better UX.

The cursor style should be applied to the interactive element (Tag) rather than the Tooltip wrapper.

     return (
-        <Tooltip title={tooltip} placement={placement as TooltipProps['placement']} style={{ cursor: 'pointer' }}>
+        <Tooltip title={tooltip} placement={placement as TooltipProps['placement']}>
             <Tag
                 key={value}
                 color={memoizedColor}
                 icon={(icon && showIcon) && <Icon type={icon} />}
-                style={getTagStyle(tagStyle, !!color)}
+                style={{ ...getTagStyle(tagStyle, !!color), cursor: 'pointer' }}
             >{showItemName && label}</Tag>
         </Tooltip>
     );
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between fb82c79 and 7aed7f3.

📒 Files selected for processing (10)
  • shesha-reactjs/src/components/dropdown/dropdown.tsx (6 hunks)
  • shesha-reactjs/src/components/dropdown/style.ts (2 hunks)
  • shesha-reactjs/src/components/readOnlyDisplayFormItem/index.tsx (4 hunks)
  • shesha-reactjs/src/components/refListDropDown/genericRefListDropDown.tsx (5 hunks)
  • shesha-reactjs/src/components/refListDropDown/models.ts (1 hunks)
  • shesha-reactjs/src/components/refListDropDown/reflistTag.tsx (1 hunks)
  • shesha-reactjs/src/designer-components/dropdown/settingsForm.ts (6 hunks)
  • shesha-reactjs/src/designer-components/dropdown/utils.ts (1 hunks)
  • shesha-reactjs/src/designer-components/entityPicker/settingsForm.ts (1 hunks)
  • shesha-reactjs/src/designer-components/refListStatus/index.tsx (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-attempt
🔇 Additional comments (14)
shesha-reactjs/src/designer-components/refListStatus/index.tsx (1)

51-52: Prop-drilling raw style object – double-check precedence

style={model.allStyles?.fullStyle ?? {}} forwards the entire computed style object directly to RefListStatus.
If RefListStatus already merges its own defaults with incoming style, this is fine; otherwise you may unintentionally override internal sizing/spacing.

Please confirm RefListStatus handles this gracefully (e.g., via style={…mergeStyles(defaults, props.style)}) to avoid regressions.

shesha-reactjs/src/designer-components/entityPicker/settingsForm.ts (1)

353-359:

Details

❓ Verification inconclusive

Renamed tooltipcustomTooltip – ensure renderer supports the new prop

Only this input uses customTooltip; the rest of the settings form (e.g. line 409) still uses tooltip.
If the form engine has not been updated to recognise customTooltip, the help text will disappear.

Please verify the underlying component API or align naming for consistency.


🏁 Script executed:

#!/usr/bin/env bash
set -e

echo "=== Searching for customTooltip usage in settingsForm.ts ==="
rg "customTooltip" -n shesha-reactjs/src/designer-components/entityPicker/settingsForm.ts || echo "No occurrences of customTooltip in settingsForm.ts"

echo
echo "=== Searching for tooltip usage in settingsForm.ts ==="
rg "tooltip" -n shesha-reactjs/src/designer-components/entityPicker/settingsForm.ts || echo "No occurrences of tooltip in settingsForm.ts"

echo
echo "=== Searching for customTooltip handling across codebase ==="
rg "customTooltip" -n shesha-reactjs/src || echo "No customTooltip handlers found"

echo
echo "=== Searching for tooltip handling across codebase ==="
rg "tooltip" -n shesha-reactjs/src || echo "No tooltip handlers found"

Length of output: 1460


🏁 Script executed:

#!/usr/bin/env bash
set -e

echo "=== Locating settingsForm.ts files ==="
FILES=$(find . -type f -name "settingsForm.ts")
if [ -z "$FILES" ]; then
  echo "No settingsForm.ts found"
  exit 0
fi

for f in $FILES; do
  echo
  echo "=== Inspecting $f ==="
  echo ">> customTooltip occurrences:"
  rg -n "customTooltip" "$f" || echo "  (none)"
  echo
  echo ">> tooltip occurrences:"
  rg -n "tooltip" "$f" || echo "  (none)"
done

Length of output: 228


🏁 Script executed:

#!/usr/bin/env bash
set -e

echo "=== Searching for 'customDropdownMode' occurrences ==="
rg -n "customDropdownMode" .

echo
echo "=== Searching for 'Dialog Width' occurrences ==="
rg -n "Dialog Width" .

echo
echo "=== Searching for 'entityPicker' directory or usage ==="
rg -n "entityPicker" .

Length of output: 162


🏁 Script executed:

#!/usr/bin/env bash
set -e

echo "=== Listing top-level directories and subdirectories ==="
find . -maxdepth 2 -type d

Length of output: 220


Verify tooltip prop renaming support

It looks like the “Dialog Width” setting in your settingsForm.ts now uses customTooltip instead of the existing tooltip prop. If the form renderer or underlying component API hasn’t been updated to handle customTooltip, your help text will stop showing up.

Please manually confirm and align naming:

• File (approx.): shesha-reactjs/src/designer-components/entityPicker/settingsForm.ts
– Line with customTooltip: 'You can use any unit…'
• Check that the form engine/component accepts customTooltip (or update it).
• Either rename all remaining tooltip props to customTooltip, or add support for both props for consistency.

shesha-reactjs/src/components/refListDropDown/genericRefListDropDown.tsx (2)

1-8: LGTM! Import changes align with ReflistTag introduction.

The removal of unused Tag import and addition of ReflistTag import properly reflects the component refactoring.


120-133: LGTM! Properly forwards new display props to read-only component.

The addition of showItemName prop ensures consistent behavior between editable and read-only modes.

shesha-reactjs/src/components/readOnlyDisplayFormItem/index.tsx (3)

1-10: LGTM! Import changes properly reflect component usage.

Removal of unused Tag import and addition of ReflistTag aligns with the refactoring.


81-92: LGTM! Correct implementation of ReflistTag for single dropdown.

The component properly uses description for tooltip and passes all required props. The use of nullish coalescing operator (??) is also a good improvement.


105-117: LGTM! Consistent ReflistTag implementation for multiple dropdowns.

The implementation maintains consistency with the single dropdown version and properly handles array mapping.

shesha-reactjs/src/components/dropdown/dropdown.tsx (2)

11-11: LGTM! Import and style hook updates align with refactoring.

The addition of ReflistTag import and simplified useStyles call properly reflect the component changes.

Also applies to: 41-41


83-84: LGTM! Addition of description property enhances tooltip support.

Including the description in labeled values enables proper tooltip display in ReflistTag.

Also applies to: 109-110

shesha-reactjs/src/designer-components/dropdown/settingsForm.ts (5)

83-105: LGTM! Well-structured common settings reorganization.

The reorganization into input rows improves the form layout and user experience.


107-139: LGTM! Proper conditional visibility for tag-specific controls.

The conditional display of showItemName and showIcon based on displayStyle is well-implemented with appropriate tooltips.


451-467: LGTM! Clear display style options.

The dropdown provides clear options between "Plain text" and "Tags" display modes.


1017-1024: LGTM! Clear solidColor toggle with helpful tooltip.

The tooltip clearly explains the visual difference between solid and subtle tag styles.


884-1238: LGTM! Comprehensive tag styling configuration.

The extensive tag styling options provide excellent customization capabilities while maintaining good organization through collapsible panels.

Comment on lines +33 to 38
.ant-tag {
align-content: center;
cursor: default !important;
pointer-events: none !important;
}
}
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.

🛠️ Refactor suggestion

Hover disables pointer events on all nested tags – may break close icon

pointer-events:none on .ant-tag during hover prevents the built-in close (‘x’) button from receiving clicks in multi-select mode. If read-only behaviour is desired, guard it with a prop instead of unconditional CSS.

Consider:

  .ant-tag[disabled] { pointer-events:none; }
🤖 Prompt for AI Agents
In shesha-reactjs/src/components/dropdown/style.ts around lines 33 to 38, the
CSS rule unconditionally sets pointer-events:none on .ant-tag during hover,
which disables interaction with the close icon in multi-select mode. To fix
this, remove the unconditional pointer-events:none and instead apply it
conditionally using a prop or attribute, such as .ant-tag[disabled] {
pointer-events:none; }, so that pointer events are only disabled when explicitly
desired.

import { CSSProperties } from 'react';

export const useStyles = createStyles(({ css, cx, token }, { style, tagStyle }: { style: CSSProperties; tagStyle: CSSProperties }) => {
export const useStyles = createStyles(({ css, cx, token }, { style }: { style: CSSProperties }) => {
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.

⚠️ Potential issue

Mismatch between CSS variable names – font weight will not apply

You set
--ant-font-weight-strong: ${style.fontWeight};

Later, .ant-select-selection-item uses font-weight: var(--ant-font-weight); – note the missing “-strong”. This leaves the weight uncontrolled.

-      --ant-font-weight-strong: ${style.fontWeight} !important;
+      --ant-font-weight: ${style.fontWeight} !important;

Apply the same rename (or update the consumer) to restore the intended styling.

📝 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
export const useStyles = createStyles(({ css, cx, token }, { style }: { style: CSSProperties }) => {
export const useStyles = createStyles(
({ css, cx, token }, { style }: { style: CSSProperties }) => ({
dropdown: css`
- --ant-font-weight-strong: ${style.fontWeight} !important;
+ --ant-font-weight: ${style.fontWeight} !important;
/* …other rules… */
`,
})
);
🤖 Prompt for AI Agents
In shesha-reactjs/src/components/dropdown/style.ts at line 4, the CSS variable
for font weight is defined as --ant-font-weight-strong but the style uses
--ant-font-weight, causing the font weight not to apply. To fix this, rename the
CSS variable to --ant-font-weight to match the usage in
.ant-select-selection-item or update the consumer to use
--ant-font-weight-strong consistently, ensuring the font weight is correctly
applied.

Comment on lines +1 to +24
import { getTagStyle } from '@/utils/style';
import convertCssColorNameToHex from 'convert-css-color-name-to-hex';
import { Tag, Tooltip, TooltipProps } from 'antd';
import React from 'react';
import { Icon } from '../readOnlyDisplayFormItem';
function ReflistTag({ value, tooltip, color, icon, showIcon, tagStyle, solidColor, showItemName, label, placement = 'right' }) {

const memoizedColor = solidColor
? convertCssColorNameToHex(color ?? '')
: color?.toLowerCase();

return (
<Tooltip title={tooltip} placement={placement as TooltipProps['placement']} style={{ cursor: 'pointer' }}>
<Tag
key={value}
color={memoizedColor}
icon={(icon && showIcon) && <Icon type={icon} />}
style={getTagStyle(tagStyle, !!color)}
>{showItemName && label}</Tag>
</Tooltip>
);
};

export default ReflistTag; No newline at end of file
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.

🛠️ Refactor suggestion

Add TypeScript interface for component props to improve type safety.

The component lacks TypeScript typing, which reduces type safety and IDE support. As this is a reusable component used across multiple files, proper typing is essential.

Add TypeScript interface and type the component:

 import { getTagStyle } from '@/utils/style';
 import convertCssColorNameToHex from 'convert-css-color-name-to-hex';
 import { Tag, Tooltip, TooltipProps } from 'antd';
-import React from 'react';
+import React, { FC, ReactNode } from 'react';
 import { Icon } from '../readOnlyDisplayFormItem';
+
+interface IReflistTagProps {
+  value: string | number;
+  tooltip?: string;
+  color?: string;
+  icon?: string;
+  showIcon?: boolean;
+  tagStyle?: React.CSSProperties;
+  solidColor?: boolean;
+  showItemName?: boolean;
+  label?: ReactNode;
+  placement?: TooltipProps['placement'];
+}
+
-function ReflistTag({ value, tooltip, color, icon, showIcon, tagStyle, solidColor, showItemName, label, placement = 'right' }) {
+const ReflistTag: FC<IReflistTagProps> = ({ 
+  value, 
+  tooltip, 
+  color, 
+  icon, 
+  showIcon, 
+  tagStyle, 
+  solidColor, 
+  showItemName, 
+  label, 
+  placement = 'right' 
+}) => {
 
     const memoizedColor = solidColor
         ? convertCssColorNameToHex(color ?? '')
         : color?.toLowerCase();

     return (
         <Tooltip title={tooltip} placement={placement as TooltipProps['placement']} style={{ cursor: 'pointer' }}>
             <Tag
                 key={value}
                 color={memoizedColor}
                 icon={(icon && showIcon) && <Icon type={icon} />}
                 style={getTagStyle(tagStyle, !!color)}
             >{showItemName && label}</Tag>
         </Tooltip>
     );
 };

 export default ReflistTag;
📝 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 { getTagStyle } from '@/utils/style';
import convertCssColorNameToHex from 'convert-css-color-name-to-hex';
import { Tag, Tooltip, TooltipProps } from 'antd';
import React from 'react';
import { Icon } from '../readOnlyDisplayFormItem';
function ReflistTag({ value, tooltip, color, icon, showIcon, tagStyle, solidColor, showItemName, label, placement = 'right' }) {
const memoizedColor = solidColor
? convertCssColorNameToHex(color ?? '')
: color?.toLowerCase();
return (
<Tooltip title={tooltip} placement={placement as TooltipProps['placement']} style={{ cursor: 'pointer' }}>
<Tag
key={value}
color={memoizedColor}
icon={(icon && showIcon) && <Icon type={icon} />}
style={getTagStyle(tagStyle, !!color)}
>{showItemName && label}</Tag>
</Tooltip>
);
};
export default ReflistTag;
import { getTagStyle } from '@/utils/style';
import convertCssColorNameToHex from 'convert-css-color-name-to-hex';
import { Tag, Tooltip, TooltipProps } from 'antd';
import React, { FC, ReactNode } from 'react';
import { Icon } from '../readOnlyDisplayFormItem';
interface IReflistTagProps {
value: string | number;
tooltip?: string;
color?: string;
icon?: string;
showIcon?: boolean;
tagStyle?: React.CSSProperties;
solidColor?: boolean;
showItemName?: boolean;
label?: ReactNode;
placement?: TooltipProps['placement'];
}
const ReflistTag: FC<IReflistTagProps> = ({
value,
tooltip,
color,
icon,
showIcon,
tagStyle,
solidColor,
showItemName,
label,
placement = 'right',
}) => {
const memoizedColor = solidColor
? convertCssColorNameToHex(color ?? '')
: color?.toLowerCase();
return (
<Tooltip title={tooltip} placement={placement as TooltipProps['placement']} style={{ cursor: 'pointer' }}>
<Tag
key={value}
color={memoizedColor}
icon={(icon && showIcon) && <Icon type={icon} />}
style={getTagStyle(tagStyle, !!color)}
>
{showItemName && label}
</Tag>
</Tooltip>
);
};
export default ReflistTag;
🤖 Prompt for AI Agents
In shesha-reactjs/src/components/refListDropDown/reflistTag.tsx lines 1 to 24,
the ReflistTag component lacks TypeScript typings for its props, reducing type
safety and IDE support. Define a TypeScript interface describing all expected
props with their types, including optional and defaulted ones, then update the
component function signature to use this interface for its props parameter.

Comment on lines +226 to +237
return <ReflistTag
showIcon={showIcon}
showItemName={showItemName}
tagStyle={tagStyle}
solidColor={solidColor}
label={option?.label}
value={props.value}
key={props.value}
tooltip={"multiple"}
color={option?.color}
icon={option?.icon && showIcon && <Icon type={option?.icon} />}
style={getTagStyle(tagStyle, !!option?.color && solidColor)}
>{showItemName && option?.label}</Tag>;
></ReflistTag>;
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.

⚠️ Potential issue

Fix hardcoded tooltip and inconsistent Icon handling.

Two issues:

  1. The hardcoded tooltip "multiple" doesn't provide useful information
  2. Icon is being wrapped in Icon component here, but ReflistTag already handles this internally
                     return <ReflistTag
                         showIcon={showIcon}
                         showItemName={showItemName}
                         tagStyle={tagStyle}
                         solidColor={solidColor}
                         label={option?.label}
                         value={props.value}
                         key={props.value}
-                        tooltip={"multiple"}
+                        tooltip={option?.description}
                         color={option?.color}
-                        icon={option?.icon && showIcon && <Icon type={option?.icon} />}
+                        icon={option?.icon}
                     ></ReflistTag>;
📝 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
return <ReflistTag
showIcon={showIcon}
showItemName={showItemName}
tagStyle={tagStyle}
solidColor={solidColor}
label={option?.label}
value={props.value}
key={props.value}
tooltip={"multiple"}
color={option?.color}
icon={option?.icon && showIcon && <Icon type={option?.icon} />}
style={getTagStyle(tagStyle, !!option?.color && solidColor)}
>{showItemName && option?.label}</Tag>;
></ReflistTag>;
return <ReflistTag
showIcon={showIcon}
showItemName={showItemName}
tagStyle={tagStyle}
solidColor={solidColor}
label={option?.label}
value={props.value}
key={props.value}
tooltip={option?.description}
color={option?.color}
icon={option?.icon}
></ReflistTag>;
🤖 Prompt for AI Agents
In shesha-reactjs/src/components/dropdown/dropdown.tsx around lines 226 to 237,
the tooltip prop is hardcoded to "multiple" which is not informative; replace it
with a dynamic or contextually relevant value. Also, remove the wrapping of
option?.icon inside the Icon component since ReflistTag already manages icon
rendering internally, so just pass the icon data directly without wrapping.

@czwe-01 czwe-01 requested a review from James-Baloyi June 12, 2025 15:16
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