Skip to content

Commit

Permalink
Merge pull request #88 from gamandeepsingh/main
Browse files Browse the repository at this point in the history
hiring Partner- EasyEd added and Mobile number changed
  • Loading branch information
1010varun authored Apr 9, 2024
2 parents 934ca38 + 75ec10e commit eca1ec5
Show file tree
Hide file tree
Showing 6 changed files with 224 additions and 122 deletions.
4 changes: 4 additions & 0 deletions src/Module/General.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,10 @@ const hiringSponsor = [
src: "https://techhiring.in/wp-content/uploads/2024/03/Light-Tosca-Minimalist-We-Are-Hiring-Facebook-Post-940-%C3%97-750-px-940-%C3%97-500-px-4.png",
alt: "open gig LOGO",
},
{
src: "https://s3.ap-south-1.amazonaws.com/innohacks3.0/Logo.png",
alt: "open gig LOGO",
},
];
const educationSponsor = [{ src: eleven }];
const platinumSponsor = [
Expand Down
81 changes: 40 additions & 41 deletions src/components/Counter/Counter.jsx
Original file line number Diff line number Diff line change
@@ -1,55 +1,54 @@

import './Counter.css'
import "./Counter.css";
import { FcLike } from "react-icons/fc";
import { useState, useEffect } from 'react';
import { useState, useEffect } from "react";
// import 'firebase/database';
import { initializeApp } from "firebase/app";
import { getDatabase, ref, set } from 'firebase/database';
import { onValue } from 'firebase/database';
import { getDatabase, ref, set } from "firebase/database";
import { onValue } from "firebase/database";

const firebaseConfig = {
apiKey: "AIzaSyB8JNy6K7F-FleyUxq4BmfCO0mIGqnvEfs",
authDomain: "innohacks-like-counter.firebaseapp.com",
databaseURL: "https://innohacks-like-counter-default-rtdb.asia-southeast1.firebasedatabase.app",
projectId: "innohacks-like-counter",
storageBucket: "innohacks-like-counter.appspot.com",
messagingSenderId: "227514540661",
appId: "1:227514540661:web:4736b67774954f5f580e3c"
};
apiKey: "AIzaSyB8JNy6K7F-FleyUxq4BmfCO0mIGqnvEfs",
authDomain: "innohacks-like-counter.firebaseapp.com",
databaseURL:
"https://innohacks-like-counter-default-rtdb.asia-southeast1.firebasedatabase.app",
projectId: "innohacks-like-counter",
storageBucket: "innohacks-like-counter.appspot.com",
messagingSenderId: "227514540661",
appId: "1:227514540661:web:4736b67774954f5f580e3c",
};
const app = initializeApp(firebaseConfig);
const database = getDatabase(app);
const countRef = ref(database, 'count');


const countRef = ref(database, "count");

const Counter = () => {
const [count, setCount] = useState(0);
useEffect(() => {
const unsubscribe = onValue(countRef, (snapshot) => {
setCount(snapshot.val() || 0);
});
return () => unsubscribe();
}, []);
const handleClick = () => {
// Increment count
const newCount = count + 1;

// Update count in Firebase Realtime Database
set(countRef, newCount)
.then(() => {
setCount(newCount);
})
.catch(error => {
console.error('Error updating count in Firebase:', error);
});
const [count, setCount] = useState(0);
useEffect(() => {
const unsubscribe = onValue(countRef, (snapshot) => {
setCount(snapshot.val() || 0);
});
return () => {
unsubscribe();
};
}, []);
const handleClick = () => {
// Increment count
const newCount = count + 1;

// Update count in Firebase Realtime Database
set(countRef, newCount)
.then(() => {
setCount(newCount);
})
.catch((error) => {
console.error("Error updating count in Firebase:", error);
});
};

return (
<button id="hitCounter" onClick={handleClick}>
<FcLike/> {count}
</button>
);
return (
<button id="hitCounter" onClick={handleClick}>
<FcLike /> {count}
</button>
);
};

export default Counter;

59 changes: 57 additions & 2 deletions src/components/Footer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,61 @@ import { CiLinkedin } from "react-icons/ci";
import { IoLogoTwitter } from "react-icons/io";
// import { FaPhone } from "react-icons/fa";
import { IoCall } from "react-icons/io5";

import { BiLogoTelegram } from "react-icons/bi";
import { HashLink } from "react-router-hash-link";
import "./style.scss";
import { initializeApp } from "firebase/app";
import { getDatabase, ref, set } from "firebase/database";
import { onValue } from "firebase/database";
import { useEffect, useState } from "react";

const firebaseConfig = {
apiKey: "AIzaSyB8JNy6K7F-FleyUxq4BmfCO0mIGqnvEfs",
authDomain: "innohacks-like-counter.firebaseapp.com",
databaseURL:
"https://innohacks-like-counter-default-rtdb.asia-southeast1.firebasedatabase.app",
projectId: "innohacks-like-counter",
storageBucket: "innohacks-like-counter.appspot.com",
messagingSenderId: "227514540661",
appId: "1:227514540661:web:4736b67774954f5f580e3c",
};
const app = initializeApp(firebaseConfig);
const database = getDatabase(app);
const clickCount = ref(database, "clicked");


const Footer = () => {
const [clicked, setClicked] = useState(0);

useEffect(() => {
const unsubscribeClicked = onValue(clickCount, (snapshot) => {
setClicked(snapshot.val() || 0);
});
return () => {
unsubscribeClicked();
};
}, []);

useEffect(() => {
const handleClickAnywhere = () => {
// Increment clicked count
const newClicked = clicked + 1;
set(clickCount, newClicked)
.then(() => {
setClicked(newClicked);
})
.catch(error => {
console.error('Error updating clicked count in Firebase:', error);
});
};

document.addEventListener("click", handleClickAnywhere);

return () => {
document.removeEventListener("click", handleClickAnywhere);
};
}, [clicked]);

return (
<div className="footer new_footer_top">
<svg
Expand Down Expand Up @@ -56,7 +105,7 @@ const Footer = () => {
</a>
</span>
<span className="single">
<a rel="noreferrer" href="tel:+917669816088">
<a rel="noreferrer" href="tel:+918858311388">
<IoCall fontSize={35} className="redBlue5" />
</a>
</span>
Expand Down Expand Up @@ -96,6 +145,12 @@ const Footer = () => {
</p>
</div>
<div className="footer_bg"></div>
<div className="clickCount">
<span>Over</span>
<span>&nbsp;{clicked}</span>
<span>+ clicks on the site!</span>
<p></p>
</div>
</div>
);
};
Expand Down
Loading

0 comments on commit eca1ec5

Please sign in to comment.