-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor user data mutation logic #22
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
base: fix/I25-161-linting
Are you sure you want to change the base?
Refactor user data mutation logic #22
Conversation
Replaced separate, specific mutation handlers for `field_training` and `employment_companies` with a single, generic `useHandleUserMutation` hook. This new hook can handle `add`, `update`, and `delete` operations for any user-related data, making the codebase more consistent, maintainable, and easier to understand. The `StudentDetail.tsx` component was refactored to use this new generic hook, simplifying the data submission logic. The old, redundant files (`handleFieldTraining.ts` and `handleEmployment.ts`) have been removed.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll acknowledge your comments with a 👀 emoji and then get to work. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! I will automatically address your feedback. For any comments you don't want me to act on, just include (aside). For security, I will only act on instructions from the user who triggered this task for this pull request. |
This commit includes two main changes: 1. Updates `react-day-picker` from v8 to v9 and applies the necessary migration changes to the `Calendar` component. This resolves previous dependency conflicts. 2. Refactors the data mutation logic by replacing separate handlers with a single, generic `useHandleUserMutation` hook. This improves code consistency and maintainability. Also includes a fix for a routing conflict and adds tests for the new generic mutation service.
This commit addresses two issues that arose after the recent refactoring and library update:
1. Fixes a database error (`time zone "gmt+0900" not recognized`) by removing the `created_at` field from the request payload when adding new records. The database handles this field automatically.
2. Fixes several bugs in the Calendar component:
- The UI is restored to the correct shadcn/ui appearance by overwriting the component with the official v9 compatible code.
- An off-by-one-day date selection bug is fixed by implementing a date formatting function that correctly handles timezones, preventing the date from being shifted when converted to a string.
This commit fixes several UI and functionality issues with the Calendar component that appeared after the `react-day-picker` v9 upgrade. - Adjusts the calendar's cell size and button padding to improve the overall layout and usability. - Fixes a color contrast issue where the selected date's text was not visible against the background in dark mode.
This commit fixes several UI and functionality issues with the Calendar component that appeared after the `react-day-picker` v9 upgrade. - Adjusts the calendar's cell size and button padding to improve the overall layout and usability. - Fixes a color contrast issue where the selected date's text was not visible against the background in dark mode. - Fixes an issue where the selected date range was not being colored correctly.
This commit addresses the final set of UI feedback for the Calendar component: - Differentiates the styling for the start, end, and middle of a selected date range. Start/end dates now use the primary color for the background, while the middle dates use the accent color. - Normalizes the size of the date cells on hover and selection to provide a more consistent user experience.
This change addresses the user's request to refactor the data handling logic in
StudentDetail.tsx. The previous implementation was inconsistent and hard to follow. The new implementation uses a generic mutation handler that can be reused for different types of user data. This improves the overall code quality and maintainability. Tests were not added due to dependency conflicts in the project, as discussed with the user.