Skip to content

Commit 6957cbc

Browse files
committed
world map appending additional country fix
1 parent 9ffa8a7 commit 6957cbc

File tree

9 files changed

+26
-10
lines changed

9 files changed

+26
-10
lines changed

.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
REACT_APP_API_URL=http://127.0.0.1:5000/
2+
NODE_ENV=development

.env.sample

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
REACT_APP_API_URL=
2+
NODE_ENV=

.production.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
REACT_APP_API_URL=https://humaniki-staging.wmflabs.org/api/
2+
NODE_ENV=development

src/Components/WorldMap.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ function WorldMap1({ mapData, property }) {
1111
// will be called initially and on every data change
1212
useEffect(() => {
1313
const svg = select(svgRef.current);
14-
const g = svg.append('g');
15-
14+
const g = svg.select(".countries")
1615

1716
const {width, height} = dimensions || wrapperRef.current.getBoundingClientRect() ;
1817
const projection = geoMercator().fitSize([width,height], mapData);
@@ -32,10 +31,10 @@ function WorldMap1({ mapData, property }) {
3231
.selectAll(".country")
3332
.data(mapData.features)
3433
.join("path")
34+
.attr("class", "country")
3535
.on("click", feature => {
3636
setSelectedCountry(selectedCountry === feature ? null : feature);
3737
})
38-
.attr("class", "country")
3938
.attr("fill", feature => colorScale(feature.properties[property]))
4039
.attr("d", feature => pathGenerator(feature))
4140
.append("title")
@@ -57,7 +56,9 @@ function WorldMap1({ mapData, property }) {
5756

5857
return (
5958
<div ref={wrapperRef} style={{ marginBottom: "2rem" }}>
60-
<svg className="world-map"ref={svgRef}></svg>
59+
<svg className="world-map"ref={svgRef}>
60+
<g className="countries"></g>
61+
</svg>
6162
</div>
6263
);
6364
}

src/Containers/AppContainer.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ function AppContainer() {
1818
{navBar === "gender-by-country" ? <GenderByCountryView /> : null}
1919
{navBar === "gender-by-DOB" ? <GenderByDOBView /> : null}
2020
{navBar === "language" ? <GenderByLanguageView /> : null}
21-
<br />
22-
<Footer />
21+
<Footer className="fixed-bottom" />
2322
</div>
2423
);
2524
}

src/Views/AdvancedSearchView.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ function AdvancedSearchView(){
4646
function setFetchURL(formState){
4747
// let url = `http://localhost:5000/v1/gender/gap/${formState.snapshot ? formState.snapshot : "latest"}/${selectedWikipediaHumanType}/properties?`
4848
// let url = `https://humaniki-staging.wmflabs.org/api/v1/gender/gap/${formState.snapshot ? formState.snapshot : "latest"}/${selectedWikipediaHumanType}/properties?`
49-
let url = `http://127.0.0.1:5000/v1/gender/gap/${formState.snapshot ? formState.snapshot : "latest"}/${selectedWikipediaHumanType}/properties?`
49+
// let baseURL = "http://127.0.0.1:5000/v1/gender/gap/"
50+
51+
let baseURL = process.env.REACT_APP_API_URL
52+
let url = `${baseURL}v1/gender/gap/${formState.snapshot ? formState.snapshot : "latest"}/${selectedWikipediaHumanType}/properties?`
5053
if (formState.year) {
5154
url = url + `&date_of_birth=${formState.year}`
5255
}

src/Views/GenderByCountryView.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ function GenderByCountryView(props){
4343
function fetchData() {
4444
// fetch(`http://localhost:3000/v1/${selectedWikipediaHumanType}/gender/aggregated/2020-09-15/geography/${selectBirthVsCitizenship}.json`)
4545
// fetch('http://localhost:3000/v1/all-wikidata/gender/aggregated/2020-09-15/geography/citizenship.json')
46-
fetch("http://127.0.0.1:5000/v1/gender/gap/latest/gte_one_sitelink/properties?citizenship=all")
46+
let baseURL = process.env.REACT_APP_API_URL
47+
let url = baseURL + "v1/gender/gap/latest/gte_one_sitelink/properties?citizenship=all"
48+
fetch(url)
4749
.then(response => response.json())
4850
.then(fetchData => {
4951
setAPIData(fetchData)

src/Views/GenderByDOBView.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ function GenderByDOBView(){
124124
}
125125

126126
useEffect(() => {
127-
fetch('http://127.0.0.1:5000/v1/gender/gap/latest/gte_one_sitelink/properties?date_of_birth=all&label_lang=en')
127+
let baseURL = process.env.REACT_APP_API_URL
128+
let url = baseURL + "v1/gender/gap/latest/gte_one_sitelink/properties?date_of_birth=all&label_lang=en"
129+
fetch(url)
128130
.then(response => response.json())
129131
.then(data => processData(data))
130132
}, [])

src/Views/GenderByLanguageView.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ function GenderByLanguageView(){
1818
const [tableColumns, setTableColumns] = useState([])
1919

2020
function fetchData(){
21-
fetch('http://127.0.0.1:5000/v1/gender/gap/latest/all_wikidata/properties?project=all&label_lang=en')
21+
let baseURL = process.env.REACT_APP_API_URL
22+
let url = baseURL + 'v1/gender/gap/latest/all_wikidata/properties?project=all&label_lang=en'
23+
console.log("BASE URL", baseURL)
24+
fetch(url)
2225
.then(response => response.json())
2326
.then(data => processData(data))
2427
}

0 commit comments

Comments
 (0)