Skip to content

Commit cb29c19

Browse files
authored
Merge pull request #37 from topcoder-platform/PROD-2504_prevent-donate-modal
PROD-2504 - prevent FCC donate modal
2 parents c208bab + 304c826 commit cb29c19

File tree

6 files changed

+5
-66
lines changed

6 files changed

+5
-66
lines changed

client/src/components/layouts/learn.tsx

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ import { Loader } from '../../components/helpers';
66
import {
77
userSelector,
88
userFetchStateSelector,
9-
isSignedInSelector,
10-
tryToShowDonationModal
9+
isSignedInSelector
1110
} from '../../redux';
12-
import DonateModal from '../Donation/donation-modal';
1311

1412
import './prism.css';
1513
import './prism-night.css';
@@ -37,28 +35,16 @@ const mapStateToProps = createSelector(
3735
})
3836
);
3937

40-
const mapDispatchToProps = {
41-
tryToShowDonationModal
42-
};
38+
const mapDispatchToProps = {};
4339

4440
type LearnLayoutProps = {
4541
isSignedIn?: boolean;
4642
fetchState: FetchState;
4743
user: User;
48-
tryToShowDonationModal: () => void;
4944
children?: React.ReactNode;
5045
};
5146

52-
function LearnLayout({
53-
fetchState,
54-
tryToShowDonationModal,
55-
children
56-
}: LearnLayoutProps): JSX.Element {
57-
useEffect(() => {
58-
tryToShowDonationModal();
59-
// eslint-disable-next-line react-hooks/exhaustive-deps
60-
}, []);
61-
47+
function LearnLayout({ fetchState, children }: LearnLayoutProps): JSX.Element {
6248
useEffect(() => {
6349
return () => {
6450
const metaTag = document.querySelector(`meta[name="robots"]`);
@@ -78,9 +64,6 @@ function LearnLayout({
7864
<meta content='noindex' name='robots' />
7965
</Helmet>
8066
<main id='learn-app-wrapper'>{children}</main>
81-
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */
82-
/* @ts-ignore */}
83-
<DonateModal />
8467
</>
8568
);
8669
}

client/src/redux/action-types.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ export const actionTypes = createTypes(
66
[
77
'appMount',
88
'hardGoTo',
9-
'allowBlockDonationRequests',
109
'closeDonationModal',
1110
'hideCodeAlly',
1211
'preventBlockDonationRequests',
@@ -16,7 +15,6 @@ export const actionTypes = createTypes(
1615
'serverStatusChange',
1716
'resetUserData',
1817
'tryToShowCodeAlly',
19-
'tryToShowDonationModal',
2018
'executeGA',
2119
'showCodeAlly',
2220
'submitComplete',

client/src/redux/index.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { createAcceptTermsSaga } from './accept-terms-saga';
1010
import { actionTypes } from './action-types';
1111
import { createAppMountSaga } from './app-mount-saga';
1212
import { createCodeAllySaga } from './codeally-saga';
13-
import { createDonationSaga } from './donation-saga';
1413
import failedUpdatesEpic from './failed-updates-epic';
1514
import { createFetchUserSaga } from './fetch-user-saga';
1615
import { createGaSaga } from './ga-saga';
@@ -76,7 +75,6 @@ export const sagas = [
7675
...createAcceptTermsSaga(actionTypes),
7776
...createAppMountSaga(actionTypes),
7877
...createCodeAllySaga(actionTypes),
79-
...createDonationSaga(actionTypes),
8078
...createGaSaga(actionTypes),
8179
...createFetchUserSaga(actionTypes),
8280
...createShowCertSaga(actionTypes),
@@ -87,15 +85,8 @@ export const sagas = [
8785

8886
export const appMount = createAction(actionTypes.appMount);
8987

90-
export const tryToShowDonationModal = createAction(
91-
actionTypes.tryToShowDonationModal
92-
);
93-
9488
export const executeGA = createAction(actionTypes.executeGA);
9589

96-
export const allowBlockDonationRequests = createAction(
97-
actionTypes.allowBlockDonationRequests
98-
);
9990
export const closeDonationModal = createAction(actionTypes.closeDonationModal);
10091
export const openDonationModal = createAction(actionTypes.openDonationModal);
10192
export const preventBlockDonationRequests = createAction(
@@ -444,12 +435,6 @@ export const reducer = handleActions(
444435
}
445436
};
446437
},
447-
[actionTypes.allowBlockDonationRequests]: (state, { payload }) => {
448-
return {
449-
...state,
450-
recentlyClaimedBlock: payload
451-
};
452-
},
453438
[actionTypes.updateDonationFormState]: (state, { payload }) => ({
454439
...state,
455440
donationFormState: { ...state.donationFormState, ...payload }

client/src/templates/Challenges/components/completion-modal.tsx

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@ import { createSelector } from 'reselect';
1212
import { dasherize } from '../../../../../utils/slugs';
1313
import { isProject } from '../../../../utils/challenge-types';
1414
import Login from '../../../components/Header/components/Login';
15-
import {
16-
isSignedInSelector,
17-
executeGA,
18-
allowBlockDonationRequests
19-
} from '../../../redux';
15+
import { isSignedInSelector, executeGA } from '../../../redux';
2016
import { AllChallengeNode, ChallengeFiles } from '../../../redux/prop-types';
2117

2218
import {
@@ -68,9 +64,6 @@ const mapDispatchToProps = function (dispatch: Dispatch) {
6864
submitChallenge: () => {
6965
dispatch(submitChallenge());
7066
},
71-
allowBlockDonationRequests: (block: string) => {
72-
dispatch(allowBlockDonationRequests(block));
73-
},
7467
executeGA
7568
};
7669
return () => dispatchers;
@@ -97,7 +90,6 @@ export function getCompletedPercent(
9790
}
9891

9992
interface CompletionModalsProps {
100-
allowBlockDonationRequests: (arg0: string) => void;
10193
block: string;
10294
blockName: string;
10395
certification: string;
@@ -187,17 +179,6 @@ export class CompletionModalInner extends Component<
187179

188180
handleSubmit(): void {
189181
this.props.submitChallenge();
190-
this.checkBlockCompletion();
191-
}
192-
193-
// check block completion for donation
194-
checkBlockCompletion(): void {
195-
if (
196-
this.state.completedPercent === 100 &&
197-
!this.props.completedChallengesIds.includes(this.props.id)
198-
) {
199-
this.props.allowBlockDonationRequests(this.props.blockName);
200-
}
201182
}
202183

203184
componentWillUnmount(): void {

client/src/templates/Challenges/components/tool-panel.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import {
2-
Button,
3-
} from '@freecodecamp/react-bootstrap';
1+
import { Button } from '@freecodecamp/react-bootstrap';
42
import React from 'react';
53
import { useTranslation } from 'react-i18next';
64
import { connect } from 'react-redux';

client/src/templates/Introduction/super-block-intro.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { bindActionCreators, Dispatch } from 'redux';
1111
import { createSelector } from 'reselect';
1212

1313
import { SuperBlocks } from '../../../../config/certification-settings';
14-
import DonateModal from '../../components/Donation/donation-modal';
1514
import Login from '../../components/Header/components/Login';
1615
import Map from '../../components/Map';
1716
import { Spacer } from '../../components/helpers';
@@ -20,7 +19,6 @@ import {
2019
userFetchStateSelector,
2120
signInLoadingSelector,
2221
isSignedInSelector,
23-
tryToShowDonationModal,
2422
userSelector
2523
} from '../../redux';
2624
import { MarkdownRemark, AllChallengeNode, User } from '../../redux/prop-types';
@@ -54,7 +52,6 @@ type SuperBlockProp = {
5452
resetExpansion: () => void;
5553
t: TFunction;
5654
toggleBlock: (arg0: string) => void;
57-
tryToShowDonationModal: () => void;
5855
user: User;
5956
};
6057

@@ -86,7 +83,6 @@ const mapStateToProps = (state: Record<string, unknown>) => {
8683
const mapDispatchToProps = (dispatch: Dispatch) =>
8784
bindActionCreators(
8885
{
89-
tryToShowDonationModal,
9086
resetExpansion,
9187
toggleBlock: b => toggleBlock(b)
9288
},
@@ -96,7 +92,6 @@ const mapDispatchToProps = (dispatch: Dispatch) =>
9692
const SuperBlockIntroductionPage = (props: SuperBlockProp) => {
9793
useEffect(() => {
9894
initializeExpandedState();
99-
props.tryToShowDonationModal();
10095

10196
setTimeout(() => {
10297
configureAnchors({ offset: -40, scrollDuration: 400 });
@@ -245,7 +240,6 @@ const SuperBlockIntroductionPage = (props: SuperBlockProp) => {
245240
</Col>
246241
</Row>
247242
</Grid>
248-
<DonateModal location={props.location} />
249243
</>
250244
);
251245
};

0 commit comments

Comments
 (0)