From 06a26861f677dd09b623f2d374cbca1a24d77f01 Mon Sep 17 00:00:00 2001
From: mrugesh <1884376+raisedadead@users.noreply.github.com>
Date: Thu, 21 Nov 2019 15:00:22 +0530
Subject: [PATCH] fix(donate): unify layouts and navigation for consitency
(#37795)
This commit updates the layouts and the styles to be consistent with the rest of the application. This also ensures now that the gatsby navigation is used for smoother transtions.
---
client/src/client-only-routes/ShowSettings.js | 19 ++-
client/src/components/Donation/Donation.css | 3 +
client/src/components/Intro/index.js | 2 +-
client/src/components/profile/Profile.js | 2 +-
client/src/components/profile/Profile.test.js | 2 +-
client/src/pages/donate.js | 82 +++++------
client/src/pages/donation/settings.js | 132 ++++++++++--------
7 files changed, 136 insertions(+), 106 deletions(-)
diff --git a/client/src/client-only-routes/ShowSettings.js b/client/src/client-only-routes/ShowSettings.js
index dbc05d52c1..82b90cbb9f 100644
--- a/client/src/client-only-routes/ShowSettings.js
+++ b/client/src/client-only-routes/ShowSettings.js
@@ -24,6 +24,7 @@ import Portfolio from '../components/settings/Portfolio';
import Honesty from '../components/settings/Honesty';
import Certification from '../components/settings/Certification';
import DangerZone from '../components/settings/DangerZone';
+import SectionHeader from '../components/settings/SectionHeader.js';
const propTypes = {
createFlashMessage: PropTypes.func.isRequired,
@@ -54,6 +55,7 @@ const propTypes = {
isApisMicroservicesCert: PropTypes.bool,
isBackEndCert: PropTypes.bool,
isDataVisCert: PropTypes.bool,
+ isDonating: PropTypes.bool,
isEmailVerified: PropTypes.bool,
isFrontEndCert: PropTypes.bool,
isFrontEndLibsCert: PropTypes.bool,
@@ -122,6 +124,7 @@ export function ShowSettings(props) {
user: {
completedChallenges,
email,
+ isDonating,
is2018DataVisCert,
isApisMicroservicesCert,
isJsAlgoDataStructCert,
@@ -161,7 +164,7 @@ export function ShowSettings(props) {
return ;
}
- if (!showLoading && !isSignedIn) {
+ if (!isSignedIn) {
navigate(`${apiLocation}/signin?returnTo=settings`);
return ;
}
@@ -215,6 +218,20 @@ export function ShowSettings(props) {
updateQuincyEmail={updateQuincyEmail}
/>
+ {isDonating ? (
+
+ Donation Settings
+
+
+ Manage your existing donations
+
+
+
+
+ ) : null}
a {
[name='payment-method'] {
font-family: 'Lato', sans-serif;
}
+.servicebot-embed-panel .panel {
+ padding: 20px;
+}
diff --git a/client/src/components/Intro/index.js b/client/src/components/Intro/index.js
index 2507f2b04e..4c88dbce70 100644
--- a/client/src/components/Intro/index.js
+++ b/client/src/components/Intro/index.js
@@ -57,7 +57,7 @@ function Intro({
View my Portfolio
- Update my settings
+ Update my account settings
diff --git a/client/src/components/profile/Profile.js b/client/src/components/profile/Profile.js
index 018ec31d37..4369b8fc2f 100644
--- a/client/src/components/profile/Profile.js
+++ b/client/src/components/profile/Profile.js
@@ -175,7 +175,7 @@ function Profile({ user, isSessionUser, navigate }) {
{isSessionUser ? (
- Update my settings
+ Update my account settings
', () => {
it('renders the settings button on your own profile', () => {
const { getByText } = render( );
- expect(getByText('Update my settings')).toHaveAttribute(
+ expect(getByText('Update my account settings')).toHaveAttribute(
'href',
'/settings'
);
diff --git a/client/src/pages/donate.js b/client/src/pages/donate.js
index 309fb2a1fc..c131a0c1d5 100644
--- a/client/src/pages/donate.js
+++ b/client/src/pages/donate.js
@@ -3,10 +3,10 @@ import Helmet from 'react-helmet';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
-import { Grid, Row, Col, Button } from '@freecodecamp/react-bootstrap';
+import { Grid, Row, Col } from '@freecodecamp/react-bootstrap';
import { stripePublicKey } from '../../config/env.json';
-import { Spacer, Loader } from '../components/helpers';
+import { Spacer, Loader, FullWidthRow, Link } from '../components/helpers';
import DonateForm from '../components/Donation/components/DonateForm';
import DonateText from '../components/Donation/components/DonateText';
import { signInLoadingSelector, userSelector } from '../redux';
@@ -85,46 +85,48 @@ export class DonatePage extends Component {
-
-
-
+
+
+
Become a Supporter
-
-
-
-
-
-
-
-
-
- Manage your existing donation
- {[
- `Update your existing donation`,
- `Download donation receipts`
- ].map(donationSettingOps => (
-
-
- {donationSettingOps}
-
-
+
+
+
+
+
+
+
+
+
+ Manage your existing donation
+
+
+ {[
+ `Update your existing donation`,
+ `Download donation receipts`
+ ].map(donationSettingOps => (
+
+ {donationSettingOps}
+
+ ))}
- ))}
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
);
diff --git a/client/src/pages/donation/settings.js b/client/src/pages/donation/settings.js
index 090cf3cdac..94b6c08bc2 100644
--- a/client/src/pages/donation/settings.js
+++ b/client/src/pages/donation/settings.js
@@ -3,7 +3,7 @@ import Helmet from 'react-helmet';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
-import { Grid, Row, Col, Button } from '@freecodecamp/react-bootstrap';
+import { Grid, Button, Panel } from '@freecodecamp/react-bootstrap';
import { uniq } from 'lodash';
import { apiLocation } from '../../../config/env.json';
@@ -16,7 +16,8 @@ import {
} from '../../redux';
// eslint-disable-next-line max-len
import DonateServicebotEmbed from '../../components/Donation/components/DonateServicebotEmbed';
-import { Loader, Spacer, Link } from '../../components/helpers';
+import { Loader, Spacer, Link, FullWidthRow } from '../../components/helpers';
+import SectionHeader from '../../components/settings/SectionHeader.js';
const propTypes = {
donationEmails: PropTypes.array,
@@ -85,36 +86,39 @@ export class DonationSettingsPage extends Component {
renderServicebotEmbed() {
const { currentSettingsEmail, hash } = this.state;
- if (!hash || !currentSettingsEmail) {
- return null;
- }
return (
-
-
-
+
+ {!hash || !currentSettingsEmail ? (
+
+
+
+ Select the email associated to your donations above.
+
+
+ ) : (
+
+
+
+
+
+ )}
);
}
renderDonationEmailsList() {
const { donationEmails } = this.props;
- return (
-
- {uniq(donationEmails).map(email => (
-
-
- {`Show donations for your ${email} email address`}
-
-
-
- ))}
-
- );
+ return uniq(donationEmails).map(email => (
+
+ {`Show donations for your ${email} email address`}
+
+ ));
}
render() {
@@ -138,38 +142,42 @@ export class DonationSettingsPage extends Component {
-
-
-
-
+
+
+
+
+
Go to donate page
-
-
-
-
-
+
+
+ Update my account settings
+
+
+
+
Manage your donations
-
-
- Donations made using a credit or debit card
-
-
-
-
-
+
+
+
+
+ Donations made using a credit or debit card
+
+
{this.renderDonationEmailsList()}
-
-
-
-
- {this.renderServicebotEmbed()}
-
-
-
-
-
- Donations made using PayPal
+
+
+ {this.renderServicebotEmbed()}
+
+
+ Donations made using PayPal
+
You can update your PayPal donation{' '}
.
-
-
-
-
-
- Still need help?
+
+
+
+ Still need help?
+
If you can't see your donation here, forward a donation receipt
you have recieved in your email to team@freeCodeCamp.org and
tell us how we can help you with it.
-
-
-
+
+
+
+
);