Skip to content

Commit 0c9e70d

Browse files
authored
Merge pull request #17 from ishaandhyani/stake
Stake
2 parents a9e02ea + 02cf9f6 commit 0c9e70d

File tree

10 files changed

+3271
-161
lines changed

10 files changed

+3271
-161
lines changed

695650-U2Q38ZH2/ui/.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
NEXT_PUBLIC_SERVICE_ID=
2+
NEXT_PUBLIC_TEMPLATE_ID=
3+
NEXT_PUBLIC_EMAILJS_USER_ID=
4+
NEXT_PUBLIC_RECAPTCHA_SITE_KEY=

695650-U2Q38ZH2/ui/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,5 @@ yarn-error.log*
3333
# typescript
3434
*.tsbuildinfo
3535
next-env.d.ts
36+
37+
.env
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
import React, { useRef, useState } from "react";
2+
import emailjs from "emailjs-com";
3+
import ReCAPTCHA from "react-google-recaptcha";
4+
5+
const ContactForm: React.FC = () => {
6+
const form = useRef<HTMLFormElement>(null);
7+
const recaptchaRef = useRef<any>(null); // Added typing to ref for better type support.
8+
const [done, setDone] = useState(false);
9+
const [isCaptchaVerified, setIsCaptchaVerified] = useState(false);
10+
const [showPopup, setShowPopup] = useState(false);
11+
12+
const closeModal = () => {
13+
setShowPopup(false);
14+
};
15+
16+
const sendEmail = (e: React.FormEvent) => {
17+
e.preventDefault();
18+
if (!isCaptchaVerified) {
19+
setShowPopup(true);
20+
return;
21+
}
22+
emailjs.sendForm(
23+
process.env.NEXT_PUBLIC_SERVICE_ID,
24+
process.env.NEXT_PUBLIC_TEMPLATE_ID,
25+
form.current!,
26+
process.env.NEXT_PUBLIC_EMAILJS_USER_ID
27+
).then((result) => {
28+
console.log(result.text);
29+
setDone(true);
30+
form.current!.reset();
31+
setIsCaptchaVerified(false);
32+
}).catch((error) => {
33+
console.log(error.text);
34+
});
35+
};
36+
37+
return (
38+
<>
39+
{showPopup && (
40+
<div className="fixed inset-0 flex items-center justify-center z-50">
41+
<div className="relative w-full max-w-md">
42+
<div className="relative bg-white rounded-lg shadow dark:bg-gray-700 p-6">
43+
<h3 className="mb-5 text-lg font-normal text-gray-500 dark:text-gray-400 text-center">
44+
Please complete the CAPTCHA
45+
</h3>
46+
<button
47+
onClick={closeModal}
48+
type="button"
49+
className="button w-full text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 dark:focus:ring-red-800 font-medium rounded-lg text-sm px-5 py-2.5"
50+
>
51+
Close
52+
</button>
53+
</div>
54+
</div>
55+
</div>
56+
)}
57+
<div className="max-w-md mx-auto bg-white rounded-lg shadow-2xl p-8 glowingCard">
58+
<form ref={form} onSubmit={sendEmail}>
59+
{['Name', 'Email', 'Subject', 'Message'].map((label, idx) => (
60+
<div className="mb-4" key={label}>
61+
<label className="block font-medium text-gray-700">{label} *</label>
62+
{label !== 'Message' ? (
63+
<input
64+
type={label.toLowerCase()}
65+
name={`user_${label.toLowerCase()}`}
66+
placeholder={label}
67+
required
68+
className="user w-full px-4 py-2 border rounded-md shadow-sm focus:ring focus:ring-purple-500 focus:border-purple-500"
69+
/>
70+
) : (
71+
<textarea
72+
rows={2}
73+
required
74+
className="user w-full px-4 py-2 border rounded-md shadow-sm focus:ring focus:ring-purple-500 focus:border-purple-500"
75+
name="message"
76+
placeholder={label}
77+
></textarea>
78+
)}
79+
</div>
80+
))}
81+
<div className="mb-4">
82+
<ReCAPTCHA
83+
ref={recaptchaRef}
84+
sitekey={process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY}
85+
onChange={() => setIsCaptchaVerified(true)}
86+
/>
87+
</div>
88+
<button
89+
type="submit"
90+
value="Send"
91+
className="button w-full bg-gradient-to-br from-pink-600 to-purple-700 text-white py-2 px-4 rounded-md hover:from-pink-500 hover:to-purple-600 transition duration-300 shadow-md"
92+
>
93+
Send
94+
</button>
95+
</form>
96+
{done && (
97+
<span className="mb-8 flex items-center justify-center text-xl text-gray-400 pt-6">
98+
Thanks for contacting Us!
99+
</span>
100+
)}
101+
</div>
102+
</>
103+
);
104+
};
105+
106+
export default ContactForm;

695650-U2Q38ZH2/ui/components/Footer.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ export const Footer = () => {
99
<div className="border-t border-white opacity-50 mb-10" />
1010
<div className="flex justify-center space-x-8 mb-6">
1111
<a href="/" className="text-2xl text-gray-400 hover:text-white transition duration-200">Home</a>
12-
<a href="/AboutUs" className="text-2xl text-gray-400 hover:text-white transition duration-200">About</a>
12+
<a href="/aboutus" className="text-2xl text-gray-400 hover:text-white transition duration-200">About</a>
13+
<a href="/contact" className="text-2xl text-gray-400 hover:text-white transition duration-200">Contact Us</a>
1314
<a href="/AboutUs#faq-section" className="text-2xl text-gray-400 hover:text-white transition duration-200">FAQ</a>
1415
</div>
1516
<div className="flex justify-center space-x-5 mb-6">

695650-U2Q38ZH2/ui/components/LargeCard.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { useState } from "react";
22
import Image from "next/image";
3+
import { useRouter } from "next/router";
34
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
45
import {
56
faArrowDown,
@@ -34,11 +35,14 @@ const LargeCard: React.FC<LargeCardProps> = ({
3435
const [isExpanded, setIsExpanded] = useState(false);
3536
const [showConnectModal, setShowConnectModal] = useState(false);
3637
const { account } = useAccount();
38+
const router = useRouter();
3739

3840
const handlePlay = () => {
3941
if (!account) {
4042
setShowConnectModal(true);
4143
return;
44+
}else{
45+
router.push("/Game");
4246
}
4347
};
4448
return (

695650-U2Q38ZH2/ui/components/exploreus/FAQPage.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
import React, { useState } from "react";
2-
2+
import { useRouter } from "next/router";
33
type FAQPageProps = {
44
id: string;
55
};
66

77
const FAQPage: React.FC<FAQPageProps> = ({ id }) => {
8+
9+
const router = useRouter();
10+
11+
const handleContactClick = () => {
12+
router.push("/contact");
13+
};
14+
815
const [activeIndex, setActiveIndex] = useState<number | null>(null);
916

1017
const faqData = [
@@ -89,7 +96,7 @@ const FAQPage: React.FC<FAQPageProps> = ({ id }) => {
8996
))}
9097
</div>
9198
<div className="text-center pt-12 text-xl font-semibold text-gray-400 cursor-pointer hover:text-white">
92-
{`Can't find your question?`} <span className="underline">Contact Us!</span>
99+
{`Can't find your question?`} <span className="underline" onClick={handleContactClick}>Contact Us!</span>
93100
</div>
94101
</div>
95102
);

0 commit comments

Comments
 (0)