-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[WEB-2803] fix: Timeline chart half block dragging #6135
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
Conversation
WalkthroughThe changes in this pull request involve updates to the Changes
Possibly related PRs
Suggested labels
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
CodeRabbit Configuration File (
|
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 and nitpick comments (1)
web/ce/store/timeline/base-timeline.store.ts (1)
278-301: LGTM: Enhanced half-block update logic with improved controlThe changes effectively handle half-block updates by conditionally updating dates based on the
shouldUpdateHalfBlockparameter. The singleupdatePayloadobject approach improves code maintainability.Minor documentation improvement suggested:
Apply this diff to enhance the method documentation:
/** * returns updates dates of blocks post drag. * @param id - * @param shouldUpdateHalfBlock if is a half block then update the incomplete block only if this is true + * @param shouldUpdateHalfBlock When true, allows updating the missing date (start_date or target_date) during half-block drag * @returns */
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
web/ce/store/timeline/base-timeline.store.ts(2 hunks)web/core/components/gantt-chart/helpers/blockResizables/use-gantt-resizable.ts(3 hunks)web/core/components/gantt-chart/views/helpers.ts(1 hunks)
🔇 Additional comments (3)
web/core/components/gantt-chart/views/helpers.ts (1)
102-102: LGTM: Improved scroll position calculation for half blocks
The adjustment to include chartData.data.dayWidth in the scroll position calculation when itemStartDate is not available ensures accurate positioning during half-block dragging.
web/core/components/gantt-chart/helpers/blockResizables/use-gantt-resizable.ts (2)
78-79: LGTM: Improved half-block resizing logic
The changes correctly handle half-block resizing by:
- Reverting to default width when target_date is missing during left-handle drag
- Reverting to default width and adjusting marginLeft when start_date is missing during right-handle drag
Also applies to: 83-90
124-124:
Fix incomplete error handling
The setToast function is referenced but not invoked, which means errors during block updates won't be displayed to the user.
Apply this diff to fix the error handling:
- setToast;
+ setToast({
+ message: "Error updating block position",
+ type: "error",
+ });Likely invalid or redundant comment.
| getUpdatedPositionAfterDrag: (id: string, ignoreDependencies?: boolean) => IBlockUpdateDependencyData[]; | ||
| getUpdatedPositionAfterDrag: ( | ||
| id: string, | ||
| shouldUpdateHalfBlock: boolean, |
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.
Do we need this flag?
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.
yeah, to make sure we only update the block's missing date, when the missing side is dragged. Either i pass down the side that is being dragged or the flag.
This PR fixes half block dragging to have better UX and only update the incomplete block when required.
Screen.Recording.2024-12-02.at.7.03.57.PM.mov
Summary by CodeRabbit
New Features
Bug Fixes
Documentation