Skip to content

Gig filters url #5470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,7 @@ workflows:
filters:
branches:
only:
- recruit-apis
- feature/recommender-sync-develop
- develop
# This is alternate dev env for parallel testing
- "build-test":
context : org-global
Expand All @@ -291,22 +290,21 @@ workflows:
filters:
branches:
only:
- bug-bash
- free
# This is beta env for production soft releases
- "build-prod-beta":
context : org-global
filters:
branches:
only:
- bug-bash
- free
# This is stage env for production QA releases
- "build-prod-staging":
context : org-global
filters:
branches:
only:
- develop
- feature/recommender-sync-develop
- "approve-smoke-test-on-staging":
type: approval
requires:
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/GUIKit/JobListCard/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable max-len */
/**
* SearchCombo component.
* Job card component.
*/
import React from 'react';
import PT from 'prop-types';
Expand Down
8 changes: 6 additions & 2 deletions src/shared/components/GUIKit/Paginate/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,25 @@
import React from 'react';
import ReactPaginate from 'react-paginate';
import PT from 'prop-types';
import { useMediaQuery } from 'react-responsive';
import './style.scss';

function Paginate({
pages,
page,
onChange,
}) {
const isMobile = useMediaQuery({
query: '(max-device-width: 768px)',
});
return (
<div styleName="container">
<ReactPaginate
pageCount={pages}
initialPage={page}
forcePage={page}
pageRangeDisplayed={3}
marginPagesDisplayed={2}
pageRangeDisplayed={isMobile ? 1 : 3}
marginPagesDisplayed={isMobile ? 1 : 2}
onPageChange={onChange}
activeClassName="active"
previousLabel="PREV"
Expand Down
3 changes: 2 additions & 1 deletion src/shared/components/GUIKit/SearchCombo/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* SearchCombo component.
*/
import React, { useState } from 'react';
import React, { useState, useEffect } from 'react';
import PT from 'prop-types';
import './style.scss';
import IconClearSearch from 'assets/images/icon-clear-search.svg';
Expand All @@ -13,6 +13,7 @@ function SearchCombo({
onSearch,
}) {
const [inputVal, setVal] = useState(term);
useEffect(() => setVal(term), [term]);
const clearSearch = () => {
setVal('');
onSearch('');
Expand Down
21 changes: 19 additions & 2 deletions src/shared/containers/Gigs/RecruitCRMJobs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Dropdown from 'components/GUIKit/Dropdown';
import PT from 'prop-types';
import React from 'react';
import { connect } from 'react-redux';
import { getQuery, updateQuery } from 'utils/url';
import './jobLisingStyles.scss';

const GIGS_PER_PAGE = 10;
Expand Down Expand Up @@ -48,14 +49,23 @@ class RecruitCRMJobsContainer extends React.Component {
getJobs,
jobs,
} = this.props;

const { state } = this;
const q = getQuery();
// This gets all jobs.
// Pagination and filtering on front-side
if (!jobs.length) {
getJobs({
job_status: 1, // Open jobs only
});
}
// handle URL query if present
if (q && q.search) {
const stateUpdate = {
...state,
term: q.search,
};
this.setState(stateUpdate);
}
}

/**
Expand All @@ -64,7 +74,6 @@ class RecruitCRMJobsContainer extends React.Component {
*/
onFilter(newState) {
// Do updates

// update the state
this.setState(newState);
}
Expand All @@ -74,12 +83,20 @@ class RecruitCRMJobsContainer extends React.Component {
term: newTerm,
page: 0,
});
// update the URL query
updateQuery({
search: newTerm,
});
}

onPaginate(newPage) {
this.onFilter({
page: newPage.selected,
});
window.scrollTo({
top: 0,
behavior: 'smooth',
});
}

onLocation(newLocation) {
Expand Down
1 change: 1 addition & 0 deletions src/shared/containers/Gigs/jobLisingStyles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

@include xs-to-sm {
margin-right: 0;
margin-bottom: 15px;
}

&:first-child {
Expand Down