Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/Akshatchaube01/TimeWarp int…
Browse files Browse the repository at this point in the history
…o newbranch
  • Loading branch information
happyrao78 committed Jun 21, 2024
2 parents dab3821 + 8c3bfc5 commit 4552cc4
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
20 changes: 20 additions & 0 deletions .github/workflows/auto-comment-on-pr-merge.yml
Original file line number Diff line number Diff line change
@@ -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"
24 changes: 23 additions & 1 deletion src/components/ContactUs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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,
Expand Down Expand Up @@ -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 && (
<p className="text-red-500 text-sm">{emailError}</p>
)}
</label>
<label className="flex flex-col">
<span
Expand Down

0 comments on commit 4552cc4

Please sign in to comment.