Open kothariji opened 3 years ago
@kothariji is attempting to deploy a commit to a Personal Account owned by @ishandeveloper on Vercel.
@ishandeveloper first needs to authorize it.
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/ishandeveloper/githubwrapped/f9orfs1w7
✅ Preview: https://githubwrapped-git-fork-kothariji-master.ishandeveloper.vercel.app
Hey @kothariji, Thanks for creating the PR. LGTM.
However, I was thinking, instead of handling the trim spaces in our call, what if we show a warning to the user 'Please enter a valid username', if the input fails to match a certain regex pattern.
I found an npm package, that can help serve this purpose : https://www.npmjs.com/package/github-username-regex
Let me know, what do you think about this and if you'd be able to implement this : )
@ishandeveloper yaa i agree upon that part, but for that regex checking i don't think its a need to install the entire package
Here is the regex - ^[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}$
We can use simple js to check if its matching or not. Eg.
let github_username = new RegExp("^[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}$");
let result = github_username.test(username);
This will work efficiently. So can I try this ?
@kothariji Definitely ! That'd be great 👍🏻 Feel free to go ahead.
@ishandeveloper added an alert message whenever a user enters the wrong GitHub username Screenshot: .
So for that added material UI snackbar and MuiAlert. Please let me know if there are any sort of errors or corrections.
Instead of a snackbar, can we just change the helper text "Press 'Enter' to submit' to 'Please enter a valid username' ? and disable the submit on enter key, if that's the case?
Instead of a snackbar, can we just change the helper text "Press 'Enter' to submit' to 'Please enter a valid username' ? and disable the submit on enter key, if that's the case?
yes we can do that, but in my POI snackbar will alert the user that you have entered wrong username, also the Press Enter to Submit
has small font size so it won't work efficiently as an alert. Just sharing my opinions.. rest is your decision 😅✌️
Add
.trim( )
function to remove unnecessary trailing and leading spaces and tabs from the username, which is logically correct also as GitHub username should not contain any space.Issue reference #1. Please let me know if there are any changes. 👍