Add available for hire button

This commit is contained in:
padulam
2017-06-17 18:09:43 -04:00
parent 53141040f4
commit ec020ad471
7 changed files with 75 additions and 0 deletions

View File

@ -0,0 +1,38 @@
import React, { PropTypes } from 'react';
import { Button, Row, Col } from 'react-bootstrap';
import classnames from 'classnames';
const propTypes = {
isAvailableForHire: PropTypes.bool,
toggle: PropTypes.func.isRequired
};
export default function JobSettings({ isAvailableForHire, toggle }) {
const className = classnames({
active: isAvailableForHire,
'btn-toggle': true
});
return (
<Row>
<Col xs={ 9 }>
<p className='large-p'>
Available for hire?
</p>
</Col>
<Col xs={ 3 }>
<Button
block={ true }
bsSize='lg'
bsStyle='primary'
className={ className }
onClick={ toggle }
>
{ isAvailableForHire ? 'Available' : 'Unavailable' }
</Button>
</Col>
</Row>
);
}
JobSettings.displayName = 'JobSettings';
JobSettings.propTypes = propTypes;

View File

@ -6,6 +6,7 @@ import { Button, Row, Col } from 'react-bootstrap';
import FA from 'react-fontawesome'; import FA from 'react-fontawesome';
import LockedSettings from './Locked-Settings.jsx'; import LockedSettings from './Locked-Settings.jsx';
import JobSettings from './Job-Settings.jsx';
import SocialSettings from './Social-Settings.jsx'; import SocialSettings from './Social-Settings.jsx';
import EmailSettings from './Email-Setting.jsx'; import EmailSettings from './Email-Setting.jsx';
import LanguageSettings from './Language-Settings.jsx'; import LanguageSettings from './Language-Settings.jsx';
@ -19,6 +20,7 @@ import { toggleNightMode, updateTitle } from '../../../redux/actions.js';
const mapDispatchToProps = { const mapDispatchToProps = {
updateTitle, updateTitle,
toggleNightMode, toggleNightMode,
toggleIsAvailableForHire: () => toggleUserFlag('isAvailableForHire'),
toggleIsLocked: () => toggleUserFlag('isLocked'), toggleIsLocked: () => toggleUserFlag('isLocked'),
toggleQuincyEmail: () => toggleUserFlag('sendQuincyEmail'), toggleQuincyEmail: () => toggleUserFlag('sendQuincyEmail'),
toggleNotificationEmail: () => toggleUserFlag('sendNotificationEmail'), toggleNotificationEmail: () => toggleUserFlag('sendNotificationEmail'),
@ -33,6 +35,7 @@ const mapStateToProps = createSelector(
user: { user: {
username, username,
email, email,
isAvailableForHire,
isLocked, isLocked,
isGithubCool, isGithubCool,
isTwitter, isTwitter,
@ -47,6 +50,7 @@ const mapStateToProps = createSelector(
showLoading: isSignInAttempted, showLoading: isSignInAttempted,
username, username,
email, email,
isAvailableForHire,
isLocked, isLocked,
isGithubCool, isGithubCool,
isTwitter, isTwitter,
@ -60,6 +64,7 @@ const propTypes = {
children: PropTypes.element, children: PropTypes.element,
email: PropTypes.string, email: PropTypes.string,
initialLang: PropTypes.string, initialLang: PropTypes.string,
isAvailableForHire: PropTypes.bool,
isGithubCool: PropTypes.bool, isGithubCool: PropTypes.bool,
isLinkedIn: PropTypes.bool, isLinkedIn: PropTypes.bool,
isLocked: PropTypes.bool, isLocked: PropTypes.bool,
@ -69,6 +74,7 @@ const propTypes = {
sendNotificationEmail: PropTypes.bool, sendNotificationEmail: PropTypes.bool,
sendQuincyEmail: PropTypes.bool, sendQuincyEmail: PropTypes.bool,
showLoading: PropTypes.bool, showLoading: PropTypes.bool,
toggleIsAvailableForHire: PropTypes.func.isRequired,
toggleIsLocked: PropTypes.func.isRequired, toggleIsLocked: PropTypes.func.isRequired,
toggleMonthlyEmail: PropTypes.func.isRequired, toggleMonthlyEmail: PropTypes.func.isRequired,
toggleNightMode: PropTypes.func.isRequired, toggleNightMode: PropTypes.func.isRequired,
@ -99,6 +105,7 @@ export class Settings extends React.Component {
const { const {
children, children,
username, username,
isAvailableForHire,
isLocked, isLocked,
isGithubCool, isGithubCool,
isTwitter, isTwitter,
@ -108,6 +115,7 @@ export class Settings extends React.Component {
sendMonthlyEmail, sendMonthlyEmail,
sendNotificationEmail, sendNotificationEmail,
sendQuincyEmail, sendQuincyEmail,
toggleIsAvailableForHire,
toggleNightMode, toggleNightMode,
toggleIsLocked, toggleIsLocked,
toggleQuincyEmail, toggleQuincyEmail,
@ -219,6 +227,22 @@ export class Settings extends React.Component {
</Col> </Col>
</Row> </Row>
<div className='spacer' /> <div className='spacer' />
<h2 className='text-center'>Job Search Settings</h2>
<Row>
<Col
md={ 6 }
mdOffset={ 3 }
sm={ 8 }
smOffset={ 2 }
xs={ 12 }
>
<JobSettings
isAvailableForHire={ isAvailableForHire }
toggle={ toggleIsAvailableForHire }
/>
</Col>
</Row>
<div className='spacer' />
<h2 className='text-center'>Email Settings</h2> <h2 className='text-center'>Email Settings</h2>
<Row> <Row>
<Col <Col

View File

@ -17,6 +17,7 @@ import combineSagas from '../../../../utils/combine-sagas';
const urlMap = { const urlMap = {
isLocked: 'lockdown', isLocked: 'lockdown',
isAvailableForHire: 'available-for-hire',
sendQuincyEmail: 'quincy-email', sendQuincyEmail: 'quincy-email',
sendNotificationEmail: 'notification-email', sendNotificationEmail: 'notification-email',
sendMonthlyEmail: 'announcement-email' sendMonthlyEmail: 'announcement-email'

View File

@ -120,6 +120,11 @@
"description": "Campers profile does not show challenges/certificates to the public", "description": "Campers profile does not show challenges/certificates to the public",
"default": false "default": false
}, },
"isAvailableForHire": {
"type": "boolean",
"description": "Camper is available for hire",
"default": false
},
"currentChallengeId": { "currentChallengeId": {
"type": "string", "type": "string",
"description": "The challenge last visited by the user", "description": "The challenge last visited by the user",

View File

@ -81,6 +81,11 @@ export default function settingsController(app) {
); );
} }
api.post(
'/toggle-available-for-hire',
ifNoUser401,
toggleUserFlag('isAvailableForHire')
);
api.post( api.post(
'/toggle-lockdown', '/toggle-lockdown',
ifNoUser401, ifNoUser401,

View File

@ -463,6 +463,7 @@ module.exports = function(app) {
isGithubCool: true, isGithubCool: true,
isCheater: true, isCheater: true,
isLocked: true, isLocked: true,
isAvailableForHire: true,
isFrontEndCert: true, isFrontEndCert: true,
isDataVisCert: true, isDataVisCert: true,
isBackEndCert: true, isBackEndCert: true,

View File

@ -16,6 +16,7 @@ const publicUserProps = [
'isGithubCool', 'isGithubCool',
'isLocked', 'isLocked',
'isAvailableForHire',
'isFrontEndCert', 'isFrontEndCert',
'isBackEndCert', 'isBackEndCert',
'isDataVisCert', 'isDataVisCert',