-
Notifications
You must be signed in to change notification settings - Fork 589
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) #5145
Conversation
* Added tooltip to actions * Added tooltip to Python obj * Left align actions column and fix spacing --------- Co-authored-by: minhtuevo <[email protected]> Co-authored-by: CamronStaley <[email protected]>
WalkthroughThe pull request introduces enhancements 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 (3)
app/packages/core/src/plugins/SchemaIO/components/ActionsMenu.tsx (2)
111-115
: Consider using styled component for tooltip wrapperWhile using a
span
wrapper is necessary to avoid DOM nesting issues with Material-UI Tooltip, consider creating a styled component for better type safety and potential reuse.Example implementation:
const TooltipWrapper = styled('span')({ display: 'inline-block' }); // Usage <Tooltip title={tooltip}> <TooltipWrapper>{content}</TooltipWrapper> </Tooltip>
138-138
: Consider using optional property for tooltipInstead of using
string | null
, consider making tooltip an optional property using?:
syntax for better TypeScript idioms.Apply this diff:
- tooltip: string | null; + tooltip?: string;app/packages/core/src/plugins/SchemaIO/components/TableView.tsx (1)
144-146
: Consider improving the responsive layout handlingWhile the left alignment is good, the current width calculation (
${max_inline_actions * 5}%
) might cause layout issues:
- On small screens, the actions column might become too narrow
- With many inline actions, the column could become disproportionately wide
Consider this more responsive approach:
-width={`${max_inline_actions * 5}%`} +sx={{ + ...headingCellBaseStyles, + textAlign: "left", + width: { + xs: "auto", + sm: `clamp(100px, ${max_inline_actions * 5}%, 200px)`, + } +}}This ensures:
- A minimum width for usability
- A maximum width to prevent layout disruption
- Responsive behavior on different screen sizes
📜 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 (6)
app/packages/core/src/plugins/SchemaIO/components/ActionsMenu.tsx (3)
12-12
: LGTM: Tooltip import is correctly placed
The Tooltip import from @mui/material is properly grouped with other Material-UI imports.
24-24
: LGTM: Consistent layout alignment
The change to left-align actions (justifyContent="flex-start"
) improves visual consistency and matches common UI patterns.
77-78
: Verify tooltip accessibility and implementation
Let's ensure proper tooltip implementation across the codebase.
Also applies to: 111-115
app/packages/core/src/plugins/SchemaIO/components/TableView.tsx (1)
144-146
: Verify tooltip implementation for actions
The PR objectives mention adding tooltip support for TableView actions, but the tooltip implementation is not visible in these changes.
Let's verify the tooltip implementation:
✅ Verification successful
Tooltip implementation is correctly in place
The tooltip support is properly implemented in the ActionsMenu component. The component accepts a tooltip
prop in its action items (ActionPropsType) and renders it using MUI's Tooltip component. The TableView passes row actions to ActionsMenu, which can include tooltips through the row_actions
configuration.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for tooltip-related code in the codebase
# Search for tooltip-related imports and usage
echo "Searching for tooltip-related code..."
rg -i "tooltip" --type ts --type tsx
# Check ActionsMenu component for tooltip implementation
echo "Checking ActionsMenu component..."
fd -e tsx -e ts "ActionsMenu" -x cat {}
Length of output: 3563
Script:
#!/bin/bash
# Check if the tooltip property is being passed to ActionsMenu in TableView
rg -A 5 -B 5 "ActionsMenu" app/packages/core/src/plugins/SchemaIO/components/TableView.tsx
# Check if there are any recent changes related to tooltip in the PR
git diff origin/main -- app/packages/core/src/plugins/SchemaIO/components/TableView.tsx | rg -i "tooltip"
Length of output: 1093
Script:
#!/bin/bash
# Check how row actions are constructed in TableView
rg -A 10 "getRowActions" app/packages/core/src/plugins/SchemaIO/components/TableView.tsx
# Check if tooltip is being passed in the row actions configuration
rg "tooltip.*actions" app/packages/core/src/plugins/SchemaIO/components/TableView.tsx
Length of output: 1544
fiftyone/operators/types.py (2)
1827-1827
: LGTM! Clear documentation for the tooltip parameter.
The tooltip parameter is well-documented and follows the existing docstring style.
1863-1865
: LGTM! Clean implementation of tooltip support.
The tooltip parameter is properly added to the method signature and correctly passed to the Action constructor. This change aligns with the PR objective of adding tooltip support for TableView actions.
|
||
return tooltip ? ( | ||
<Tooltip title={tooltip}> | ||
<span>{content}</span>{" "} |
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.
Remove extra whitespace character
The extra space after the closing span tag (</span>{" "}
) could cause unwanted layout spacing.
Apply this diff to fix the whitespace:
- <span>{content}</span>{" "}
+ <span>{content}</span>
📝 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.
<span>{content}</span>{" "} | |
<span>{content}</span> |
Summary by CodeRabbit
ActionsMenu
andTableView
components to enhance user guidance.ActionsMenu
.TableView
for improved user interaction and clarity.