-
Notifications
You must be signed in to change notification settings - Fork 99
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
Dashboard settings form QOL improvements #51
Conversation
Someone is attempting to deploy a commit to a Personal Account owned by @moinulmoin on Vercel. @moinulmoin first needs to authorize it. |
Thanks for the PR. I will check soon |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
src/types/index.ts
Outdated
shortBio: z | ||
.string({ | ||
required_error: "Please type a short bio.", | ||
}) | ||
.string() | ||
.max(150, { | ||
message: "Short bio must be at most 150 characters.", | ||
}) | ||
.min(10, { | ||
message: "Short bio must be at least 10 characters.", | ||
}), | ||
}) | ||
.or(z.literal("")), |
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.
shortBio: z | |
.string({ | |
required_error: "Please type a short bio.", | |
}) | |
.string() | |
.max(150, { | |
message: "Short bio must be at most 150 characters.", | |
}) | |
.min(10, { | |
message: "Short bio must be at least 10 characters.", | |
}), | |
}) | |
.or(z.literal("")), | |
shortBio: z | |
.string() | |
.max(150, { | |
message: "Short bio must be at most 150 characters.", | |
}) | |
.min(10, { | |
message: "Short bio must be at least 10 characters.", | |
}) | |
.optional(), |
@@ -48,7 +48,7 @@ export default function SettingsForm({ | |||
values: { | |||
name: currentUser.name, | |||
email: currentUser.email, | |||
shortBio: currentUser.shortBio, | |||
shortBio: currentUser.shortBio || "", |
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.
shortBio: currentUser.shortBio || "", | |
shortBio: currentUser.shortBio, |
@@ -123,7 +124,7 @@ export default function ImageUploadModal({ | |||
loading="lazy" | |||
/> | |||
</div> | |||
<div className=" mt-10"> | |||
<div className="mt-10 flex"> |
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.
<div className="mt-10 flex"> | |
<div className="mt-10"> |
@@ -187,15 +187,18 @@ export default function SettingsForm({ | |||
)} | |||
/> | |||
|
|||
<div> | |||
<div className="flex"> |
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.
<div className="flex"> | |
<div> |
All good. just need a few changes and then ready to merge. Thanks |
This was my first intuition as well. But it doesn't work if you type something in the short bio field and then remove it. Because then it becomes an empty string (""), but it won't let you update your profile with bio as an empty string as min length is 10 chars. And the flex class in the other file is to fix the alignment with "cancel" button. During loading state the alignment gets messed up and causes layout shift because of the loading icon |
Hey,
Hey, seems you are right, I removed the min and max and I noticed font flickering issue while checking the buttons layout shift. I added few adjustments. thanks. |
addresses #49
shortBio
is marked as optional in the Prisma schema, so the initial value isnull
which doesn't match with the typeCurrentUser
. So I'm setting it as an empty string if it is null. Not sure if it is the best approach, but any advice is appreciated!