Skip to content

Commit 23a6b00

Browse files
authored
Merge pull request #9 from raghusodani/main
feat : Leaderboard page added
2 parents d74af75 + d4a715f commit 23a6b00

File tree

5 files changed

+240
-26
lines changed

5 files changed

+240
-26
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
"@testing-library/jest-dom": "^5.11.4",
77
"@testing-library/react": "^11.1.0",
88
"@testing-library/user-event": "^12.1.10",
9+
"bootstrap": "^5.1.1",
910
"react": "^17.0.2",
1011
"react-dom": "^17.0.2",
12+
"react-router-dom": "^5.3.0",
1113
"react-scripts": "4.0.3",
1214
"web-vitals": "^1.0.1"
1315
},

src/App.js

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,10 @@
1-
import logo from './logo.svg';
21
import './App.css';
3-
2+
import Leaderboard from './components/leaderboard';
3+
import 'bootstrap/dist/css/bootstrap.min.css'
44
function App() {
55
return (
66
<div className="App">
7-
<header className="App-header">
8-
<img src={logo} className="App-logo" alt="logo" />
9-
<p>
10-
Edit <code>src/App.js</code> and save to reload.
11-
</p>
12-
<a
13-
className="App-link"
14-
href="https://reactjs.org"
15-
target="_blank"
16-
rel="noopener noreferrer"
17-
>
18-
Learn React
19-
</a>
20-
</header>
7+
<Leaderboard/>
218
</div>
229
);
2310
}

src/components/leaderboard.css

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
html{
2+
background-color: #082032;
3+
4+
}
5+
6+
.table{
7+
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
8+
font-weight: 600;
9+
background-color: white;
10+
border-color: #082032 !important;
11+
color: #082032 !important;
12+
border-radius: 30px;
13+
margin-bottom: 80px;
14+
}
15+
thead{
16+
height: 50px ;
17+
font-size: 20px;
18+
font-weight: 600;
19+
}
20+
.tableContainer{
21+
position: absolute;
22+
width: 80%;
23+
left: 130px;
24+
top: 366px;
25+
26+
}
27+
.ctfHeader{
28+
position: absolute;
29+
width: 187px;
30+
height: 121px;
31+
left: 40%;
32+
top: 145px;
33+
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
34+
font-size: 100px;
35+
line-height: 120px;
36+
color: #FFFFFF;
37+
}
38+
.leaderboardHeader{
39+
position: absolute;
40+
width: 261px;
41+
height: 48px;
42+
left: 38%;
43+
top: 266px;
44+
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
45+
font-style: normal;
46+
font-weight: normal;
47+
font-size: 40px;
48+
line-height: 48px;
49+
50+
color: #FFFFFF;
51+
}

src/components/leaderboard.jsx

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import React from 'react'
2+
import "./leaderboard.css"
3+
export default function Leaderboard(){
4+
// data from ranking API
5+
const data = [
6+
{
7+
username:"Chad Amandeep",
8+
level : 11,
9+
points : 110
10+
},
11+
{
12+
username:"Ajay Nath",
13+
level : 5,
14+
points : 50
15+
},
16+
{
17+
username:"Patika",
18+
level : 4,
19+
points : 40
20+
},
21+
{
22+
username:"KKJ the Almighty",
23+
level : 1,
24+
points : 0
25+
},
26+
{
27+
username:"Chad Amandeep",
28+
level : 11,
29+
points : 110
30+
},
31+
{
32+
username:"Ajay Nath",
33+
level : 5,
34+
points : 50
35+
},
36+
{
37+
username:"Patika",
38+
level : 4,
39+
points : 40
40+
},
41+
{
42+
username:"KKJ the Almighty",
43+
level : 1,
44+
points : 0
45+
}
46+
]
47+
const renderUser = (user,index) => {
48+
return (
49+
<tr>
50+
<td>{index+1}</td>
51+
<td>{user.username}</td>
52+
<td>{user.level}</td>
53+
<td>{user.points}</td>
54+
</tr>
55+
)
56+
}
57+
58+
return (
59+
<div className="main">
60+
<div className="ctfHeader">
61+
CTF
62+
</div>
63+
<div className="leaderboardHeader">Leaderboard</div>
64+
<div className="tableContainer">
65+
<table className="table table-bordered table-responsive">
66+
<thead >
67+
<tr>
68+
<th className="col-lg-1">Rank</th>
69+
<th className="col-lg-5">Username</th>
70+
<th className="col-lg-2">Level</th>
71+
<th className="col-lg-3">Points</th>
72+
</tr>
73+
</thead>
74+
<tbody>
75+
{data.map(renderUser)}
76+
</tbody>
77+
</table>
78+
</div>
79+
</div>
80+
)
81+
}

yarn.lock

Lines changed: 103 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,20 +1091,20 @@
10911091
dependencies:
10921092
regenerator-runtime "^0.13.4"
10931093

1094+
"@babel/runtime@^7.1.2", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.9.2":
1095+
version "7.15.4"
1096+
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.15.4.tgz#fd17d16bfdf878e6dd02d19753a39fa8a8d9c84a"
1097+
integrity sha512-99catp6bHCaxr4sJ/DbTGgHS4+Rs2RVd2g7iOap6SLGPDknRK9ztKNsE/Fg6QhSeh1FGE5f6gHGQmvvn3I3xhw==
1098+
dependencies:
1099+
regenerator-runtime "^0.13.4"
1100+
10941101
"@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4":
10951102
version "7.12.18"
10961103
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.12.18.tgz#af137bd7e7d9705a412b3caaf991fe6aaa97831b"
10971104
integrity sha512-BogPQ7ciE6SYAUPtlm9tWbgI9+2AgqSam6QivMgXgAT+fKbgppaj4ZX15MHeLC1PVF5sNk70huBu20XxWOs8Cg==
10981105
dependencies:
10991106
regenerator-runtime "^0.13.4"
11001107

1101-
"@babel/runtime@^7.12.5", "@babel/runtime@^7.9.2":
1102-
version "7.15.4"
1103-
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.15.4.tgz#fd17d16bfdf878e6dd02d19753a39fa8a8d9c84a"
1104-
integrity sha512-99catp6bHCaxr4sJ/DbTGgHS4+Rs2RVd2g7iOap6SLGPDknRK9ztKNsE/Fg6QhSeh1FGE5f6gHGQmvvn3I3xhw==
1105-
dependencies:
1106-
regenerator-runtime "^0.13.4"
1107-
11081108
"@babel/template@^7.10.4", "@babel/template@^7.12.13", "@babel/template@^7.3.3":
11091109
version "7.12.13"
11101110
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.12.13.tgz#530265be8a2589dbb37523844c5bcb55947fb327"
@@ -2806,6 +2806,11 @@ boolbase@^1.0.0, boolbase@~1.0.0:
28062806
resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e"
28072807
integrity sha1-aN/1++YMUes3cl6p4+0xDcwed24=
28082808

2809+
bootstrap@^5.1.1:
2810+
version "5.1.1"
2811+
resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-5.1.1.tgz#9d6eed81e08feaccedf3adaca51fe4b73a2871df"
2812+
integrity sha512-/jUa4sSuDZWlDLQ1gwQQR8uoYSvLJzDd8m5o6bPKh3asLAMYVZKdRCjb1joUd5WXf0WwCNzd2EjwQQhupou0dA==
2813+
28092814
brace-expansion@^1.1.7:
28102815
version "1.1.11"
28112816
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
@@ -5428,6 +5433,18 @@ hex-color-regex@^1.1.0:
54285433
resolved "https://registry.yarnpkg.com/hex-color-regex/-/hex-color-regex-1.1.0.tgz#4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e"
54295434
integrity sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==
54305435

5436+
history@^4.9.0:
5437+
version "4.10.1"
5438+
resolved "https://registry.yarnpkg.com/history/-/history-4.10.1.tgz#33371a65e3a83b267434e2b3f3b1b4c58aad4cf3"
5439+
integrity sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==
5440+
dependencies:
5441+
"@babel/runtime" "^7.1.2"
5442+
loose-envify "^1.2.0"
5443+
resolve-pathname "^3.0.0"
5444+
tiny-invariant "^1.0.2"
5445+
tiny-warning "^1.0.0"
5446+
value-equal "^1.0.1"
5447+
54315448
hmac-drbg@^1.0.1:
54325449
version "1.0.1"
54335450
resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1"
@@ -5437,6 +5454,13 @@ hmac-drbg@^1.0.1:
54375454
minimalistic-assert "^1.0.0"
54385455
minimalistic-crypto-utils "^1.0.1"
54395456

5457+
hoist-non-react-statics@^3.1.0:
5458+
version "3.3.2"
5459+
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45"
5460+
integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==
5461+
dependencies:
5462+
react-is "^16.7.0"
5463+
54405464
hoopy@^0.1.4:
54415465
version "0.1.4"
54425466
resolved "https://registry.yarnpkg.com/hoopy/-/hoopy-0.1.4.tgz#609207d661100033a9a9402ad3dea677381c1b1d"
@@ -6107,6 +6131,11 @@ is-wsl@^2.1.1, is-wsl@^2.2.0:
61076131
dependencies:
61086132
is-docker "^2.0.0"
61096133

6134+
6135+
version "0.0.1"
6136+
resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf"
6137+
integrity sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=
6138+
61106139
[email protected], isarray@^1.0.0, isarray@~1.0.0:
61116140
version "1.0.0"
61126141
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
@@ -6968,7 +6997,7 @@ loglevel@^1.6.8:
69686997
resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.7.1.tgz#005fde2f5e6e47068f935ff28573e125ef72f197"
69696998
integrity sha512-Hesni4s5UkWkwCGJMQGAh71PaLUmKFM60dHvq0zi/vDhhrzuk+4GgNbTXJ12YYQJn6ZKBDNIjYcuQGKudvqrIw==
69706999

6971-
loose-envify@^1.1.0, loose-envify@^1.4.0:
7000+
loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.1, loose-envify@^1.4.0:
69727001
version "1.4.0"
69737002
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
69747003
integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==
@@ -7174,6 +7203,14 @@ min-indent@^1.0.0:
71747203
resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869"
71757204
integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==
71767205

7206+
mini-create-react-context@^0.4.0:
7207+
version "0.4.1"
7208+
resolved "https://registry.yarnpkg.com/mini-create-react-context/-/mini-create-react-context-0.4.1.tgz#072171561bfdc922da08a60c2197a497cc2d1d5e"
7209+
integrity sha512-YWCYEmd5CQeHGSAKrYvXgmzzkrvssZcuuQDDeqkT+PziKGMgE+0MCCtcKbROzocGBG1meBLl2FotlRwf4gAzbQ==
7210+
dependencies:
7211+
"@babel/runtime" "^7.12.1"
7212+
tiny-warning "^1.0.3"
7213+
71777214
71787215
version "0.11.3"
71797216
resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-0.11.3.tgz#15b0910a7f32e62ffde4a7430cfefbd700724ea6"
@@ -7933,6 +7970,13 @@ [email protected]:
79337970
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c"
79347971
integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=
79357972

7973+
path-to-regexp@^1.7.0:
7974+
version "1.8.0"
7975+
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.8.0.tgz#887b3ba9d84393e87a0a0b9f4cb756198b53548a"
7976+
integrity sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==
7977+
dependencies:
7978+
isarray "0.0.1"
7979+
79367980
path-type@^2.0.0:
79377981
version "2.0.0"
79387982
resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73"
@@ -8798,7 +8842,7 @@ [email protected], prompts@^2.0.1:
87988842
kleur "^3.0.3"
87998843
sisteransi "^1.0.5"
88008844

8801-
prop-types@^15.7.2:
8845+
prop-types@^15.6.2, prop-types@^15.7.2:
88028846
version "15.7.2"
88038847
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"
88048848
integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==
@@ -9018,7 +9062,7 @@ react-error-overlay@^6.0.9:
90189062
resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.9.tgz#3c743010c9359608c375ecd6bc76f35d93995b0a"
90199063
integrity sha512-nQTTcUu+ATDbrSD1BZHr5kgSD4oF8OFjxun8uAaL8RwPBacGBNPf/yAuVVdx17N8XNzRDMrZ9XcKZHCjPW+9ew==
90209064

9021-
react-is@^16.8.1:
9065+
react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1:
90229066
version "16.13.1"
90239067
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
90249068
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
@@ -9033,6 +9077,35 @@ react-refresh@^0.8.3:
90339077
resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.8.3.tgz#721d4657672d400c5e3c75d063c4a85fb2d5d68f"
90349078
integrity sha512-X8jZHc7nCMjaCqoU+V2I0cOhNW+QMBwSUkeXnTi8IPe6zaRWfn60ZzvFDZqWPfmSJfjub7dDW1SP0jaHWLu/hg==
90359079

9080+
react-router-dom@^5.3.0:
9081+
version "5.3.0"
9082+
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-5.3.0.tgz#da1bfb535a0e89a712a93b97dd76f47ad1f32363"
9083+
integrity sha512-ObVBLjUZsphUUMVycibxgMdh5jJ1e3o+KpAZBVeHcNQZ4W+uUGGWsokurzlF4YOldQYRQL4y6yFRWM4m3svmuQ==
9084+
dependencies:
9085+
"@babel/runtime" "^7.12.13"
9086+
history "^4.9.0"
9087+
loose-envify "^1.3.1"
9088+
prop-types "^15.6.2"
9089+
react-router "5.2.1"
9090+
tiny-invariant "^1.0.2"
9091+
tiny-warning "^1.0.0"
9092+
9093+
9094+
version "5.2.1"
9095+
resolved "https://registry.yarnpkg.com/react-router/-/react-router-5.2.1.tgz#4d2e4e9d5ae9425091845b8dbc6d9d276239774d"
9096+
integrity sha512-lIboRiOtDLFdg1VTemMwud9vRVuOCZmUIT/7lUoZiSpPODiiH1UQlfXy+vPLC/7IWdFYnhRwAyNqA/+I7wnvKQ==
9097+
dependencies:
9098+
"@babel/runtime" "^7.12.13"
9099+
history "^4.9.0"
9100+
hoist-non-react-statics "^3.1.0"
9101+
loose-envify "^1.3.1"
9102+
mini-create-react-context "^0.4.0"
9103+
path-to-regexp "^1.7.0"
9104+
prop-types "^15.6.2"
9105+
react-is "^16.6.0"
9106+
tiny-invariant "^1.0.2"
9107+
tiny-warning "^1.0.0"
9108+
90369109
90379110
version "4.0.3"
90389111
resolved "https://registry.yarnpkg.com/react-scripts/-/react-scripts-4.0.3.tgz#b1cafed7c3fa603e7628ba0f187787964cb5d345"
@@ -9397,6 +9470,11 @@ resolve-from@^5.0.0:
93979470
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69"
93989471
integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==
93999472

9473+
resolve-pathname@^3.0.0:
9474+
version "3.0.0"
9475+
resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-3.0.0.tgz#99d02224d3cf263689becbb393bc560313025dcd"
9476+
integrity sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng==
9477+
94009478
resolve-url-loader@^3.1.2:
94019479
version "3.1.2"
94029480
resolved "https://registry.yarnpkg.com/resolve-url-loader/-/resolve-url-loader-3.1.2.tgz#235e2c28e22e3e432ba7a5d4e305c59a58edfc08"
@@ -10492,6 +10570,16 @@ timsort@^0.3.0:
1049210570
resolved "https://registry.yarnpkg.com/timsort/-/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4"
1049310571
integrity sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=
1049410572

10573+
tiny-invariant@^1.0.2:
10574+
version "1.1.0"
10575+
resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.1.0.tgz#634c5f8efdc27714b7f386c35e6760991d230875"
10576+
integrity sha512-ytxQvrb1cPc9WBEI/HSeYYoGD0kWnGEOR8RY6KomWLBVhqz0RgTwVO9dLrGz7dC+nN9llyI7OKAgRq8Vq4ZBSw==
10577+
10578+
tiny-warning@^1.0.0, tiny-warning@^1.0.3:
10579+
version "1.0.3"
10580+
resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754"
10581+
integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==
10582+
1049510583
1049610584
version "1.0.4"
1049710585
resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1"
@@ -10909,6 +10997,11 @@ validate-npm-package-license@^3.0.1:
1090910997
spdx-correct "^3.0.0"
1091010998
spdx-expression-parse "^3.0.0"
1091110999

11000+
value-equal@^1.0.1:
11001+
version "1.0.1"
11002+
resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-1.0.1.tgz#1e0b794c734c5c0cade179c437d356d931a34d6c"
11003+
integrity sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw==
11004+
1091211005
vary@~1.1.2:
1091311006
version "1.1.2"
1091411007
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"

0 commit comments

Comments
 (0)