-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
feat: Drag & drop for re-ordering event types #15495
feat: Drag & drop for re-ordering event types #15495
Conversation
@Amit91848 is attempting to deploy a commit to the cal Team on Vercel. A member of the Team first needs to authorize it. |
Graphite Automations"Add community label" took an action on this PR • (06/19/24)1 label was added to this PR based on Keith Williams's automation. "Add foundation team as reviewer" took an action on this PR • (06/19/24)1 reviewer was added to this PR based on Keith Williams's automation. "Add consumer team as reviewer" took an action on this PR • (06/19/24)1 reviewer was added to this PR based on Keith Williams's automation. |
No dependency changes detected. Learn more about Socket for GitHub ↗︎ 👍 No dependency changes detected in pull request |
async function moveEventType(index: number, increment: number, enableAnimation: boolean) { | ||
enableAnimations(enableAnimation); |
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.
Recording.2024-06-19.201752.mp4
Only use useAutoAnimate when using arrow buttons or else causes double animations as react beautiful dnd has its own drop animation
} | ||
|
||
newList.splice(index, 1); | ||
|
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.
Initially thought this was causing animation issues, but isn't the case. lmk if this should be reverted
@@ -6,6 +6,7 @@ import Link from "next/link"; | |||
import { usePathname, useRouter } from "next/navigation"; | |||
import type { FC } from "react"; | |||
import { memo, useEffect, useState } from "react"; | |||
import { DragDropContext, Droppable, Draggable } from "react-beautiful-dnd"; |
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.
@Amit91848 the unpacked size of this package is 1.39mb. I feel like that's pretty big but I wanted to get other people's opinions.
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 makes sense. I looked up a few more options lmk what do you think
- Pragmatic Drag and Drop from the same guys as React Beautiful Dnd, used at Atlassian for trello jira etc. Unpacked is 407kb
- Dnd Kit Unpacked is slightly smaller at 1.05 Mb, but very widely used.
- Form kit Unpacked is 516kb but it is only 6-7 months old so not sure how stable it is.
- I noticed framer-motion is already being used, it has something similar Reorder .
I think we had another PR opened for this too and we agreed that for drag and drop, we don't want to introduce another package for this. Can you confirm @PeerRich @sean-brydon |
Yeah lets try not to use a new package for this. Not a massive important feature so lets save them KBs! If we can get this working with framer motion it'd be great - i understand it has its limitations |
apps/web/package.json
Outdated
@@ -106,6 +106,7 @@ | |||
"qrcode": "^1.5.1", | |||
"raw-body": "^2.5.1", | |||
"react": "^18.2.0", | |||
"react-beautiful-dnd": "^13.1.1", |
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.
are you using this package anywhere?
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.
No I am trying to make it work using framer-motions Reorder, this is still a WIP will remove it soon. Making it draft till then
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.
Event.Types._.Cal.com.and.14.more.pages.-.Personal.-.Microsoft.Edge.2024-07-04.23-25-12.mp4
Apart from this, currently there is a lot of functionality related to event types that is broken. You need to refresh the page in order to see the results. For example, after deleting an event type or changing the event type's title or description, you need to refresh the page to see the results. The 'Show on Profile' toggle button is not working.
@Amit91848 pls fix
…ag_and_drop_reordering_event_type
This an issue in the current version of framer-motion library, updating it should fix this, checkout #15495 (comment)
Fixed the sync issue between the two lists, this should work now. |
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.
Going to close this because of the low prio and issues that have been found. Not currently worth the effort to build this. |
What does this PR do?
Implemented Drag and Drop using
React Beautiful DnD libraryFramer motion's Reorder ComponentRecording.2024-06-20.173734.mp4
Mandatory Tasks (DO NOT REMOVE)