Skip to content

Commit 964a70e

Browse files
Merge pull request #5470 from topcoder-platform/gig-filters-url
Gig filters url
2 parents f3bb925 + dda4852 commit 964a70e

File tree

6 files changed

+32
-11
lines changed

6 files changed

+32
-11
lines changed

.circleci/config.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,7 @@ workflows:
275275
filters:
276276
branches:
277277
only:
278-
- recruit-apis
279-
- feature/recommender-sync-develop
278+
- develop
280279
# This is alternate dev env for parallel testing
281280
- "build-test":
282281
context : org-global
@@ -291,22 +290,21 @@ workflows:
291290
filters:
292291
branches:
293292
only:
294-
- bug-bash
293+
- free
295294
# This is beta env for production soft releases
296295
- "build-prod-beta":
297296
context : org-global
298297
filters:
299298
branches:
300299
only:
301-
- bug-bash
300+
- free
302301
# This is stage env for production QA releases
303302
- "build-prod-staging":
304303
context : org-global
305304
filters:
306305
branches:
307306
only:
308307
- develop
309-
- feature/recommender-sync-develop
310308
- "approve-smoke-test-on-staging":
311309
type: approval
312310
requires:

src/shared/components/GUIKit/JobListCard/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable max-len */
22
/**
3-
* SearchCombo component.
3+
* Job card component.
44
*/
55
import React from 'react';
66
import PT from 'prop-types';

src/shared/components/GUIKit/Paginate/index.jsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,25 @@
55
import React from 'react';
66
import ReactPaginate from 'react-paginate';
77
import PT from 'prop-types';
8+
import { useMediaQuery } from 'react-responsive';
89
import './style.scss';
910

1011
function Paginate({
1112
pages,
1213
page,
1314
onChange,
1415
}) {
16+
const isMobile = useMediaQuery({
17+
query: '(max-device-width: 768px)',
18+
});
1519
return (
1620
<div styleName="container">
1721
<ReactPaginate
1822
pageCount={pages}
1923
initialPage={page}
2024
forcePage={page}
21-
pageRangeDisplayed={3}
22-
marginPagesDisplayed={2}
25+
pageRangeDisplayed={isMobile ? 1 : 3}
26+
marginPagesDisplayed={isMobile ? 1 : 2}
2327
onPageChange={onChange}
2428
activeClassName="active"
2529
previousLabel="PREV"

src/shared/components/GUIKit/SearchCombo/index.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* SearchCombo component.
33
*/
4-
import React, { useState } from 'react';
4+
import React, { useState, useEffect } from 'react';
55
import PT from 'prop-types';
66
import './style.scss';
77
import IconClearSearch from 'assets/images/icon-clear-search.svg';
@@ -13,6 +13,7 @@ function SearchCombo({
1313
onSearch,
1414
}) {
1515
const [inputVal, setVal] = useState(term);
16+
useEffect(() => setVal(term), [term]);
1617
const clearSearch = () => {
1718
setVal('');
1819
onSearch('');

src/shared/containers/Gigs/RecruitCRMJobs.jsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import Dropdown from 'components/GUIKit/Dropdown';
1212
import PT from 'prop-types';
1313
import React from 'react';
1414
import { connect } from 'react-redux';
15+
import { getQuery, updateQuery } from 'utils/url';
1516
import './jobLisingStyles.scss';
1617

1718
const GIGS_PER_PAGE = 10;
@@ -48,14 +49,23 @@ class RecruitCRMJobsContainer extends React.Component {
4849
getJobs,
4950
jobs,
5051
} = this.props;
51-
52+
const { state } = this;
53+
const q = getQuery();
5254
// This gets all jobs.
5355
// Pagination and filtering on front-side
5456
if (!jobs.length) {
5557
getJobs({
5658
job_status: 1, // Open jobs only
5759
});
5860
}
61+
// handle URL query if present
62+
if (q && q.search) {
63+
const stateUpdate = {
64+
...state,
65+
term: q.search,
66+
};
67+
this.setState(stateUpdate);
68+
}
5969
}
6070

6171
/**
@@ -64,7 +74,6 @@ class RecruitCRMJobsContainer extends React.Component {
6474
*/
6575
onFilter(newState) {
6676
// Do updates
67-
6877
// update the state
6978
this.setState(newState);
7079
}
@@ -74,12 +83,20 @@ class RecruitCRMJobsContainer extends React.Component {
7483
term: newTerm,
7584
page: 0,
7685
});
86+
// update the URL query
87+
updateQuery({
88+
search: newTerm,
89+
});
7790
}
7891

7992
onPaginate(newPage) {
8093
this.onFilter({
8194
page: newPage.selected,
8295
});
96+
window.scrollTo({
97+
top: 0,
98+
behavior: 'smooth',
99+
});
83100
}
84101

85102
onLocation(newLocation) {

src/shared/containers/Gigs/jobLisingStyles.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
@include xs-to-sm {
3232
margin-right: 0;
33+
margin-bottom: 15px;
3334
}
3435

3536
&:first-child {

0 commit comments

Comments
 (0)