Skip to content

Commit 331ce66

Browse files
committed
Update role search timing to 1500ms per frame.
topcoder-archive#373 (comment)
1 parent 479a7ad commit 331ce66

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

src/constants/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,3 +397,9 @@ export const MIN_DURATION = 4;
397397
* Maximum allowed numbers of selecter skills for search.
398398
*/
399399
export const MAX_SELECTED_SKILLS = 3;
400+
401+
/**
402+
* Milliseconds for each stage of role search
403+
* There are 3 stages, so total search takes 3x this number
404+
*/
405+
export const SEARCH_STAGE_TIME = 1500;

src/routes/CreateNewTeam/components/SearchAndSubmit/index.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Router, navigate } from "@reach/router";
22
import _ from "lodash";
33
import React, { useCallback, useState, useEffect } from "react";
44
import { useDispatch, useSelector } from "react-redux";
5+
import { SEARCH_STAGE_TIME } from "constants/";
56
import { searchRoles } from "services/teams";
67
import { isCustomRole, setCurrentStage } from "utils/helpers";
78
import {
@@ -14,7 +15,7 @@ import InputContainer from "../InputContainer";
1415
import SearchContainer from "../SearchContainer";
1516
import SubmitContainer from "../SubmitContainer";
1617

17-
const SEARCHINGTIME = 1600;
18+
const SEARCHINGTIME = SEARCH_STAGE_TIME * 3 + 100;
1819

1920
function SearchAndSubmit(props) {
2021
const { stages, setStages, searchObject, onClick, page } = props;
@@ -80,7 +81,9 @@ function SearchAndSubmit(props) {
8081
setCurrentStage(2, stages, setStages);
8182
setSearchState("done");
8283
},
83-
Date.now() - searchingBegin > SEARCHINGTIME ? 0 : 1500
84+
Date.now() - searchingBegin > SEARCHINGTIME
85+
? 0
86+
: SEARCH_STAGE_TIME * 3
8487
);
8588
});
8689
// eslint-disable-next-line react-hooks/exhaustive-deps

src/routes/CreateNewTeam/components/SearchCard/index.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import IconEarthSearch from "../../../../assets/images/icon-earth-search.svg";
99
import WorldMapDotted from "../../../../assets/images/world-map-dotted.svg";
1010
import WorldMapSearch1 from "../../../../assets/images/world-map-search1.svg";
1111
import WorldMapSearch2 from "../../../../assets/images/world-map-search2.svg";
12+
import { SEARCH_STAGE_TIME } from "constants/";
1213

1314
function SearchCard() {
1415
const [searchState, setSearchState] = useState(null);
@@ -19,8 +20,8 @@ function SearchCard() {
1920
setSearchState("state1");
2021
timer2 = setTimeout(() => {
2122
setSearchState("state2");
22-
}, 500);
23-
}, 500);
23+
}, SEARCH_STAGE_TIME);
24+
}, SEARCH_STAGE_TIME);
2425

2526
return () => {
2627
clearTimeout(timer1);

0 commit comments

Comments
 (0)