-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'VaibhavArora314:main' into main
- Loading branch information
Showing
24 changed files
with
337 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { useState, useEffect } from 'react'; | ||
import { IoMdRefresh } from "react-icons/io"; | ||
|
||
const CaptchaAdmin = ({ onChange }: { onChange: (isValid: boolean) => void }) => { | ||
const [captchaText, setCaptchaText] = useState(''); | ||
const [inputValue, setInputValue] = useState(''); | ||
const [isCaptchaValid, setIsCaptchaValid] = useState(false); | ||
|
||
useEffect(() => { | ||
generateCaptcha(); | ||
}, []); | ||
|
||
const generateCaptcha = () => { | ||
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; | ||
let text = ''; | ||
for (let i = 0; i < 6; i++) { | ||
text += chars.charAt(Math.floor(Math.random() * chars.length)); | ||
} | ||
setCaptchaText(text); | ||
}; | ||
|
||
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => { | ||
setInputValue(e.target.value); | ||
if (e.target.value === captchaText) { | ||
setIsCaptchaValid(true); | ||
onChange(true); | ||
} else { | ||
setIsCaptchaValid(false); | ||
onChange(false); | ||
} | ||
}; | ||
|
||
return ( | ||
<div className="mb-4 rounded-lg"> | ||
<div className="flex items-center justify-between mb-4 text-[#000435] bg-gray-100 dark:text-white dark:bg-blue-950 p-2 rounded-lg border border-[#5f67de] dark:border-white"> | ||
<span className="text-xl font-semibold italic line-through">{captchaText}</span> | ||
<button | ||
type="button" | ||
onClick={generateCaptcha} | ||
className="bg-blue-500 text-white p-1 rounded-lg hover:bg-blue-600" | ||
> | ||
<IoMdRefresh size={23} /> | ||
</button> | ||
</div> | ||
<input | ||
type="text" | ||
className="form-input mt-1 p-2 block w-full text-[#000435] bg-white dark:text-white dark:bg-[#000453] rounded-lg border border-[#5f67de] dark:border-white" | ||
placeholder="Enter captcha" | ||
value={inputValue} | ||
onChange={handleInputChange} | ||
required | ||
/> | ||
{!isCaptchaValid && inputValue && ( | ||
<p className="text-sm font-semibold mt-2 text-red-600 text-center">Captcha does not match</p> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default CaptchaAdmin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import nodeMailer from 'nodemailer' | ||
export const mailing=async (email: string, message: string) =>{ | ||
let HTML=`<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
<main style="width: 100%;min-height: 100vh;padding: 1rem;background-color: rgb(255 255 80 / 47%);position: relative;"> | ||
<div style="margin: auto;width:90%;background-color: white;max-width: 800px;padding: 1.2rem;border-radius: 0.6rem; box-shadow: 0 1px 5px rgb(0,0,0);position: relative;justify-content: center;align-items: center;"> | ||
<h1 style="margin-top: 2rem;font-family: monospace;">Thank You for Contacting Us!</h1> | ||
<p style="margin-top: 2rem; font-family: sans-serif;font-size: 1rem;"> | ||
<span style="margin-top: 2rem; font-family: sans-serif;font-size: 1rem;"><span style="font-weight:700;">Your Message:</span> ${message}</span><br><br> | ||
Thank you for reaching out to Style Share! Your message is important to us, and we are grateful for your interest. Our team is currently reviewing your inquiry and will respond to you as soon as possible. | ||
<br><br> | ||
In the meantime, feel free to explore more about Style Share on our website. You can browse through our latest articles, explore our featured styles, or connect with us on social media for daily inspiration. | ||
<br><br> | ||
Your feedback is valuable to us as we strive to provide the best experience for our community of style enthusiasts. We look forward to connecting with you soon! | ||
<br><br> | ||
Thank you again for choosing Style Share. Stay stylish and inspired! | ||
<br><br> | ||
Warm regards,<br> | ||
The Style Share Team<br><br> | ||
</p> | ||
<p style="font-family: monospace;font-weight: 700;">Keep connected with our site <a href="https://style-share.vercel.app/app">https://style-share.vercel.app/app</a>...🚀 for updates and more style tips!</p> | ||
<br><br> | ||
<p style="font-family: monospace;text-align: center;">Happy Coding :) Happy Journey :)</p> | ||
</div> | ||
</main> | ||
</body> | ||
</html> | ||
` | ||
const sender=nodeMailer.createTransport({ | ||
service:"Gmail", | ||
auth:{ | ||
user: process.env.EMAIL_USER, | ||
pass: process.env.EMAIL_PASS, | ||
}, | ||
}) | ||
const html= HTML | ||
const receiver={ | ||
from:process.env.EMAIL_USER, | ||
to:email, | ||
subject:"Contact Our Team", | ||
text:'Style Share Contact', | ||
html:html, | ||
} | ||
const sendMail=async()=>{ | ||
try{ | ||
await sender.sendMail(receiver) | ||
console.log("sended") | ||
}catch(err){ | ||
console.log(err) | ||
} | ||
} | ||
|
||
sendMail() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { useState, useEffect } from 'react'; | ||
import { IoMdRefresh } from "react-icons/io"; | ||
|
||
const CaptchaUser = ({ onChange }: { onChange: (isValid: boolean) => void }) => { | ||
const [captchaText, setCaptchaText] = useState(''); | ||
const [inputValue, setInputValue] = useState(''); | ||
const [isCaptchaValid, setIsCaptchaValid] = useState(false); | ||
|
||
useEffect(() => { | ||
generateCaptcha(); | ||
}, []); | ||
|
||
const generateCaptcha = () => { | ||
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; | ||
let text = ''; | ||
for (let i = 0; i < 6; i++) { | ||
text += chars.charAt(Math.floor(Math.random() * chars.length)); | ||
} | ||
setCaptchaText(text); | ||
}; | ||
|
||
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => { | ||
setInputValue(e.target.value); | ||
if (e.target.value === captchaText) { | ||
setIsCaptchaValid(true); | ||
onChange(true); | ||
} else { | ||
setIsCaptchaValid(false); | ||
onChange(false); | ||
} | ||
}; | ||
|
||
return ( | ||
<div className="mb-4 rounded-lg"> | ||
<div className="flex items-center justify-between mb-4 text-[#000435] bg-gray-100 dark:text-white dark:bg-blue-950 p-2 rounded-lg border border-[#5f67de] dark:border-white"> | ||
<span className="text-xl font-semibold italic line-through">{captchaText}</span> | ||
<button | ||
type="button" | ||
onClick={generateCaptcha} | ||
className="bg-blue-500 text-white p-1 rounded-lg hover:bg-blue-600" | ||
> | ||
<IoMdRefresh size={23} /> | ||
</button> | ||
</div> | ||
<input | ||
type="text" | ||
className="form-input mt-1 p-2 block w-full text-[#000435] bg-white dark:text-white dark:bg-[#000453] rounded-lg border border-[#5f67de] dark:border-white" | ||
placeholder="Enter captcha" | ||
value={inputValue} | ||
onChange={handleInputChange} | ||
required | ||
/> | ||
{!isCaptchaValid && inputValue && ( | ||
<p className="text-sm font-semibold mt-2 text-red-600 text-center">Captcha does not match</p> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default CaptchaUser; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.