-
Notifications
You must be signed in to change notification settings - Fork 594
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
fixes and enhancements for modal spaces #4771
Conversation
WalkthroughThe changes involve updates to several components, focusing on CSS styling adjustments, modal handling logic, and state management enhancements. Key modifications include the removal of redundant CSS rules in the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Modal
participant Sidebar
participant AddPanelButton
User->>Modal: Open Modal
Modal->>Sidebar: Check modal state
Sidebar->>Modal: Apply conditional styles
User->>AddPanelButton: Interact with button
AddPanelButton->>Modal: Check modal state
AddPanelButton->>User: Update UI based on modal state
Poem
Recent review detailsConfiguration used: .coderabbit.yaml Files selected for processing (16)
Files skipped from review as they are similar to previous changes (14)
Additional context usedPath-based instructions (2)
Additional comments not posted (9)
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: 0
Outside diff range, codebase verification and nitpick comments (1)
app/packages/core/src/components/Sidebar/Sidebar.tsx (1)
736-736
: Conditional styling based on modal prop is well-implemented.The conditional styling logic correctly adjusts the sidebar's maximum height based on the
modal
prop. However, the specific value "28px" used in the calculation seems arbitrary without context. It would be beneficial to add a comment explaining why this particular value is used, to aid future maintainability.
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (5)
- app/packages/core/src/components/Actions/ActionsRow.tsx (1 hunks)
- app/packages/core/src/components/Modal/Modal.tsx (1 hunks)
- app/packages/core/src/components/Sidebar/Sidebar.tsx (1 hunks)
- app/packages/spaces/src/components/AddPanelButton.tsx (2 hunks)
- app/packages/spaces/src/components/StyledElements.tsx (1 hunks)
Additional context used
Path-based instructions (5)
app/packages/spaces/src/components/StyledElements.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/spaces/src/components/AddPanelButton.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/components/Modal/Modal.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/components/Actions/ActionsRow.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/components/Sidebar/Sidebar.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 not posted (9)
app/packages/spaces/src/components/StyledElements.tsx (1)
20-20
: Approve the height adjustment with a suggestion for consistency check.The change from
"2em"
to"32px"
for modal instances ofPanelTabs
is approved as it ensures consistent sizing across different environments. However, it's important to ensure that this change aligns with the overall styling strategy of the project, especially regarding the use of absolute (px
) versus relative (em
) units.Consider verifying the impact of this change on the overall layout, especially if other components use relative sizing. This can be done by visually inspecting the UI in different modal contexts or by setting up a review session with the design team.
app/packages/spaces/src/components/AddPanelButton.tsx (4)
5-6
: Approved: Import statements and React hooks usage.The import statements are appropriate and the use of React hooks (
useState
,useCallback
,useMemo
,useRef
) aligns with React best practices.
15-15
: Approved: Efficient use of Recoil state management.Using
useRecoilValue
to accessisModalActive
directly is a streamlined and efficient approach for managing state in React components.
16-24
: Approved: Refactoring ofpanelsPredicate
function.The use of
useCallback
withisModalActive
as a dependency is a good practice for optimizing performance. The logic is clear and efficiently handles the modal state conditions.
15-15
: Approved: Component logic and rendering.The overall logic for handling the popout menu and filtering panels is well-implemented. The conditional rendering based on the
open
state and the availability of panels is efficiently handled.Also applies to: 24-24
app/packages/core/src/components/Modal/Modal.tsx (1)
188-188
: Approved: Dynamic modal height adjustment.The change to dynamically adjust the modal height using
calc(100% - 70px)
enhances the flexibility of the modal's presentation across different devices. It's important to ensure that this change is tested across various screen sizes to maintain a consistent user experience.Please verify the modal's appearance on different screen sizes to ensure consistent UX.
app/packages/core/src/components/Actions/ActionsRow.tsx (3)
Line range hint
1037-1045
: Styles are appropriate for functionality.The styles applied to
DraggableHandleIconContainer
are minimal and appropriate for its functionality as a draggable handle. The cursor behavior and alignment are well-defined.
Line range hint
1021-1035
: Verify visual consistency and responsiveness.The significant reduction in CSS styling rules within
ModalActionsRowContainer
could impact the visual presentation and layout. Please ensure that the component remains visually consistent and responsive across different devices and resolutions.
Line range hint
1047-1075
: Approve implementation and suggest verification.The
ModalActionsRow
component is well-implemented with its use ofDraggable
for x-axis movement, enhancing user interaction. However, ensure that all sub-components integrate seamlessly and function as expected within this draggable context.
da37796
to
36df1cf
Compare
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: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (6)
- app/packages/core/src/components/Actions/ActionsRow.tsx (1 hunks)
- app/packages/core/src/components/Modal/Modal.tsx (1 hunks)
- app/packages/core/src/components/Sidebar/Sidebar.tsx (1 hunks)
- app/packages/core/src/plugins/modal-sample.tsx (2 hunks)
- app/packages/spaces/src/components/AddPanelButton.tsx (2 hunks)
- app/packages/spaces/src/components/StyledElements.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (5)
- app/packages/core/src/components/Actions/ActionsRow.tsx
- app/packages/core/src/components/Modal/Modal.tsx
- app/packages/core/src/components/Sidebar/Sidebar.tsx
- app/packages/spaces/src/components/AddPanelButton.tsx
- app/packages/spaces/src/components/StyledElements.tsx
Additional context used
Path-based instructions (1)
app/packages/core/src/plugins/modal-sample.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 not posted (2)
app/packages/core/src/plugins/modal-sample.tsx (2)
5-5
: LGTM!The import statement for the
ViewInAr
icon is correctly placed at the top of the file and follows the proper syntax.
17-17
: LGTM!The
Icon
property is correctly updated to use the importedViewInAr
icon. This change can improve the user experience by providing a specific visual representation for the modal sample plugin.
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.
LGTM! 🚀
For subsequent PRs, could we also include more detailed descriptions of the fixes and enhancements?
36df1cf
to
565d01e
Compare
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
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (16)
- app/packages/core/src/components/Actions/ActionsRow.tsx (2 hunks)
- app/packages/core/src/components/Modal/Modal.tsx (5 hunks)
- app/packages/core/src/components/Modal/ModalNavigation.tsx (1 hunks)
- app/packages/core/src/components/Modal/ModalSamplePlugin.tsx (4 hunks)
- app/packages/core/src/components/Sidebar/Sidebar.tsx (1 hunks)
- app/packages/core/src/plugins/SchemaIO/components/DashboardView.tsx (3 hunks)
- app/packages/core/src/plugins/modal-sample.tsx (2 hunks)
- app/packages/operators/src/built-in-operators.ts (4 hunks)
- app/packages/operators/src/useCustomPanelHooks.ts (3 hunks)
- app/packages/spaces/src/components/AddPanelButton.tsx (2 hunks)
- app/packages/spaces/src/components/Panel.tsx (2 hunks)
- app/packages/spaces/src/components/StyledElements.tsx (1 hunks)
- app/packages/spaces/src/contexts.ts (1 hunks)
- app/packages/spaces/src/hooks.ts (7 hunks)
- app/packages/spaces/src/state.ts (2 hunks)
- app/packages/spaces/src/types.ts (1 hunks)
Files skipped from review due to trivial changes (3)
- app/packages/core/src/components/Modal/ModalNavigation.tsx
- app/packages/core/src/plugins/SchemaIO/components/DashboardView.tsx
- app/packages/core/src/plugins/modal-sample.tsx
Files skipped from review as they are similar to previous changes (4)
- app/packages/core/src/components/Actions/ActionsRow.tsx
- app/packages/core/src/components/Modal/Modal.tsx
- app/packages/core/src/components/Sidebar/Sidebar.tsx
- app/packages/spaces/src/components/AddPanelButton.tsx
Additional context used
Path-based instructions (9)
app/packages/spaces/src/contexts.ts (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/spaces/src/components/StyledElements.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/spaces/src/types.ts (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/spaces/src/components/Panel.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/components/Modal/ModalSamplePlugin.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/spaces/src/state.ts (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/operators/src/useCustomPanelHooks.ts (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/spaces/src/hooks.ts (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/operators/src/built-in-operators.ts (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 not posted (30)
app/packages/spaces/src/contexts.ts (2)
4-4
: LGTM!The code change is approved. The
PanelContext
now uses the updatedPanelContextType
type, which includes an additional optional property,scope
, of typestring
. This change enhances the context's functionality by allowing it to carry more information.
6-6
: LGTM!The code change is approved. The new
PanelContextType
type definition includes an additional optional property,scope
, of typestring
, alongside the existingnode
property of typeSpaceNode
. This change improves the data structure's capability, enabling more versatile usage of the context throughout the application.app/packages/spaces/src/components/StyledElements.tsx (3)
15-19
: LGTM!The code change is approved. The removal of the conditional logic associated with the
$isModal
prop from thePanelTabs
styled component streamlines the component by eliminating conditional styling, potentially leading to a more consistent layout across different usages. The change adheres to the best practices in React and styled-components.
21-21
: LGTM!The code change is approved. The removal of the conditional logic associated with the
$isModalPanel
prop from theStyledPanel
styled component streamlines the component by eliminating conditional styling, potentially leading to a more consistent layout across different usages. The change adheres to the best practices in React and styled-components.
23-23
: LGTM!The code change is approved. Setting the
height
of theStyledPanel
component tocalc(100% - 28px)
streamlines the component by eliminating conditional styling, potentially leading to a more consistent layout across different usages. The change adheres to the best practices in React and styled-components.app/packages/spaces/src/types.ts (1)
68-68
: LGTM!The code change is approved. The addition of the optional
scope
property of typestring
to thePanelStateParameter
type enhances its flexibility, allowing it to accommodate additional contextual information related to the panel's state. The change extends the functionality of the type while ensuring backward compatibility.app/packages/spaces/src/components/Panel.tsx (4)
3-3
: LGTM!The code change is approved.
11-12
: LGTM!The code changes are approved.
20-25
: LGTM!The code changes are approved.
52-52
: LGTM!The code change is approved.
app/packages/core/src/components/Modal/ModalSamplePlugin.tsx (4)
7-7
: LGTM!The code change is approved.
31-33
: LGTM!The code changes are approved.
80-82
: LGTM!The code changes are approved.
92-100
: LGTM!The code changes are approved.
app/packages/spaces/src/state.ts (4)
61-62
: LGTM!The code changes are approved.
68-69
: LGTM!The code changes are approved.
128-131
: LGTM!The code changes are approved.
133-136
: LGTM!The code changes are approved.
app/packages/operators/src/useCustomPanelHooks.ts (3)
5-5
: LGTM!Repositioning the import statement is a minor change that improves code organization without affecting functionality.
11-11
: LGTM!Importing the
useCurrentSample
hook is a good change. It allows retrieving the current sample more directly, improving clarity and encapsulation by reducing the dependency on the execution context for sample retrieval.
77-77
: LGTM!Utilizing the
currentSample
variable derived from the newuseCurrentSample
hook, instead of accessing it through the execution context, is a good change. It improves clarity and encapsulation by reducing the dependency on the context object for sample retrieval. The change is consistently applied across both line 77 and 123.Also applies to: 123-123
app/packages/spaces/src/hooks.ts (8)
26-26
: LGTM!Importing the
panelIdToScopeAtom
is a good addition. It suggests that the concept of scope is being incorporated into the panel state management, enabling more granular control over the panel state by associating a scope with each panel ID.
249-250
: LGTM!Adding the optional
scope
parameter tousePanelState
and using it in the state selector is a good enhancement. It allows for more contextualized state management by incorporating the concept of scope. TheuseScope
function centralizes the logic for determining the scope based on the provided argument or the current panel context, ensuring consistency. These changes enhance the flexibility and functionality of the panel state management system.Also applies to: 252-252, 256-256
263-264
: LGTM!The updates to
useSetPanelStateById
are consistent with the changes made tousePanelState
. The function now accepts an optionalscope
parameter and uses theuseScope
function to determine the appropriate scope. It also retrieves the scope associated with the panel ID using thepanelIdToScope
atom. The state selectorpanelStateSelector
now passes the computed scope. These changes allow for setting the panel state based on the appropriate scope, enhancing the contextualized state management capabilities.Also applies to: 268-269, 271-271, 274-277
305-306
: LGTM!The updates to
usePanelStateCallback
are consistent with the changes made to other functions. It now accepts an optionalscope
parameter and uses theuseScope
function to determine the appropriate scope. The state selectorpanelStateSelector
passes the scope derived fromuseScope
, allowing the callback to access the panel state based on the provided or determined scope. These changes enhance the contextualized state management capabilities.Also applies to: 308-308, 315-315
325-326
: LGTM!The updates to
usePanelStateByIdCallback
are consistent with the changes made to other functions. It now accepts an optionalscope
parameter and uses theuseScope
function to determine the appropriate scope. The state selectorpanelStateSelector
passes the scope derived fromuseScope
, allowing the callback to access the panel state based on the provided or determined scope. These changes enhance the contextualized state management capabilities.Also applies to: 328-328, 333-333
346-347
: LGTM!The updates to
usePanelStateLazy
are consistent with the changes made to other functions. It now accepts an optionalscope
parameter and uses theuseScope
function to determine the appropriate scope. The state selectorpanelStateSelector
passes the scope derived fromuseScope
, allowing lazy access to the panel state based on the provided or determined scope. These changes enhance the contextualized state management capabilities.Also applies to: 354-356
371-372
: LGTM!The updates to
usePanelStatePartial
are consistent with the changes made to other functions. It now accepts an optionalscope
parameter and uses theuseScope
function to determine the appropriate scope. The state selectorpanelStatePartialSelector
passes the scope derived fromuseScope
, allowing access to a partial panel state based on the provided or determined scope. These changes enhance the contextualized state management capabilities.Also applies to: 374-374, 378-378
457-462
: LGTM!The introduction of the
useScope
utility function is a good addition. It centralizes the logic for determining the scope by checking if thescope
parameter is a string and returning it; otherwise, it retrieves the scope from the panel context. This function provides a consistent way to determine the appropriate scope based on the provided argument or the current panel context. It is used across multiple functions to ensure consistency in scope determination, enhancing the maintainability and readability of the code.app/packages/operators/src/built-in-operators.ts (1)
14-14
: Verify the usage ofsetPathUserUnchanged
.The new import statement for
setPathUserUnchanged
suggests a
app/packages/spaces/src/state.ts
Outdated
}); | ||
|
||
function getStateAtom(local?: boolean, scope?: string) { | ||
console.log(">>> scope: ", scope); |
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 the console log statement.
The console log statement is likely used for debugging purposes and should be removed before merging the code.
Apply this diff to remove the console log statement:
-console.log(">>> scope: ", scope);
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.
console.log(">>> scope: ", scope); |
565d01e
to
aa52d50
Compare
aa52d50
to
fca64f6
Compare
E2E failure is unrelated and will be addressed as follow-up. Merging. |
What changes are proposed in this pull request?
fixes and enhancements for modal spaces
How is this patch tested? If it is not, please explain why.
Using spaces in sample modal
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
Style