Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Issue Fix #1 , Trimming username #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

kothariji
Copy link

@kothariji kothariji commented Dec 27, 2020

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. 👍

@vercel
Copy link

vercel bot commented Dec 27, 2020

@kothariji is attempting to deploy a commit to a Personal Account owned by @ishandeveloper on Vercel.

@ishandeveloper first needs to authorize it.

@kothariji kothariji changed the title trimming username Issue Fix #1 , Trimming username Dec 27, 2020
@vercel
Copy link

vercel bot commented Dec 27, 2020

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

@ishandeveloper
Copy link
Owner

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 : )

@kothariji
Copy link
Author

@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 ?

@ishandeveloper
Copy link
Owner

@kothariji Definitely ! That'd be great 👍🏻 Feel free to go ahead.

@kothariji
Copy link
Author

@ishandeveloper added an alert message whenever a user enters the wrong GitHub username
Screenshot:
image.

So for that added material UI snackbar and MuiAlert.
Please let me know if there are any sort of errors or corrections.

@ishandeveloper
Copy link
Owner

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?

@kothariji
Copy link
Author

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 😅✌️

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants