Skip to content

Commit db2946d

Browse files
committed
fixed decimal participants and ui fix
1 parent c25ea43 commit db2946d

File tree

4 files changed

+71
-48
lines changed

4 files changed

+71
-48
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ You can reset all your bookmarks by clicking the Reset Bookmarks button, which i
4444

4545
- Clone the repo
4646
- cd into the repo directory
47-
- Run: `npm install`
47+
- Run: `npm install --force`
4848
- Run: `npm start`
4949

5050
# Contributing :
@@ -60,7 +60,7 @@ You can reset all your bookmarks by clicking the Reset Bookmarks button, which i
6060
- In `./scrape.py` replace 2023 with the {year}+1
6161
- Run: `python scrape.py`
6262
- Replace the data in ./data/finalData.json with the new data in ./data.json(produced after successfully running scrape script)
63-
- Identify duplicate entries of organizations in data obtained through scraping (produced due to slightly different name in various year of gsoc)
64-
- for each duplicate org Run : `python merge.py`
63+
- Identify duplicate entries of organisations in data obtained through scraping (produced due to slightly different name in various year of gsoc)
64+
- for each duplicate organisation Run : `python merge.py`
6565
- add {year} to labels in `./components/OrganisationCard.js`
66-
- for charts in `./components/launcher/` add {year} to the labels and add the data for the year
66+
- for charts in `./components/launcher/` add {year} to the labels and add data for the year

src/components/Home.js

Lines changed: 60 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
1-
import React, { useRef, useState, useEffect } from 'react';
2-
import { Container, Header } from 'semantic-ui-react';
3-
import '../css/mainpagecss.css';
4-
import data from '../data/finalData.json';
5-
import OrganisationCard from './OrganisationCard';
6-
import AdvancedSearch from './AdvancedSearch';
7-
import Footer from './Footer';
8-
import { VerticleButton as ScrollUpButton } from 'react-scroll-up-button';
9-
import LaunchingComponent from './LaunchingComponent';
10-
import { Link } from 'react-router-dom'
11-
import { sortAppearances, sortTotalProjects, sortAverageProjects } from './SortFunctions';
1+
import React, { useRef, useState, useEffect } from "react";
2+
import { Container, Header } from "semantic-ui-react";
3+
import "../css/mainpagecss.css";
4+
import data from "../data/finalData.json";
5+
import OrganisationCard from "./OrganisationCard";
6+
import AdvancedSearch from "./AdvancedSearch";
7+
import Footer from "./Footer";
8+
import { VerticleButton as ScrollUpButton } from "react-scroll-up-button";
9+
import LaunchingComponent from "./LaunchingComponent";
10+
import { Link } from "react-router-dom";
11+
import {
12+
sortAppearances,
13+
sortTotalProjects,
14+
sortAverageProjects,
15+
} from "./SortFunctions";
1216

13-
const descendingSortByYear = (resultList) =>{
14-
return resultList.sort( (a,b) => {
15-
return (b.year.length - a.year.length)
16-
});
17-
}
17+
const descendingSortByYear = (resultList) => {
18+
return resultList.sort((a, b) => {
19+
return b.year.length - a.year.length;
20+
});
21+
};
1822

19-
const Home = ({bookmarked, setBookmarked}) => {
23+
const Home = ({ bookmarked, setBookmarked }) => {
2024
const [validList, setValidList] = useState([]);
2125
const [results, setResults] = useState(validList);
22-
const [sortParameter, setSortParameter] = useState(0)
23-
const [sortAscendingOrder, setSortAscendingOrder] = useState(false)
26+
const [sortParameter, setSortParameter] = useState(0);
27+
const [sortAscendingOrder, setSortAscendingOrder] = useState(false);
2428
const [displayLauncher, setDisplayLauncher] = useState(true);
2529

2630
const reRenderLauncher = () => {
@@ -32,25 +36,23 @@ const Home = ({bookmarked, setBookmarked}) => {
3236
useEffect(() => {
3337
// setSortAscendingOrder(false);
3438
var res = [];
35-
switch(sortParameter) {
36-
case 0:
39+
switch (sortParameter) {
40+
case 0:
3741
res = validList.sort(sortAppearances);
3842
break;
39-
case 1:
43+
case 1:
4044
res = validList.sort(sortTotalProjects);
4145
break;
42-
case 2:
46+
case 2:
4347
res = validList.sort(sortAverageProjects);
4448
break;
4549
}
46-
if(!sortAscendingOrder) {
47-
setResults([...res])
48-
}
49-
else {
50-
setResults([...res.reverse()])
50+
if (!sortAscendingOrder) {
51+
setResults([...res]);
52+
} else {
53+
setResults([...res.reverse()]);
5154
}
52-
}, [sortParameter, validList, sortAscendingOrder])
53-
55+
}, [sortParameter, validList, sortAscendingOrder]);
5456

5557
const buildSearchList = (search, filter) => {
5658
setDisplayLauncher(false);
@@ -70,7 +72,6 @@ const Home = ({bookmarked, setBookmarked}) => {
7072
return false;
7173
})
7274
);
73-
7475
} else if (filter === 1) {
7576
setValidList(
7677
data.filter((org) => org.name.toLowerCase().includes(sanitisedSearch))
@@ -99,31 +100,48 @@ const Home = ({bookmarked, setBookmarked}) => {
99100

100101
return (
101102
<React.Fragment>
102-
<Container id='mainContainer' fluid>
103-
<Header textAlign='center'>
104-
<h1 id = 'mainHeader' onClick={reRenderLauncher}> GSoC Analyser </h1>
103+
<Container id="mainContainer" fluid>
104+
<Header textAlign="center">
105+
<h1 id="mainHeader" onClick={reRenderLauncher}>
106+
{" "}
107+
GSoC Analzser{" "}
108+
</h1>
105109
</Header>
106-
<Link to="/bookmarks" className="nav-button">Bookmarks</Link>
107-
108-
<AdvancedSearch ref={AdvancedSearchRef} buildSearchList={buildSearchList} sortParameter={sortParameter} setSortParameter={setSortParameter} sortAscendingOrder={sortAscendingOrder} setSortAscendingOrder={setSortAscendingOrder}/>
110+
<Link to="/bookmarks" className="nav-button">
111+
Bookmarks
112+
</Link>
113+
114+
<AdvancedSearch
115+
ref={AdvancedSearchRef}
116+
buildSearchList={buildSearchList}
117+
sortParameter={sortParameter}
118+
setSortParameter={setSortParameter}
119+
sortAscendingOrder={sortAscendingOrder}
120+
setSortAscendingOrder={setSortAscendingOrder}
121+
/>
109122
{displayLauncher && <LaunchingComponent />}
110123
{!displayLauncher && (
111124
<Container fluid style={{ paddingTop: 50 }}>
112125
<Header
113-
style={{ color: 'white', fontSize: 50 }}
114-
textAlign='center'
115-
as='h1'
126+
style={{ color: "white", fontSize: 50 }}
127+
textAlign="center"
128+
as="h1"
116129
>
117130
Search Results: {validList.length}
118131
</Header>
119132
<br />
120133
<br />
121134
{results.map((org, index) => (
122-
<OrganisationCard key={index} orgData={org} bookmarked={bookmarked} setBookmarked={setBookmarked} />
135+
<OrganisationCard
136+
key={index}
137+
orgData={org}
138+
bookmarked={bookmarked}
139+
setBookmarked={setBookmarked}
140+
/>
123141
))}
124142
</Container>
125143
)}
126-
<ScrollUpButton style={{ color: 'white' }} />
144+
<ScrollUpButton style={{ color: "white" }} />
127145
<Footer />
128146
</Container>
129147
</React.Fragment>

src/components/Launcher/ParticipantChart.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ const ParticipantChart = (props) => {
5151
{
5252
label: "Sucessful participants",
5353
data: [
54-
328, 516.6, 733.05, 935, 850, 913.14, 981, 1073, 1060, 1172,
55-
927, 1032, 1136, 1090, 1136, 1106, 1205, 1054,
54+
328, 516, 733, 935, 850, 913, 981, 1073, 1060, 1172, 927, 1032,
55+
1136, 1090, 1136, 1106, 1205, 1054,
5656
],
5757
backgroundColor: "orange",
5858
borderColor: "red",

src/components/OrganisationCard.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ const OrganisationCard = ({ key, orgData, bookmarked, setBookmarked }) => {
9090
height={isMobile ? 300 : 250}
9191
options={{
9292
maintainAspectRatio: false,
93+
plugins: {
94+
legend: {
95+
position: "bottom",
96+
},
97+
},
9398
scales: {
9499
y: {
95100
ticks: {

0 commit comments

Comments
 (0)