Commit 199fc20
✨ Feat: Custom actions context menu (#247)
* feature(web): Context menu UI implementation
UI implementation of context menu, no business logic yet. WIP.
* chore(web): Implement `theme.shape.borderRadius` to have border radius styling be consistent in UI
Purpose is consistency. any inconsistent border radius, even by small pixel differences, will look "off" to the user.
* chore(web): refactor component to use `styled-components`
Purpose is to remain consistent across codebase
* feature(web): Detect event right click from `GridContextMenuWrapper` POC
Detecting whether an event was right clicked or not in a clean manner solves a big hurdle.
* chore(web): Fix TS type
Not sure why it was of type button in the first place, but this fixes it.
* feature(web): Context menu edit event POC
This commit demonstrates a POC for editing an event and inner functionality of how the context menu will interact with an event in its draft state.
* feature(web): add invisible backdrop when the context menu is open
the purpose is to prevent an additional action from occurring when user tries to close the context menu by clicking outside. Mimicking user expecations.
* feature(web): Migrate vanilla context menu implementation to Floating UI
Floating UI is a well tested library that handles a lot of nuances and edge cases with floating elements positioning
* feature(web): Context menu enhancements
- Replace `event` local state with draft event redux state as the source of truth for the selected event
- Handle setting and clearing the right-clicked event as the draft event
- rename `event` to `gridEvent` to avoid confusion with DOM events
- TS typing and error fixing
* feature(web): Prevent draft event window form from displaying when event is right clicked
This is a crucial line. It allows us to handle right clicks separately (EG: Displaying a context menu)
* feature(web): Context menu -> edit priority, refactor code
- Implement context menu edit priority
- Decouple `ContextMenu` and create `ContextMenuItems` to separate floating ui menu logic from menu items business logic
* feature(web): Context menu -> Delete event
Implement delete event
* feature(web): support context menu for all-day events
* feature(web): main grid area UX enhancement
If user right clicks on an empty area in the main grid, we prevent drafting an event.
This change should be a better match to user expectations
* chore(web): extract `getSomedayEvents` into a reusable consistent function
* chore(web): Rename `gridEvent` prop to `calEvent`
this will ease the transition to supporting someday events later. A 'grid' event is an event that is usually associated with the main grid and not someday events.
* chore(web): remove todo comments
* chore(web): remove invisible backdrop component
* bug(web): fix TS type import path
* chore(web): Replace priority colors magic strings with constant ones
* chore/feature(web): Implement `IconButton`, refactor code.
- Implement `IconButton`, a reusable component for displaying an icon button
- Remove `Delete` 'icon'. An `icon` component should not mix concerns with a `button` component.
- Refactor instances where we use `Delete` icon
* feature(web): Implement icons for menu context items
* bug(web): Prevent context menu from opening for optimistic events
Prevents optimistic events from being edited, which is to be expected.
* feat(web): Add menu background color to theme
Extend the theme with a new menu background color and update the context menu styling to use theme-based colors
* refactor(web): Centralize event element ID constant
Move the `DATA_EVENT_ELEMENT_ID` constant to the web constants file and update imports across components to use the centralized constant
* refactor(web): Inline getSomedayEvents utility function
Move the getSomedayEvents utility function directly into the SomedayEvents component, removing the separate utility file. (I'm in the process of reorganizing the utils dir, so this will save me from having a conflict)
* refactor(web): Relocate IconButton component file
Move IconButton component to a more specific file location and update import paths. We're moving away from index.ts files for the sake of more declarative imports. Why? Mostly because TK said so TBH.
https://tkdodo.eu/blog/please-stop-using-barrel-files
* refactor(web): Remove source property from draft event slice
I think we'll need some way to start tracking these sources, but it's not needed for this use-case. So, I'd rather wait until it actually is required so that we can implement it with a real use-case
* refactor(web): Rename calEvent prop to event in context menu components
* refactor(web): Extract styled components for context menu items
using named import for consistency, explicitness, and better tree-shaking
* refactor(web): Improve error handling and variable naming in GridContextMenuWrapper
* fix(web): Update draft slice discard action call in GridContextMenuWrapper
Pass empty object to discard action to match expected signature
---------
Co-authored-by: Tyler Dane <tyler@switchback.tech>1 parent 39f95d9 commit 199fc20
File tree
28 files changed
+595
-122
lines changed- packages/web/src
- common
- constants
- styles
- utils
- components
- IconButton
- Icons
- Tooltip
- views
- Calendar
- components
- Event/Grid
- GridEventPreview
- GridEvent
- Grid
- AllDayRow
- MainGrid
- Sidebar
- SomedayTab/SomedayEvents
- hooks/draft
- Forms
- EventForm
- DateTimeSection/TimePicker
- RepeatSection
- RepeatDialog
- SomedayEventForm
- NotFound
28 files changed
+595
-122
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
| |||
72 | 75 | | |
73 | 76 | | |
74 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
75 | 81 | | |
76 | 82 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
53 | 56 | | |
54 | 57 | | |
55 | 58 | | |
| |||
103 | 106 | | |
104 | 107 | | |
105 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
106 | 112 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
284 | 285 | | |
285 | 286 | | |
286 | 287 | | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
95 | 98 | | |
96 | 99 | | |
97 | 100 | | |
| |||
Lines changed: 37 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
| |||
53 | 56 | | |
54 | 57 | | |
55 | 58 | | |
56 | | - | |
| 59 | + | |
57 | 60 | | |
58 | 61 | | |
59 | 62 | | |
| |||
74 | 77 | | |
75 | 78 | | |
76 | 79 | | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
91 | 100 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
101 | 113 | | |
102 | 114 | | |
103 | 115 | | |
| |||
0 commit comments