From 86961e2ccbd1585f68cc0959fe014339ef8c0968 Mon Sep 17 00:00:00 2001 From: Suhani Singh Paliwal <161575955+suhanipaliwal@users.noreply.github.com> Date: Fri, 24 May 2024 16:49:38 +0530 Subject: [PATCH 1/2] Create auto-comment-on-pr-merge.yml --- .../workflows/auto-comment-on-pr-merge.yml | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/auto-comment-on-pr-merge.yml diff --git a/.github/workflows/auto-comment-on-pr-merge.yml b/.github/workflows/auto-comment-on-pr-merge.yml new file mode 100644 index 0000000..c9a9f42 --- /dev/null +++ b/.github/workflows/auto-comment-on-pr-merge.yml @@ -0,0 +1,20 @@ +name: Auto Comment on PR Merge + +on: + pull_request: + types: [closed] + +jobs: + comment: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + + steps: + - name: Add Comment to Merged PR + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + curl -H "Authorization: token $GITHUB_TOKEN" \ + -X POST \ + -d '{"body":"🎉 Your pull request has been successfully merged! 🎉 Thank you for your contribution to our project. Your efforts are greatly appreciated. Keep up the fantastic work! 🚀"}' \ + "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" From dab6fb07f2718520627d5155fec10eb7ff0c5bf2 Mon Sep 17 00:00:00 2001 From: Amruta Kothawade Date: Thu, 20 Jun 2024 10:44:28 +0530 Subject: [PATCH 2/2] msg --- src/components/ContactUs.jsx | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/components/ContactUs.jsx b/src/components/ContactUs.jsx index 2e07ab8..09a2c19 100644 --- a/src/components/ContactUs.jsx +++ b/src/components/ContactUs.jsx @@ -12,6 +12,7 @@ const Contact = () => { const [email, setEmail] = useState(""); const [message, setMessage] = useState(""); const [loading, setLoading] = useState(false); + const [emailError, setEmailError] = useState(""); const onSubmit = async (event) => { event.preventDefault(); @@ -21,6 +22,23 @@ const Contact = () => { const formData = new FormData(event.target); formData.append("access_key", "b31a0b0f-6a98-4f98-a62b-c6c6b05ae9ee"); + + const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/i; + const validEmailDomains = ["com", "net", "org", "in"]; + const enteredDomain = email.split(".")[1]; + + if (!emailPattern.test(email)) { + setEmailError("Please enter a valid email address."); + setLoading(false); + return; + } else if (!validEmailDomains.includes(enteredDomain)) { + setEmailError("Sorry, we do not support this email domain."); + setLoading(false); + return; + } else { + setEmailError(""); + } + const response = await fetch("https://api.web3forms.com/submit", { method: "POST", body: formData, @@ -137,9 +155,13 @@ const Contact = () => { value={email} onChange={(e) => setEmail(e.target.value)} placeholder="What's your web address?" - className="bg-tertiary py-4 px-6 placeholder:text-secondary text-white rounded-lg outline-none border-none font-medium bg-[#1e1e1e]" + className={`bg-tertiary py-4 px-6 placeholder:text-secondary text-white rounded-lg outline-none border-none font-medium bg-[#1e1e1e] ${ + emailError ? "border-red-500" : "" }`} required /> + {emailError && ( +

{emailError}

+ )}