Skip to content

Commit

Permalink
Merge branch 'old-dev' into old-dev-server
Browse files Browse the repository at this point in the history
  • Loading branch information
AswinAsok committed Jul 2, 2023
2 parents 19bfb9c + 258d7f0 commit 3832bff
Show file tree
Hide file tree
Showing 10 changed files with 217 additions and 22 deletions.
3 changes: 3 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import YIP2023 from "./Pages/YIP2023/YIP2023";
import BeWebDev from "./Pages/Events/BeWebDev/BeWebDev";
import YipForm from "./Pages/YIP/YIPAfterForm/YipForm";
import Journey from "./Pages/UserJourney/Journey";
import MutechLeaderboard from "./Pages/MutechLeaderBoard/MutechLeaderBoard";

function App() {
const [redirects, setRedirects] = useState([]);
Expand Down Expand Up @@ -80,6 +81,8 @@ function App() {
<Redirection link="https://yip.kerala.gov.in/" />
}
/> */}
<Route path='mutech/leaderboard' element={<MutechLeaderboard />} />

<Route path="/careers" element={<Career />} />
<Route path="*" element={<NotFound isLoaded={isLoaded} />} />
<Route path="/termsandconditions" element={<TermsAndCondition />} />
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Footer/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const Footer = () => {
</p>

<p className={styles.mail}>
<a href=">[email protected]">[email protected]</a>
<a href="mailto:[email protected]">[email protected]</a>
</p>
</div>
</div>
Expand Down
10 changes: 5 additions & 5 deletions src/Components/Navbar/Mylinks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export const links = [
},
{
name: "Success Stories",
link: "/successstories",
link: "/blogs",
submenu: false,
sublinks: [],
foreign: false,
Expand Down Expand Up @@ -433,15 +433,15 @@ export const links = [
foreign: false,
},
{
name: "Rust",
link: mainlink + "/bootcamps/rust",
name: "Unreal Engine",
link: mainlink + "/bootcamps/ig/unreal",
submenu: false,
sublinks: [],
foreign: false,
},
{
name: "JavaScript",
link: mainlink + "/bootcamps/javascript",
name: "Web Development",
link: mainlink + "/bootcamps/ig/web",
submenu: false,
sublinks: [],
foreign: false,
Expand Down
11 changes: 2 additions & 9 deletions src/Pages/CommPartners/data/partners.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import kuttycoders from "../assets/partners/kuttycoders.webp";
import google_android from "../assets/partners/google_android.webp";
import gdsc from "../assets/partners/gdsc.webp";
import icfoss from "../assets/partners/icfoss.webp";
import riglabs from "../assets/partners/riglabs.webp"

const partners = [
{
Expand All @@ -25,8 +24,8 @@ const partners = [
{
name: "Kerala Startup Mission",
image: ksum,
link: "",
customlink: "/community-partners/iedc",
link: "https://startupmission.kerala.gov.in/",
// customlink: "/community-partners/iedc",
},

{
Expand All @@ -42,12 +41,6 @@ const partners = [
link: "",
customlink: "/community-partners/foxlab",
},
{
name: "Riglabs",
image: riglabs,
link: "",
customlink: "https://www.riglabs.co/",
},
{
name: "Institute of Electrical and Electronics Engineers",
image: ieee,
Expand Down
4 changes: 2 additions & 2 deletions src/Pages/Events/BuildForTeam/BuildForTeam.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ const Build4Team = () => {
<p className={styles.tv_tagline}>
<ul>
<li>
• First level filteration will be there from which all the
• First level filtration will be there from which all the
valid websites will be selected and they enter to phase two.
</li>
<li>
Expand Down Expand Up @@ -265,7 +265,7 @@ const Build4Team = () => {
contact us via Discord.
</p>
<a
href="https://app.mulearn.org/user/register"
href="https://app.mulearn.org/register"
target="_blank"
rel="noopener noreferrer"
>
Expand Down
4 changes: 2 additions & 2 deletions src/Pages/Events/HacktoberFest/HacktoberFest.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ const HacktoberFest = () => {
</div>
<div className={styles.svp_text}>
For the Next step in the challenge. You have to create a
website for a buissness nearby by following the requirements
website for a business nearby by following the requirements
which are specified below.
</div>
</div>
Expand All @@ -161,7 +161,7 @@ const HacktoberFest = () => {
Contribute
</div>
<div className={styles.svp_text}>
Since you have created a website for a buissness nearby you
Since you have created a website for a business nearby you
are ready to contribute to the project. For that all you
have to do is make Pull request to our repository.
</div>
Expand Down
1 change: 1 addition & 0 deletions src/Pages/LeaderBoard/leaderBoard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ const LeaderBoard = () => {
</div>
</div> */}
</div>

<Footer />
</>
);
Expand Down
127 changes: 127 additions & 0 deletions src/Pages/MutechLeaderBoard/MutechLeaderBoard.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
import React, { useState, useEffect, useRef } from 'react'
import axios from "axios";
import Style from './MutechLeaderBoard.module.css'
import Navbar from '../../Components/Navbar/Navbar'
const MutechLeaderBoard = () => {
const API = "https://opensheet.elk.sh/"
const [data, setData] = useState([])
const fetchOnce = useRef(false)
const spreadsheetId = 'https://docs.google.com/spreadsheets/d/1gAX7dGO5KFAOiPQfoo8vb22RbwtmjZ4Y1tslcULkrXE/edit#gid=564307130'
const sheet = "CommitBox"
const now = new Date()
const month = now.getMonth()
const today = now.getDate()
const [scoreBoard, setScoreBoard] = useState({})
useEffect(() => {
if (spreadsheetId.length >= 83 && !fetchOnce.current) {
try {
axios.get(`${API + spreadsheetId.split("/")[5]}/${sheet}`)
.then(res => res.data)
.then(result => {
setData(result)
})
}
catch (err) {
console.error(err)
}
}
}, [])
useEffect(() => {
if (fetchOnce.current && data.length > 0) {
const PeopleScoreBoard = {}
const people = []
for (let work of data) {
// eslint-disable-next-line array-callback-return
Object.keys(work).slice(1,).map((key, index) => {
if (!people.includes(key)) {
if (key !== "undefined") {
people.push(key)
PeopleScoreBoard[key] = { name: key, score: 0, streak: 0, longestStreak: 0, overallStreak: 0 }
}
}
})
const da = new Date(work.Date)
if (da.getMonth() === month && da.getDate() < today) {
for (let person of people) {
if (work[person] !== null && work[person] !== undefined) {
if (work[person].toLowerCase().includes('done')) {
let x = work[person].split('\n'), score = 10
PeopleScoreBoard[person].streak += 1
PeopleScoreBoard[person].score += x.length * score + (PeopleScoreBoard[person].streak <= 5 ? (PeopleScoreBoard[person].streak - 1) * score : 50)
}
else {
PeopleScoreBoard[person].streak = 0
}
}
}
}
for (let person of people) {
if (work[person] !== null && work[person] !== undefined) {
PeopleScoreBoard[person].overallStreak += 1
setLongestStreak(PeopleScoreBoard, person)
}
else {
setLongestStreak(PeopleScoreBoard, person)
PeopleScoreBoard[person].overallStreak = 0
}
}
}
sortScore(PeopleScoreBoard)
}
fetchOnce.current = true
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [data])
function sortScore(PeopleScoreBoard) {
const scoreSet = Object.values(PeopleScoreBoard)
const scoreBoard = scoreSet.sort((a, b) => {
if (a.streak === b.streak)
return b.score - a.score
return b.streak - a.streak
})
setScoreBoard(scoreBoard)
}
function setLongestStreak(PeopleScoreBoard, person) {
if (PeopleScoreBoard[person].overallStreak > PeopleScoreBoard[person].longestStreak)
PeopleScoreBoard[person].longestStreak = PeopleScoreBoard[person].overallStreak
}
return (
<>
<Navbar />
<div className={Style.container}>

<div className={Style.table}>
<h1 className={Style.h1}>µTech Commit Leaderboard</h1>

<h1 className={Style.h1}>{now.toLocaleString('en-US', { month: 'long' })} {now.toLocaleString('en-US', { year: 'numeric' })}</h1>

<table className={Style.tableContainer} >
<thead>
<tr>
<th >Rank</th>
<th >Name</th>
<th >Monthly Score</th>
<th>Monthly Streak</th>
<th>Overall Streak</th>
</tr>
</thead>
<tbody>
{Object.values(scoreBoard).map((score, index) => {
return (
<tr key={index}>
<td >{index + 1}</td>
<td >{score.name}</td>
<td >{score.score}</td>
<td>{score.streak}</td>
<td><div className={Style.clear}>{score.longestStreak}</div></td>
</tr>
)
})}
</tbody>
</table>
</div>
</div>
</>
)
}

export default MutechLeaderBoard
71 changes: 71 additions & 0 deletions src/Pages/MutechLeaderBoard/MutechLeaderBoard.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
.container{
display: flex;
width: 100%;
justify-content: center;
}

.table{
margin: 20px;
padding: 30px;
border-radius: 15px;
background-color: rgb(248, 252, 255);
box-shadow: 0 0px 5px 2px rgba(0, 0, 0, 0.1);
overflow-x: auto;
}
.h1{
text-align: center;
font-size: 30px;
font-weight: 700;
padding:0px;
width: 100%;
margin: 0;
}
h1:first-child{
margin-top: 15px;
}
h1:nth-child(2){
margin-bottom:30px;
}
.h2{
font-size: 25px;
font-weight: 400;
margin: 0;
margin-top: 15px;
margin-bottom:30px;
}
table,.tableContainer {
width: 100%;
border-spacing: 10px;
word-break: break;
min-width: 500px;
width: 600px;
}
th{
text-align: center;
font-weight: 600;
}
tr{
border-bottom: 1px solid rgba(0, 0, 0, 0.20) ;


}
.clear{
padding:10px;
}
tbody
td{
text-align: center;
}
tbody tr:nth-child(-n+3){
background-color: rgb(255, 191, 0);
border-radius: 10px;
color: white;
}
.side{
text-align: left;
}
tr:nth-child(-n+3) td{
font-size: 16px;
font-weight: 700;
/* text-align: center; */
}
6 changes: 3 additions & 3 deletions src/Pages/YIP2023/YIP2023.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const YIP2023 = () => {
</a>
to go to the Pre-Registration page. Enter all your
details in the Pre-Registration Form and Complete the
OTP Verification. By Now you would have recived an
OTP Verification. By Now you would have received an
email with login credentials, you can now login with
that.
</p>
Expand Down Expand Up @@ -262,7 +262,7 @@ const YIP2023 = () => {
<b>person who formed the team</b> can submit the idea
by going to the
<b>&nbsp;Idea Submission Option</b> from his/her
Navbar.Post your idea submission certiciate with the
Navbar.Post your idea submission certificate with the
hashtag&nbsp;
<b>#yip5.0-idea</b> to gain <b>800 Karma Points</b>.
You could submit upto 2 ideas per person.
Expand All @@ -287,7 +287,7 @@ const YIP2023 = () => {
<div className="timeline__event__description">
<p>
After the submission of the idea, it requires the
approval of the repective Institution and you may
approval of the respective Institution and you may
contact the concerned authority for the approval of
your idea.
</p>
Expand Down

0 comments on commit 3832bff

Please sign in to comment.