⚠️ Feat(POC): Trigger event actions on intuitive mouse events#253
Closed
tyler-dane wants to merge 22 commits intomainfrom
Closed
⚠️ Feat(POC): Trigger event actions on intuitive mouse events#253tyler-dane wants to merge 22 commits intomainfrom
tyler-dane wants to merge 22 commits intomainfrom
Conversation
using floating-ui's API rather than managing ourselves
…with Schema_Event in Sidebar components and hooks
works: - click and then move to start resizing - empty click closes open form broke: repeating the above and lots of other cases
…position handling in grid
…component this implementation is based on measureing the grid and computing the position of the mouse (which is probably unnecessarily complicated) works: initial drag and move and click out using
…ual grid measurements this simplifies the click handling and discarding logic
This refactoring extracts separate callback methods for handling draft event scenarios like resizing, dragging, and shortcut/click interactions, improving code readability and reducing complexity in the main handleChange method.
This change extracts the form-related logic from useDraftUtil into a new useDraftForm hook, improving separation of concerns and making the draft utility more modular. The new hook encapsulates form open/close behavior and form props management.
This commit introduces a comprehensive useDraft hook that consolidates draft event handling logic, replacing the previous useDraftUtil approach. The new hook: - Manages draft state and interactions - Handles dragging, resizing, and event creation - Provides utility methods for draft event manipulation - Improves code organization and modularity
…arity This commit introduces a new useDraftActions hook that centralizes draft event management actions, further modularizing the draft event handling logic. Key changes include: - Extracting complex draft-related methods from useDraft - Improving separation of concerns - Simplifying the main draft hook's implementation - Maintaining consistent state management across draft interactions
…ed clarity and organization
6329a8c to
88c51c8
Compare
This change updates the draft event creation process in the useShortcuts hook by adding default event properties, including: - Setting an unassigned priority - Adding default positioning information - Ensuring consistent event structure when creating draft events via shortcuts
This update improves the draft event creation process by: - Adding a new utility function for creating all-day draft events - Refactoring mouse handlers to support different grid click scenarios - Introducing more robust click and draft state management - Adding a selector to track resizing state - Implementing a stop resizing action in the draft slice
partially working. here is what's wrong - resizing: opens new draft - C shortcut sometimes gets the wrong width - when clicking out, the original draft is still in dragging state
Contributor
Author
|
closing in favor of #255 |
Closed
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a proof-of-concept of how to trigger events using global event listeners and state, with a focus on mouse events. It provides a UX that is more aligned with user expectations. It also enables future enhancements and fixes, including #199.
Summary
Further separates concerns between mouse, clicks, events, and drafts.
1. Delegates form display to the
floating-uilibraryWhenever a user clicks on a grid, there are many potential next steps that might occur: creating a new event, closing the previous event form, dragging, or resizing. We previously had to add conditionals into child components (like the header and sidebar) that would check the state of the app so help us identify which scenario we were in at the time of the click.
Now we're using
floating-ui'sonOpenChangecallback anduseDismisshook to do that for us. We configured the forms to close whenever the user clicksESCor clicks outside of the form. This allows us to stop polluting our components with form-checking behavior.2. Decouples the form and draft.
We were previously tracking whether an event should open its form by adding an
isOpenboolean to every grid draft. The downside of that approach is that although only one form can be open at a time, we had to add that property to every event. Thanks to the change above, we could now accomplish this using one state,isEventForm, that is separate from individual events. This makes event state more minimal and also simplifies event creation and teardown.3. Changes mouse listeners and events
This is how mouse handlers previously worked from a user's perspective:
This is how they work now: