Skip to content

♻️ Refactor: Reorganize someday hooks#265

Merged
tyler-dane merged 39 commits intomainfrom
fix/252-someday-clicks
Feb 26, 2025
Merged

♻️ Refactor: Reorganize someday hooks#265
tyler-dane merged 39 commits intomainfrom
fix/252-someday-clicks

Conversation

@tyler-dane
Copy link
Contributor

@tyler-dane tyler-dane commented Feb 19, 2025

This closes #275. It is a follow-up PR for #264 and a companion for #255

Once this is merged, it'll also make fixing #252 a lot easier

Summary of changes

  1. Moves state, effects, and actions outside of the old useSidebarUtil hook and into context: SidebarDraftContext and useSidebarContext.
  2. Introduces a new drafting activity, dnd, which is called when a user starts dragging a someday event.
  3. Tracks a form's open state and adds handlers for discarding and closing it. Unlike the regular draft event, which does this in the provider (DraftProvider), we're doing this within each SomedayEventContainer. This was necessary to make sure each sidebar form was rendering in the correct place.
  4. Let's floating-ui's onOpenChange callback handle how to close event forms when clicking outside or pressing ESC. This let us remove onClick handlers in the Header, Grid, and Sidebar.
  5. Added a wrapper around someday events, which handled whether to show the associated form or not. This let us keep SomedayEvent simple reduce the number of props needed.

Other

This introduces a known bug, where someday drafts aren't started when initiated from the command palette: #274. Decided to move forward with this PR regardless and tackle that as a separate PR (this one has already gotten big enough).

@tyler-dane tyler-dane linked an issue Feb 19, 2025 that may be closed by this pull request
Going to do this in the sidebar for now for simplicity
currently opening the correct form when clicking an existing draft

need to update for new drafts (and shortcuts)
need to update for new drafts (and shortcuts)
the placement value is currently correct, but the form is still visually appearing in the wrong location. this is likely due to how the refs are handled
@tyler-dane tyler-dane force-pushed the fix/252-someday-clicks branch from 66d7cd1 to 9a55cc0 Compare February 25, 2025 12:23
Replaced direct plugin usage in eslint config with plugin object.

The flat config system expects each item in the array to be a valid configuration object
Plugins need to be explicitly registered in the plugins field
@tyler-dane tyler-dane changed the title 🐛 Fix: open someday event after clicking placeholder ♻️ Refactor: Convert someday state to hooks Feb 25, 2025
@tyler-dane tyler-dane changed the title ♻️ Refactor: Convert someday state to hooks ♻️ Refactor: Reorganize someday hooks Feb 25, 2025
@tyler-dane tyler-dane linked an issue Feb 25, 2025 that may be closed by this pull request
2 tasks
@tyler-dane tyler-dane marked this pull request as ready for review February 25, 2025 15:20
the sidebar isn't being used as a container now, so this makes the code easier to understand
@tyler-dane tyler-dane linked an issue Feb 26, 2025 that may be closed by this pull request
@tyler-dane tyler-dane merged commit e3210c7 into main Feb 26, 2025
3 checks passed
@tyler-dane tyler-dane deleted the fix/252-someday-clicks branch February 26, 2025 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor someday draft hooks Refactor draft hooks Multiple clicks required to create new Someday event

1 participant