-
-
Notifications
You must be signed in to change notification settings - Fork 32
chore(activities): include cancel action when editing existing event #4405
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
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe changes refactor the saving logic for upcoming events from handling arrays of events to working with single event objects. This includes updates to type definitions, function signatures, and internal logic across hooks, components, and service layers. The UI for editing upcoming events is also updated for improved conditional rendering and button placement. Changes
Sequence Diagram(s)sequenceDiagram
participant UI as EditUpcomingEvent
participant Hook as useEditUpcomingEvent
participant Service as dbUpcomingEventsSave
UI->>Hook: onSave(event)
Hook->>Service: dbUpcomingEventsSave(event)
Service-->>Hook: (save complete)
Hook-->>UI: (callback returns)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~18 minutes ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
src/features/activities/upcoming_events/edit_upcoming_event/index.tsx
(4 hunks)src/features/activities/upcoming_events/edit_upcoming_event/index.types.ts
(1 hunks)src/features/activities/upcoming_events/edit_upcoming_event/useEditUpcomingEvent.tsx
(1 hunks)src/features/activities/upcoming_events/upcoming_event/index.tsx
(1 hunks)src/features/activities/upcoming_events/upcoming_event/useUpcomingEvent.tsx
(2 hunks)src/pages/activities/upcoming_events/index.tsx
(2 hunks)src/pages/activities/upcoming_events/useUpcomingEvents.tsx
(3 hunks)src/services/dexie/upcoming_events.ts
(1 hunks)
🧰 Additional context used
🧠 Learnings (4)
src/pages/activities/upcoming_events/index.tsx (1)
Learnt from: nobodyzero1
PR: #4326
File: src/utils/enrollments.ts:20-25
Timestamp: 2025-07-09T14:24:33.861Z
Learning: In src/utils/enrollments.ts, the enrollmentStartDateChange function already includes a null check for the current variable to handle cases where the find operation returns undefined.
src/features/activities/upcoming_events/upcoming_event/index.tsx (1)
Learnt from: nobodyzero1
PR: #4326
File: src/utils/enrollments.ts:20-25
Timestamp: 2025-07-09T14:24:33.861Z
Learning: In src/utils/enrollments.ts, the enrollmentStartDateChange function already includes a null check for the current variable to handle cases where the find operation returns undefined.
src/pages/activities/upcoming_events/useUpcomingEvents.tsx (1)
Learnt from: nobodyzero1
PR: #4326
File: src/utils/enrollments.ts:20-25
Timestamp: 2025-07-09T14:24:33.861Z
Learning: In src/utils/enrollments.ts, the enrollmentStartDateChange function already includes a null check for the current variable to handle cases where the find operation returns undefined.
src/features/activities/upcoming_events/edit_upcoming_event/useEditUpcomingEvent.tsx (1)
Learnt from: nobodyzero1
PR: #4326
File: src/utils/enrollments.ts:20-25
Timestamp: 2025-07-09T14:24:33.861Z
Learning: In src/utils/enrollments.ts, the enrollmentStartDateChange function already includes a null check for the current variable to handle cases where the find operation returns undefined.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Code QL
- GitHub Check: Summary
🔇 Additional comments (12)
src/services/dexie/upcoming_events.ts (2)
30-33
: Function renamed for naming consistency.The renaming from
dbUpcomingEventBulkSave
todbUpcomingEventsBulkSave
improves naming consistency. The function logic remains unchanged and correctly updates metadata after the bulk operation.
35-38
: New single-event save function looks good.The new
dbUpcomingEventsSave
function correctly implements single event saving usingput
and maintains consistency by callingdbUpdateUpcomingEventMetadata()
after the operation, following the same pattern as the bulk save function.src/pages/activities/upcoming_events/index.tsx (2)
20-20
: Function name updated to reflect single-event operations.The change from
saveNewEvents
tohandleSaveEvent
better reflects the new single-event saving paradigm and is more descriptive of the function's purpose.
57-57
: Consistent usage of the updated save handler.The
onSave
prop correctly uses the renamedhandleSaveEvent
function, maintaining consistency with the destructuring assignment above.src/features/activities/upcoming_events/edit_upcoming_event/index.types.ts (1)
6-6
: Type definition updated to match single-event operations.The
onSave
callback type correctly changed from accepting an array of events to a single event object, aligning with the refactoring to single-event operations and ensuring type safety.src/features/activities/upcoming_events/upcoming_event/index.tsx (1)
49-49
: Cancel functionality properly implemented.Excellent improvement! The change from a no-op function
() => {}
tohandleTurnEditMode
provides actual cancel functionality, allowing users to properly exit edit mode. This directly addresses the PR objective of including cancel action when editing existing events.src/features/activities/upcoming_events/upcoming_event/useUpcomingEvent.tsx (2)
6-6
: Import updated to use single-event save function.The import correctly changed to use the new
dbUpcomingEventsSave
function for single event operations, aligning with the refactoring from bulk to individual event handling.
102-104
: Function signature and implementation updated consistently.The parameter change from
events: UpcomingEventType[]
toevent: UpcomingEventType
and the corresponding function call update fromdbUpcomingEventBulkSave(events)
todbUpcomingEventsSave(event)
are consistent with the single-event paradigm. The error handling logic remains appropriately unchanged.src/pages/activities/upcoming_events/useUpcomingEvents.tsx (1)
6-6
: LGTM! Clean refactoring from bulk to single event operations.The changes consistently update the import, function signature, database call, and export to handle single events instead of arrays. This simplifies the logic while maintaining proper error handling.
Also applies to: 61-63, 82-82
src/features/activities/upcoming_events/edit_upcoming_event/useEditUpcomingEvent.tsx (1)
204-206
: LGTM! Proper implementation of single event callbacks with metadata.The callbacks now correctly pass single event objects with appropriate
updatedAt
timestamps. The deletion logic properly maintains the_deleted
flag pattern while updating to the new single event approach.Also applies to: 210-215
src/features/activities/upcoming_events/edit_upcoming_event/index.tsx (2)
55-89
: LGTM! Good responsive design for delete action placement.The header section nicely implements responsive delete button placement - using an
IconButton
on mobile for space efficiency and a fullButton
with text on tablet and larger screens. This improves the UX while maintaining consistent functionality.
237-241
: LGTM! Consistent cancel button implementation addresses PR objective.The bottom action buttons now consistently show a cancel button with close icon, which aligns with the PR objective of including cancel action when editing existing events. Moving the delete action to the header area provides better visual separation.
organized-app
|
Project |
organized-app
|
Branch Review |
main
|
Run status |
|
Run duration | 00m 10s |
Commit |
|
Committer | rhahao |
View all properties for this run ↗︎ |
Test results | |
---|---|
|
0
|
|
0
|
|
0
|
|
0
|
|
1
|
View all changes introduced in this branch ↗︎ |
🎉 This PR is included in version 3.32.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
No description provided.