-
-
Notifications
You must be signed in to change notification settings - Fork 102
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
remove form from main component. add form to slideone #770
remove form from main component. add form to slideone #770
Conversation
@John-Paul-Larkin is attempting to deploy a commit to the Codú Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThe recent update involves renaming and restructuring types and schemas related to user details handling. This change impacts form handling logic and form element rendering within a component named Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configration 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.
Review Status
Actionable comments generated: 2
Configuration used: CodeRabbit UI
Files selected for processing (1)
- app/(app)/alpha/additional-details/_client.tsx (2 hunks)
Additional comments: 3
app/(app)/alpha/additional-details/_client.tsx (3)
- 7-8: The import statements for
TypeSlideOneSchema
andslideOneSchema
have been updated to reflect the new schema names. This change aligns with the PR objectives of restructuring form handling by introducing a new form toSlideOne
.- 68-70: The
useForm
hook has been correctly configured to use theTypeSlideOneSchema
type and theslideOneSchema
for form validation using Zod through thezodResolver
. This ensures that the form data adheres to the expected schema, enhancing data integrity and validation logic.- 99-201: The form rendering within
SlideOne
is well-structured, with clear labeling and input fields for user details. The use of theregister
function fromreact-hook-form
for each input field ensures that form data is correctly managed and validated against theTypeSlideOneSchema
. However, it's important to ensure that all user input is properly sanitized before submission to prevent security vulnerabilities such as XSS attacks.
const onFormSubmit = async (data: TypeSlideOneSchema) => { | ||
try { | ||
// TODO add server action logic | ||
// await handleFormSlideOneSubmit(data); | ||
toast.success("Saved"); | ||
router.push(`?slide=${2}`, { scroll: false }); | ||
} catch (error) { | ||
toast.error("An unexpected error occurred."); |
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.
The onFormSubmit
function correctly handles form submission asynchronously, displaying a success message upon completion and redirecting to the next slide. However, there's a TODO comment indicating that server action logic needs to be added. It's important to ensure that this logic is implemented before deploying these changes to production to avoid incomplete form handling.
Would you like assistance in implementing the server action logic for form submission?
// const onFormSubmit = async (data: TypeSlideOneSchema) => { | ||
// try { | ||
// const isSuccess = await handleFormSlideOneSubmit(data); | ||
// if (isSuccess) { | ||
// toast.success("Saved"); | ||
// router.push(`?slide=${2}`, { scroll: false }); | ||
// } else { | ||
// toast.error("Error, saving was unsuccessful."); | ||
// } | ||
// } catch (error) { | ||
// toast.error("An unexpected error occurred."); | ||
// } | ||
// }; |
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.
The commented-out alternative form submission logic includes a conditional check for the success of the form submission before proceeding. This approach provides more granular control over the user experience based on the outcome of the form submission. Since the PR description mentions a preference for the currently commented-out option, it's recommended to finalize the decision on which submission logic to use and remove the unused code to maintain code cleanliness.
Consider finalizing the form submission logic based on the preferred user interaction model and removing the unused code to avoid confusion and maintain code cleanliness.
} | ||
}; | ||
|
||
// const onFormSubmit = async (data: TypeSlideOneSchema) => { |
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.
Is this comment needed?
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.
Is this comment needed?
I have two options for the onFormSubmit function. Line 73 vs line 84.
const isSuccess = await handleFormSlideOneSubmit(data)
Returns a boolean from the action.
My preference is for the commented out version, but I wanted your opinion on it.
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.
Perfect! I'll look at it a little later. In meetings for the afternoon.
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.
Go with your preference! I think that's good for the moment. 🦾
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- app/(app)/alpha/additional-details/_client.tsx (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- app/(app)/alpha/additional-details/_client.tsx
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.
LGTM 🌮
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Pull Request details
Trying my best (against my natural instincts) to keep the PR small and manageable.
This PR modifies the main component by removing the form. I also add a form to slideOne.
I have two options for submitting the form, you can see in the video. I think the commented out version is better.
Once I have this PR through i will do a few more PRs
Associated Screenshots
https://youtu.be/2BrD5Ogfrms
Summary by CodeRabbit