Skip to content

Commit

Permalink
Merge pull request #45 from BeautifulTrouble/feature/final-debugging
Browse files Browse the repository at this point in the history
Feature/final debugging
  • Loading branch information
rapicastillo authored Oct 24, 2017
2 parents b6baea0 + 28faf09 commit 85d2f68
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 21 deletions.
2 changes: 1 addition & 1 deletion app/components/CommonComponents/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const TYPE_THEORIES = 'theory';
export const TYPE_METHODOLOGIES = 'methodology';

// RECAPTCHA FOR LOCALHOST
//export const RECAPTCHA_SITE_KEY = '6LfeoicUAAAAADHJTSBd6PhfWyrJ1O_5f2Lx5GMe';
// export const RECAPTCHA_SITE_KEY = '6LfeoicUAAAAADHJTSBd6PhfWyrJ1O_5f2Lx5GMe';

// RECAPTCHA FOR BETA AND PROD
export const RECAPTCHA_SITE_KEY = '6LeCpCgTAAAAAFc4TwetXb1yBzJvaYo-FvrQvAlx';
Expand Down
2 changes: 1 addition & 1 deletion app/containers/Header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const BellArea = styled.div`
@media(max-width: 1320px) {
position: absolute;
${p=>p.theme.ar=='ar'?'left':'right'}: 15px;
${p=>p.theme.ar=='ar'?'left':'right'}: 30px;
top: 25px;
}
`;
Expand Down
1 change: 1 addition & 0 deletions app/containers/SubmitRealWorldExample/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export function submitExample({url, title, description, captcha, documentLink, d
}

export function successfulSubmission() {

return {
type: SUBMISSION_COMPLETE
}
Expand Down
3 changes: 2 additions & 1 deletion app/containers/SubmitRealWorldExample/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export class SubmitRealWorldExample extends React.PureComponent { // eslint-disa
}

render() {

return (

<SubmitExampleContainer>
Expand Down Expand Up @@ -136,7 +137,7 @@ function mapDispatchToProps(dispatch) {
return {
dispatch,
onFormSubmit: (captchaResponse, values) => {
if (evt !== undefined && evt.preventDefault) evt.preventDefault();

dispatch(submitExample({...values, captcha: captchaResponse}));
}
};
Expand Down
2 changes: 1 addition & 1 deletion app/containers/SubmitRealWorldExample/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function submitRealWorldExampleReducer(state = initialState, action) {
.set('error', false)
.set('complete', false);
case SUBMISSION_COMPLETE:
return initialState;
return initialState.set('complete', true);
case SUBMISSION_ERROR:
return state
.set('complete', true)
Expand Down
34 changes: 19 additions & 15 deletions app/containers/SubmitRealWorldExample/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,30 @@ export function* submitExample() {
const captcha = submitExample.get('captcha');
const documentLink = submitExample.get('documentLink');
const documentTitle = submitExample.get('documentTitle');
const options = {
method: "POST",
mode: 'no-cors',
header: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
'g-recaptcha-response': captcha,
'document_title': documentTitle,
'document_link': documentLink,
'title': title,
'link': url,
'description': description
})
};


try {
const requestUrl = `https://api.beautifulrising.org/intake/real-world-example`;
yield put(request(requrestUrl, {
method: "POST",
header: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
'g-recaptcha-response': captcha,
'document_title': documentTitle,
'document_link': document_link,
'title': title,
'link': url,
'description': description
})
}));

yield put(request(requestUrl, options));
yield put(successfulSubmission());

} catch(e) {

yield call(put, submissionError(e))
}
}
Expand Down
18 changes: 16 additions & 2 deletions app/containers/Tools/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ const ToolTitle = styled.span`
color: black;
`;

const CloseSvg = styled(Isvg)`
svg {
width: 25px;
height: 25px;
}
`;
//For modalIsOpen
const customStyles = {
overlay: {
Expand All @@ -125,6 +131,7 @@ const customStyles = {
zIndex: '1000'
}
};

export class Tools extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function

constructor(props) {
Expand Down Expand Up @@ -166,6 +173,11 @@ export class Tools extends React.PureComponent { // eslint-disable-line react/pr
}
}

onMobileClose() {

this.props.handleSetMobileShowTools(false);
}

onMobileToggleClick(chosen = null) {
if (chosen !== null) {
this.props.handleSetMobileShowTools(true);
Expand Down Expand Up @@ -242,8 +254,8 @@ export class Tools extends React.PureComponent { // eslint-disable-line react/pr
overlayClassName="ToolModalOverlay"
>
<ToolsArea lang={this.props.language} show={this.props.Tools.mobileShow || this.props.Tools.onboardShow}/>
<CloseButton onClick={this.closeModal.bind(this)}>
<Isvg src={CloseIcon} />
<CloseButton onClick={this.onMobileClose.bind(this)}>
<CloseSvg src={CloseIcon} />
</CloseButton>
</Modal>
</LanguageThemeProvider>
Expand All @@ -253,6 +265,7 @@ export class Tools extends React.PureComponent { // eslint-disable-line react/pr
renderDesktopContent() {
const {locale} = this.props.intl;


return (
<ToolsViewport>
<LanguageThemeProvider>
Expand Down Expand Up @@ -331,6 +344,7 @@ function mapDispatchToProps(dispatch) {
return {
dispatch,
setShowTools: (toShow) => {

dispatch(setShowTools(toShow));
},
setViewType: (viewType) => {
Expand Down

0 comments on commit 85d2f68

Please sign in to comment.