-
Notifications
You must be signed in to change notification settings - Fork 571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tooltip support for TableView actions #5142
Conversation
WalkthroughThe changes in this pull request involve modifications to the Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this 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
🧹 Outside diff range and nitpick comments (1)
app/packages/core/src/plugins/SchemaIO/components/ActionsMenu.tsx (1)
111-117
: Remove unnecessary space character and consider styling implications
- The space character in
</span>{" "}
appears unnecessary- Using a span wrapper might affect styling in some edge cases, especially with flex layouts
Consider this cleaner implementation:
return tooltip ? ( <Tooltip title={tooltip}> - <span>{content}</span>{" "} + <span>{content}</span> </Tooltip> ) : ( content );Also, consider adding a comment explaining why we can't directly wrap the Button/MenuItem with Tooltip for future maintainers.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (3)
app/packages/core/src/plugins/SchemaIO/components/ActionsMenu.tsx
(5 hunks)app/packages/core/src/plugins/SchemaIO/components/TableView.tsx
(1 hunks)fiftyone/operators/types.py
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
app/packages/core/src/plugins/SchemaIO/components/ActionsMenu.tsx (1)
Pattern **/*.{ts,tsx}
: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.
app/packages/core/src/plugins/SchemaIO/components/TableView.tsx (1)
Pattern **/*.{ts,tsx}
: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.
🔇 Additional comments (7)
app/packages/core/src/plugins/SchemaIO/components/ActionsMenu.tsx (5)
12-12
: LGTM: Import statement follows existing patterns
The Tooltip import is correctly placed within the Material-UI imports group.
77-78
: LGTM: Clean props destructuring
The tooltip prop is correctly added to the destructuring pattern.
92-109
: LGTM: Clean content extraction
The content variable extraction improves code readability and reusability.
138-138
: LGTM: Type definition matches MUI expectations
The tooltip type definition as string | null
aligns with Material-UI's Tooltip component expectations.
24-24
: Verify the alignment change impact
The alignment change from "flex-end" to "flex-start" will shift inline actions from right to left alignment. Please confirm this is the intended behavior with the new tooltip support.
✅ Verification successful
Let me gather more context about the ActionsMenu component to understand the alignment change better.
Alignment change is consistent with component's usage
The alignment change from "flex-end" to "flex-start" in ActionsMenu is appropriate because:
- The component is used within table cells (TableView) where left alignment is more natural for content readability
- Other similar Stack components in the codebase either use "space-between" for full-width layouts or don't specify justification
- The component renders a row of action buttons with consistent spacing (0.5), and left alignment provides a predictable starting point for these actions
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for other Stack components with similar usage to ensure consistency
rg -A 2 "Stack.*direction=\"row\".*justify"
Length of output: 2204
Script:
#!/bin/bash
# Search for the ActionsMenu component implementation and its usage
rg -A 5 "ActionsMenu"
# Also search for any test files related to ActionsMenu
fd "ActionsMenu.*test"
Length of output: 1930
fiftyone/operators/types.py (2)
1819-1819
: LGTM: Clean addition of tooltip parameter documentation.
The tooltip parameter is properly documented in the Action class docstring, maintaining consistent documentation standards.
1855-1857
: LGTM: Well-implemented tooltip support in add_row_action method.
The method signature and implementation are updated correctly to support tooltips while maintaining backward compatibility.
sx: { ...headingCellBaseStyles, textAlign: "left" }, | ||
})} | ||
width={`${max_inline_actions * 5}%`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Fix inconsistent alignment and improve width calculation
There are two issues with the actions column:
- The header is left-aligned but the content in table cells (line 198) is right-aligned, creating an inconsistent visual appearance.
- The width calculation (
max_inline_actions * 5%
) might be too narrow for action buttons with text, especially with the defaultmax_inline_actions=1
.
Consider these improvements:
<TableCell
{...getComponentProps(props, "tableHeadCell", {
- sx: { ...headingCellBaseStyles, textAlign: "left" },
+ sx: { ...headingCellBaseStyles, textAlign: "right" },
})}
- width={`${max_inline_actions * 5}%`}
+ width={`${Math.max(max_inline_actions * 8, 10)}%`}
onClick={() => {
handleCellClick(-1, -1);
}}
>
This change:
- Aligns the header with the content
- Ensures a minimum width of 10% and allocates 8% per action instead of 5%
📝 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.
sx: { ...headingCellBaseStyles, textAlign: "left" }, | |
})} | |
width={`${max_inline_actions * 5}%`} | |
sx: { ...headingCellBaseStyles, textAlign: "right" }, | |
})} | |
width={`${Math.max(max_inline_actions * 8, 10)}%`} |
* Added tooltip to actions * Added tooltip to Python obj * Left align actions column and fix spacing --------- Co-authored-by: minhtuevo <minhtuev@voxel51.com> Co-authored-by: CamronStaley <camron_staley@live.com>
What changes are proposed in this pull request?
How is this patch tested? If it is not, please explain why.
Release Notes
Is this a user-facing change that should be mentioned in the release notes?
notes for FiftyOne users.
(Details in 1-2 sentences. You can just refer to another PR with a description
if this PR is part of a larger change.)
What areas of FiftyOne does this PR affect?
fiftyone
Python library changesSummary by CodeRabbit
New Features
ActionsMenu
andTableView
components, enhancing user experience by providing additional context.TableView
for improved presentation.Bug Fixes
TableView
.