From 0abd2ef109bd80e72a72c462fd92212f1bf46a1a Mon Sep 17 00:00:00 2001 From: Bhupendra Chouhan <78025043+bhupendra-chouhan@users.noreply.github.com> Date: Sat, 4 Jan 2025 21:50:11 +0530 Subject: [PATCH] Added 'Connect Wallet' feature: Access website only after connecting via MetaMask. (#560) --- connectwallet.js | 69 + index.html | 4088 +++++++++++++++++++++++----------------------- 2 files changed, 2132 insertions(+), 2025 deletions(-) create mode 100644 connectwallet.js diff --git a/connectwallet.js b/connectwallet.js new file mode 100644 index 0000000..60c4167 --- /dev/null +++ b/connectwallet.js @@ -0,0 +1,69 @@ +document.addEventListener("DOMContentLoaded", function () { + const connectButton = document.getElementById("connectButton"); + const mainContent = document.getElementById("mainContent"); + const errorMessage = document.getElementById("errorMessage"); + const walletAddress = document.getElementById("walletAddress"); + + // Add hover effect for button + connectButton.addEventListener("mouseover", function () { + this.style.backgroundColor = "#45a049"; + }); + connectButton.addEventListener("mouseout", function () { + this.style.backgroundColor = "#4CAF50"; + }); + + // Check if MetaMask is installed + const isMetaMaskInstalled = () => { + return typeof window.ethereum !== "undefined" && window.ethereum.isMetaMask; + }; + + // Function to format address + function formatAddress(address) { + return `${address.slice(0, 4)}...${address.slice(-4)}`; + } + + // Connect Wallet Function + async function connectWallet() { + if (!isMetaMaskInstalled()) { + errorMessage.style.display = "block"; + return; + } + + try { + // Request account access + const accounts = await window.ethereum.request({ + method: "eth_requestAccounts", + }); + + if (accounts.length > 0) { + // Hide connect button and show main content + connectButton.style.display = "none"; + mainContent.style.display = "block"; + + // Display formatted wallet address + const connectedAccount = accounts[0]; + walletAddress.textContent = formatAddress(connectedAccount); + console.log("Connected account:", connectedAccount); + } + } catch (error) { + console.error("Error connecting wallet:", error); + } + } + + // Add click event listener to connect button + connectButton.addEventListener("click", connectWallet); + + // Handle account changes + if (window.ethereum) { + window.ethereum.on("accountsChanged", function (accounts) { + if (accounts.length === 0) { + // User disconnected their wallet + connectButton.style.display = "block"; + mainContent.style.display = "none"; + } else { + // Update displayed address when account changes + walletAddress.textContent = formatAddress(accounts[0]); + } + }); + } +}); diff --git a/index.html b/index.html index 7404c2e..bd6ed99 100644 --- a/index.html +++ b/index.html @@ -1,5 +1,5 @@ - + @@ -10,2172 +10,2210 @@ - - -
-
- -
- - -
-
-
-
-
- - - Let's take you forward :) - - -

- The Largest Community Of Tomorrow's - - -

-

- Empower Your Blockchain & Open-Source Journey with India's Largest Community Of Enthusiast People. We are - Bridging the Gap between Tech Industry & Student Communities, Platform for Students to Learn new Skills, - Network With Industry Professionals and grow as an individual. -

-
- - LFG 🚀 - - - - - + + -
-
-
- hero-image -
-
- hero-image -
-
-
-
- - - - - -
-
- - - - - - - - - -
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - -
-
- - - -
-
- -
- FEATURES -

- Our Unique Aspects -

-

- A Place where you can Learn, meet passionate individuals, Build Real World Products, and Grow as an - Individual. -

-
- -
-
-
-
- - - - -
-
-

- Web3 & Blockchain -

-

- Assisting Startups & Providing them a MarketPlace. Helping Web3 Enthusiast to become a Blockchain - Developer. -

-
-
-
-
-
- - - - -
-
-

- Open Source -

-

- Helping Developers & Organizations to Levrage the Power Of Open Source & Expand their Horizon. -

-
-
-
-
-
-
- - - - - - + class="fixed top-0 left-0 z-50 justify-center w-full h-screen p-5 bg-white menu-wrapper dark:bg-dark lg:visible lg:static lg:flex lg:h-auto lg:justify-start lg:bg-transparent lg:p-0 lg:opacity-100 dark:lg:bg-transparent"> +
+ +
+
-
-

- Networking -

-

- Connecting with Diverse Communities Of Creative Minds to Network, Share Ideas, and Gain Valuable - Insights. -

-
-
-
-
-
-
- - - - -
-
-

- Community Collaborations -

-

- Collaborating with Different Tech Communities & Helping them Grow together. -

-
-
-
-
-
-
- - - - -
-
-

- Campus Connect -

-

- Empowering Campuses with Industry Experts & Giving Real World Exposure. -

-
-
-
-
-
-
- - - - -
-
-

- Tech Events -

-

- Making Knowledge Accessible amongst Developers in our Events. -

-
+
-
-
-
-
- - - -
-
- -
- ABOUT US -

- About Our Ecosystem -

-

- Empowering Every Individual Because You dont Need Fancy Tags to Make an Impact :) -

-
+ + + + +
+
+
+
+
+ + + Let's take you forward :) + -
-
-
-
- - - - - - - - - - - - - - - - -
-
- - - -
-
-
-
-
-
-
- about-image -
-
- about-image -
-
-
-
- - +

+ The Largest Community Of Tomorrow's + + +

+

+ Empower Your Blockchain & Open-Source Journey with India's Largest Community Of Enthusiast People. + We are + Bridging the Gap between Tech Industry & Student Communities, Platform for Students to Learn new + Skills, + Network With Industry Professionals and grow as an individual. +

+
-
-

- “Eduhub Community- The Journey Zero to Hero” -

-

- - It’s a community for learners by learners. The vision of this community is to build an environment - where people can learn, implement and grow together. It provides people the opportunity to work with - peers, showcase their talent and enhance their skills by working in-team. We promote Open source, - Web3, Web dev culture through our community. #letstakeyouforward - -

-
-
-
-
-
-
-
-
- about-image +
+
+ hero-image
-
- about-image +
+ hero-image
+ class="absolute -top-6 -right-6 -z-10 h-full w-full border border-primary border-opacity-10 bg-primary bg-opacity-5 backdrop-blur-[6px] dark:border-white dark:border-opacity-10 dark:bg-white dark:bg-opacity-10">
-
+
-
-
-
-
-

- "Helping Individuals To Grow" -

-

- We are on a mission to empower the next generation to discover better ways to Learn, Earn, and - Network! Helping Startups & Organizations to build a Community around their Product -

- -
-
-
-
-
-
-
-
-
- about-image -
-
- about-image -
-
-
-
- - - - - +
+ + + + + + + +
-
-
-

- "Core Values" -

-

- Be Bold: Don't be afraid Of what other's say, don't wait for anyone's permission- If you want - to get it dont then do it!! -

-

- Collaboration >> Competition: Great things happen when people come together!! -

-
-
-
-
-
-
- - - -
-
- -
- OUR TEAM -

- Wanna Say Hi To The BackBone Of Eduhub Community?! -

-

- The people who're Consistently Pushing Their Limits to Take Eduhub to Next Level. -

-
+
+
+
+ + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + +
+
+ + + +
+
+ +
+ FEATURES +

+ Our Unique Aspects +

+

+ A Place where you can Learn, meet passionate individuals, Build Real World Products, and Grow as an + Individual. +

+
-
-
-
-
- team-image - -
-
-
- team-image -
-
- - + + +
-
-

- Priya Chandak -

-

- Co-Founder +

+
+ + + +
+
+ +
+ ABOUT US +

+ About Our Ecosystem +

+

+ Empowering Every Individual Because You dont Need Fancy Tags to Make an Impact :)

-
-
-
-
-
- team-image + +
- + class="absolute top-0 left-0 w-full h-full bg-center bg-cover -z-10 opacity-10 dark:opacity-40 bg-noise-pattern">
-
-
-

- Shivank Kapur -

-

- Community Manager -

-
-
-
-
- -
- - - -
-
- -
- PORTFOLIO -

- Event Gallery -

-

- Even though the number of initiatives we've taken is quite high and not enough to display here, but still - let's - have a glimpse :) -

-
- -
-
- - - - -
- -
-
-
-
- portfolio-image - -
- - +
+ + + + + + + + + + + + + + + +
-
-
-
-
- portfolio-image +
+ + + +
+
+
+
+
+
+
+ about-image +
+
+ about-image +
+
+
+
+ + +
+
+
+
+
+

+ “Eduhub Community- The Journey Zero to Hero” +

+

+ + It’s a community for learners by learners. The vision of this community is to build an + environment + where people can learn, implement and grow together. It provides people the opportunity to + work with + peers, showcase their talent and enhance their skills by working in-team. We promote Open + source, + Web3, Web dev culture through our community. #letstakeyouforward - -

-
-
-
- portfolio-image +
+
+
+
+
+ about-image +
+
+ about-image +
+
+
+
+ + + + + + +
+
+
+
+
+

+ "Helping Individuals To Grow" +

+

+ We are on a mission to empower the next generation to discover better ways to Learn, Earn, and + Network! Helping Startups & Organizations to build a Community around their Product +

- +
-
-
- portfolio-image - - +
+ + + +
+
+ +
+ OUR TEAM +

+ Wanna Say Hi To The BackBone Of Eduhub Community?! +

+

+ The people who're Consistently Pushing Their Limits to Take Eduhub to Next Level. +

-
- -
- - See More Projects - - - - - - -
- - -
- - - -
-
- -
- Testimonial -

- What Our Members Say? -

-

- Let's have a look at what does an average Eduhub Member say about us 🤔? -

-
- -
-
-
-
-
- - - - - - - - - - - - - - - - -
-
-
-
-
-
-

- “Eduhub is really a lovely community. I’ve learned many skills and networked with many people - because of - the community. Keep up the good work -

- -

- Anuradha Jadon +
+
+
+ +
+

+ Sahitya Roy

-

- Systems Engineer @Tata Consultancy Service. +

+ Co-Founder

-
-
-
- testimonial-image -
+
+
+
+
+ team-image + -
- - - - - - -
-
-
-
-
-
-
-
-

- “I can't express how grateful I am to be a part of this incredible community. It's not just a - group; it's a support system, a source of inspiration, and a place to thrive. They are very good - at commitments and deliver some amazing results to the organization. -

- -

- Sounak Ghosh +
+

+ Priya Chandak

-

- Developer Relations Engineer @Nordek. +

+ Co-Founder

-
-
-
- testimonial-image -
+
+
+
+
+ team-image + -
- - - - - - -
+
+
+

+ Shivank Kapur +

+

+ Community Manager +

- - -
-
-
-
-

- - - -
-
- -
-

- Trusted by Global Brands -

-

- -

-
- -
-
--> - - - - - + + +
+
+ +
+ PORTFOLIO +

+ Event Gallery +

+

+ Even though the number of initiatives we've taken is quite high and not enough to display here, but + still + let's + have a glimpse :)

- - Join This Plan - - - - - - -
- - -
-

- Looking for a company solution? -

-

- Contact our team to get a quote. -

-
- -
--> --> - - - -
-
- -
- BLOGS -

- Give a Read To Some Of Our Latest Articles! -

-

- Below Given Our Some Of The Blogs Written about Different Technologies Like- Open Source, Blockchain - Development, Web Development, etc. -

-
- -
-
-
-
-
- - blog-image - - +
+
+ +
- -
-
-
-
-
- - blog-image - - - Web3 - + + +
-
-
-

- - - - - - Shrishti Mishra -

-

- - - - - - 10 Oct, 2023 -

-
-

- - Integrating Web3 With Traditional Web Apps - -

-
-
-
-
-
-
- - blog-image - - - Open Source - -
-
-
-

- - - - - - Shrishti Mishra -

-

- - - - - - 26 Sept, 2023 -

-
-

- - Open Source Licenses: Legal Considerations for Developers - -

-
-
-
-
-
-
-
- - -
-
-
-
-
-
- -
- - SUPPORT - -

- Wanna Mail Us? -

-

- Let's have a coffee meet and discuss an idea roaming in your mind ☕️! -

+
+
+
+
+ portfolio-image + +
+ + +
+
+
+
+
+ portfolio-image + + +
+
+
+
+ portfolio-image + + +
+
+
+
+ portfolio-image + + +
+
-
- - -
-
-
-

- Email Address -

-

- support@eduhubcommunity.tech -

-
-
-
-
- -
-
-
-
-

- Registered Location -

-

- Jaipur, Rajasthan, India. -

-
+
+ + + +
+
+ +
+ Testimonial +

+ What Our Members Say? +

+

+ Let's have a look at what does an average Eduhub Member say about us 🤔? +

- -
+
+ + + +
+
+ +
+

+ Trusted by Global Brands +

+

-

-
-
-
-
- - -
-
-
-
- - -
+

-
-
- - + -
-
- - -
+
+
--> + + + + + --> + + + +
+
+ +
+ BLOGS +

+ Give a Read To Some Of Our Latest Articles! +

+

+ Below Given Our Some Of The Blogs Written about Different Technologies Like- Open Source, Blockchain + Development, Web Development, etc. +

-
-
- - + +
+
+
+
+
+ + blog-image + + + 25 College Roadshow + +
+ +
+
+
+
+
+ + blog-image + + + Web3 + +
+
+
+

+ + + + + + Shrishti Mishra +

+

+ + + + + + 10 Oct, 2023 +

+
+

+ + Integrating Web3 With Traditional Web Apps + +

+
+
+
+
+
+
+ + blog-image + + + Open Source + +
+
+
+

+ + + + + + Shrishti Mishra +

+

+ + + + + + 26 Sept, 2023 +

+
+

+ + Open Source Licenses: Legal Considerations for Developers + +

+
+
+
+
+
+ + + +
+
+
+
+
+
+ +
+ + SUPPORT + +

+ Wanna Mail Us? +

+

+ Let's have a coffee meet and discuss an idea roaming in your mind ☕️! +

+
+
- - -
-
-
- +
+
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
- -
-
-
-
-
-
- - - - - - - - - - - - - - - - -
+
+
+ +
+
-
-
-
-

- Looking for a collaboration? Get Started Today! -

-

- We are excited for your valuable proposal. -

-
-
-
-
- - Get Started Now - +
+ +
+
+
-
-
-
- - + + - - + - - + \ No newline at end of file