Skip to content

Commit e87a3fa

Browse files
phongntcagdas001
authored andcommitted
changes for topcoder-archive#15
1 parent dd485a7 commit e87a3fa

File tree

4 files changed

+5
-44
lines changed

4 files changed

+5
-44
lines changed

client/src/components/FiltersSideMenu/filters.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import config from "../../config";
2222
* locations: the values for the location filter options
2323
* achievements: the values for the achievements filter options
2424
*/
25-
export default function SearchTabFilters({ locations, achievements }) {
25+
export default function SearchTabFilters({ achievements }) {
2626
const search = useSearch();
2727
const [achievementsData, setAchievementsData] = useState(achievements);
2828

@@ -50,7 +50,7 @@ export default function SearchTabFilters({ locations, achievements }) {
5050

5151
useEffect(() => {
5252
setAchievementsData(achievements);
53-
}, [locations, achievements]);
53+
}, [achievements]);
5454

5555
const filterData = (query, initialValues, property, setState) => {
5656
const q = query.toLowerCase();
@@ -355,7 +355,6 @@ export default function SearchTabFilters({ locations, achievements }) {
355355
}
356356

357357
SearchTabFilters.propTypes = {
358-
locations: PT.array,
359358
achievements: PT.array,
360359
};
361360

client/src/components/FiltersSideMenu/index.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@ import PT from "prop-types";
44
import style from "./style.module.scss";
55
import SearchTabFilters from "./filters";
66

7-
export default function FiltersSideMenu({ locations, achievements }) {
7+
export default function FiltersSideMenu({ achievements }) {
88
return (
99
<div className={style.container}>
10-
<SearchTabFilters locations={locations} achievements={achievements} />
10+
<SearchTabFilters achievements={achievements} />
1111
</div>
1212
);
1313
}
1414

1515
FiltersSideMenu.propTypes = {
16-
locations: PT.array.isRequired,
1716
achievements: PT.array.isRequired,
1817
};

client/src/pages/Search/Global.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ export default function SearchGlobal({ keyword }) {
5050
const apiClient = api();
5151
const searchContext = useSearch();
5252
const [isSearching, setIsSearching] = React.useState(false);
53-
const [locations, setLocations] = React.useState([]);
5453
const [achievements, setAchievements] = React.useState([]);
5554
const [users, setUsers] = React.useState([]);
5655
const [page, setPage] = React.useState(1);
@@ -85,11 +84,9 @@ export default function SearchGlobal({ keyword }) {
8584
let isSubscribed = true;
8685

8786
(async () => {
88-
const locations = await staticData.getLocations();
8987
const achievements = await staticData.getAchievements();
9088

9189
if (isSubscribed) {
92-
setLocations(locations);
9390
setAchievements(achievements);
9491
}
9592
})();
@@ -302,7 +299,7 @@ export default function SearchGlobal({ keyword }) {
302299
return (
303300
<>
304301
<div className={style.sideMenu}>
305-
<FiltersSideMenu locations={locations} achievements={achievements} />
302+
<FiltersSideMenu achievements={achievements} />
306303
</div>
307304
{!isSearching && users.length > 0 && (
308305
<div className={style.rightSide}>

client/src/services/static-data.js

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,3 @@
1-
async function getLocations() {
2-
const mockLocationTags = [
3-
{ name: "London" },
4-
{ name: "New York" },
5-
{ name: "East Carmen" },
6-
{ name: "Savanahville" },
7-
{ name: "Lake Audra" },
8-
{ name: "Elainaville" },
9-
{ name: "Howellstad" },
10-
{ name: "West Reneefort" },
11-
{ name: "Vanside" },
12-
{ name: "East Jonatan" },
13-
{ name: "Gottliebton" },
14-
{ name: "Ervinchester" },
15-
{ name: "Matteoburgh" },
16-
{ name: "Curtmouth" },
17-
{ name: "North Raphaelleton" },
18-
{ name: "Laishaside" },
19-
{ name: "West Trystanmouth" },
20-
{ name: "West Torrey" },
21-
{ name: "Abernathystad" },
22-
{ name: "Danland" },
23-
{ name: "Lednertown" },
24-
{ name: "Athenamouth" },
25-
{ name: "North Abagailport" },
26-
{ name: "North Andres" },
27-
{ name: "New Herbert" },
28-
{ name: "Bergstrombury" },
29-
{ name: "West Santinoside" },
30-
];
31-
return mockLocationTags;
32-
}
33-
341
async function getAchievements() {
352
const mockAchievementsTags = [
363
{ name: "Informatika" },
@@ -42,6 +9,5 @@ async function getAchievements() {
429
}
4310

4411
export default {
45-
getLocations,
4612
getAchievements,
4713
};

0 commit comments

Comments
 (0)